Add datatables-1.9.4 and jquery-1.10.2 libraries
[proteocache.git] / webapp / resources / datatables-1.9.4 / media / unit_testing / tests_onhold / 1_dom / bProcessing.js
1 // DATA_TEMPLATE: dom_data
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         var oSettings = oTable.fnSettings();
14         
15         oTest.fnTest( 
16                 "Processing is off by default",
17                 null,
18                 function () { return oSettings.oFeatures.bProcessing == false; }
19         );
20         
21         oTest.fnTest( 
22                 "Processing div is not in the DOM",
23                 function () { oTable.oApi._fnProcessingDisplay( oSettings, true ); },
24                 function () { return document.getElementById('example_processing') == null; }
25         );
26         
27         oTest.fnTest( 
28                 "Processing div cannot be shown",
29                 function () { oTable.oApi._fnProcessingDisplay( oSettings, true ); },
30                 function () { return document.getElementById('example_processing') == null; }
31         );
32         
33         oTest.fnTest( 
34                 "Processing div cannot be hidden",
35                 function () { oTable.oApi._fnProcessingDisplay( oSettings, false ); },
36                 function () { return document.getElementById('example_processing') == null; }
37         );
38         
39         
40         /* Check can disable */
41         oTest.fnTest( 
42                 "Processing can be enabled",
43                 function () {
44                         oSession.fnRestore();
45                         oTable = $('#example').dataTable( {
46                                 "bProcessing": true
47                         } );
48                         oSettings = oTable.fnSettings();
49                 },
50                 function () { return oSettings.oFeatures.bProcessing == true; }
51         );
52         
53         oTest.fnTest( 
54                 "Processing div is in the DOM",
55                 function () { oTable.oApi._fnProcessingDisplay( oSettings, true ); },
56                 function () { return document.getElementById('example_processing'); }
57         );
58         
59         oTest.fnTest( 
60                 "Processing div is hidden by default",
61                 function () { oTable.oApi._fnProcessingDisplay( oSettings, true ); },
62                 function () { return document.getElementById('example_processing').style.visibility = "hidden"; }
63         );
64         
65         oTest.fnTest( 
66                 "Processing div can be shown",
67                 function () { oTable.oApi._fnProcessingDisplay( oSettings, true ); },
68                 function () { return document.getElementById('example_processing').style.visibility = "visible"; }
69         );
70         
71         oTest.fnTest( 
72                 "Processing div can be hidden",
73                 function () { oTable.oApi._fnProcessingDisplay( oSettings, false ); },
74                 function () { return document.getElementById('example_processing').style.visibility = "hidden"; }
75         );
76         
77         /* Enable makes no difference */
78         oTest.fnTest( 
79                 "Processing disabled override",
80                 function () {
81                         oSession.fnRestore();
82                         oTable = $('#example').dataTable( {
83                                 "bProcessing": false
84                         } );
85                         oSettings = oTable.fnSettings();
86                 },
87                 function () { return oSettings.oFeatures.bProcessing == false; }
88         );
89         
90         oTest.fnTest( 
91                 "Processing div is not in the DOM",
92                 function () { oTable.oApi._fnProcessingDisplay( oSettings, true ); },
93                 function () { return document.getElementById('example_processing') == null; }
94         );
95         
96         
97         
98         oTest.fnComplete();
99 } );