/[projects]/misc/horsensspejder-web/jquery/DataTables-1.9.4/media/unit_testing/tests_onhold/4_server-side/bProcessing.js
ViewVC logotype

Contents of /misc/horsensspejder-web/jquery/DataTables-1.9.4/media/unit_testing/tests_onhold/4_server-side/bProcessing.js

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2125 - (show annotations) (download) (as text)
Wed Mar 12 19:30:05 2014 UTC (10 years, 2 months ago) by torben
File MIME type: application/javascript
File size: 3368 byte(s)
initial import
1 // DATA_TEMPLATE: empty_table
2 oTest.fnStart( "bProcessing" );
3
4 /* It's actually a bit hard to set this one due to the fact that it will only be shown
5 * when DataTables is doing some kind of processing. The server-side processing is a bit
6 * better to test this than here - so we just the interal functions to enable it and check
7 * that it is available
8 */
9
10 $(document).ready( function () {
11 /* Check the default */
12 var oTable = $('#example').dataTable( {
13 "bServerSide": true,
14 "sAjaxSource": "../../../examples/server_side/scripts/server_processing.php"
15 } );
16 var oSettings = oTable.fnSettings();
17
18 oTest.fnWaitTest(
19 "Processing is off by default",
20 null,
21 function () { return oSettings.oFeatures.bProcessing == false; }
22 );
23
24 oTest.fnWaitTest(
25 "Processing div is not in the DOM",
26 function () { oTable.oApi._fnProcessingDisplay( oSettings, true ); },
27 function () { return document.getElementById('example_processing') == null; }
28 );
29
30 oTest.fnWaitTest(
31 "Processing div cannot be shown",
32 function () { oTable.oApi._fnProcessingDisplay( oSettings, true ); },
33 function () { return document.getElementById('example_processing') == null; }
34 );
35
36 oTest.fnWaitTest(
37 "Processing div cannot be hidden",
38 function () { oTable.oApi._fnProcessingDisplay( oSettings, false ); },
39 function () { return document.getElementById('example_processing') == null; }
40 );
41
42
43 /* Check can disable */
44 oTest.fnWaitTest(
45 "Processing can be enabled",
46 function () {
47 oSession.fnRestore();
48 oTable = $('#example').dataTable( {
49 "bServerSide": true,
50 "sAjaxSource": "../../../examples/server_side/scripts/server_processing.php",
51 "bProcessing": true
52 } );
53 oSettings = oTable.fnSettings();
54 },
55 function () { return oSettings.oFeatures.bProcessing == true; }
56 );
57
58 oTest.fnWaitTest(
59 "Processing div is in the DOM",
60 function () { oTable.oApi._fnProcessingDisplay( oSettings, true ); },
61 function () { return document.getElementById('example_processing'); }
62 );
63
64 oTest.fnWaitTest(
65 "Processing div is hidden by default",
66 function () { oTable.oApi._fnProcessingDisplay( oSettings, true ); },
67 function () { return document.getElementById('example_processing').style.visibility = "hidden"; }
68 );
69
70 oTest.fnWaitTest(
71 "Processing div can be shown",
72 function () { oTable.oApi._fnProcessingDisplay( oSettings, true ); },
73 function () { return document.getElementById('example_processing').style.visibility = "visible"; }
74 );
75
76 oTest.fnWaitTest(
77 "Processing div can be hidden",
78 function () { oTable.oApi._fnProcessingDisplay( oSettings, false ); },
79 function () { return document.getElementById('example_processing').style.visibility = "hidden"; }
80 );
81
82 /* Enable makes no difference */
83 oTest.fnWaitTest(
84 "Processing disabled override",
85 function () {
86 oSession.fnRestore();
87 oTable = $('#example').dataTable( {
88 "bServerSide": true,
89 "sAjaxSource": "../../../examples/server_side/scripts/server_processing.php",
90 "bProcessing": false
91 } );
92 oSettings = oTable.fnSettings();
93 },
94 function () { return oSettings.oFeatures.bProcessing == false; }
95 );
96
97 oTest.fnWaitTest(
98 "Processing div is not in the DOM",
99 function () { oTable.oApi._fnProcessingDisplay( oSettings, true ); },
100 function () { return document.getElementById('example_processing') == null; }
101 );
102
103
104
105 oTest.fnComplete();
106 } );

  ViewVC Help
Powered by ViewVC 1.1.20