Add datatables-1.9.4 and jquery-1.10.2 libraries
[proteocache.git] / webapp / resources / datatables-1.9.4 / media / unit_testing / tests_onhold / 3_ajax / aoColumns.bVisible.js
1 // DATA_TEMPLATE: empty_table
2 oTest.fnStart( "aoColumns.bVisible" );
3
4 $(document).ready( function () {
5         /* Check the default */
6         var oTable = $('#example').dataTable( {
7                 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt"
8         } );
9         var oSettings = oTable.fnSettings();
10         
11         oTest.fnWaitTest( 
12                 "All columns are visible by default",
13                 null,
14                 function () { return $('#example tbody tr:eq(0) td').length == 5; }
15         );
16         
17         oTest.fnWaitTest( 
18                 "Can hide one column and it removes td column from DOM",
19                 function () {
20                         oSession.fnRestore();
21                         $('#example').dataTable( {
22                                 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
23                                 "aoColumns": [
24                                         null,
25                                         { "bVisible": false },
26                                         null,
27                                         null,
28                                         null
29                                 ]
30                         } );
31                 },
32                 function () { return $('#example tbody tr:eq(0) td').length == 4; }
33         );
34         
35         oTest.fnWaitTest( 
36                 "Can hide one column and it removes thead th column from DOM",
37                 null,
38                 function () { return $('#example thead tr:eq(0) th').length == 4; }
39         );
40         
41         oTest.fnWaitTest( 
42                 "The correct thead column has been hidden",
43                 null,
44                 function () {
45                         var jqNodes = $('#example thead tr:eq(0) th');
46                         var bReturn = 
47                                 jqNodes[0].innerHTML == "Rendering engine" &&
48                                 jqNodes[1].innerHTML == "Platform(s)" &&
49                                 jqNodes[2].innerHTML == "Engine version" &&
50                                 jqNodes[3].innerHTML == "CSS grade";
51                         return bReturn;
52                 }
53         );
54         
55         oTest.fnWaitTest( 
56                 "The correct tbody column has been hidden",
57                 function () {
58                         oDispacher.click( $('#example thead th:eq(1)')[0], { 'shift': true } );
59                 },
60                 function () {
61                         var jqNodes = $('#example tbody tr:eq(0) td');
62                         var bReturn = 
63                                 jqNodes[0].innerHTML == "Gecko" &&
64                                 jqNodes[1].innerHTML == "Gnome" &&
65                                 jqNodes[2].innerHTML == "1.8" &&
66                                 jqNodes[3].innerHTML == "A";
67                         return bReturn;
68                 }
69         );
70         
71         
72         oTest.fnWaitTest( 
73                 "Can hide multiple columns and it removes td column from DOM",
74                 function () {
75                         oSession.fnRestore();
76                         $('#example').dataTable( {
77                                 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
78                                 "aoColumns": [
79                                         null,
80                                         { "bVisible": false },
81                                         { "bVisible": false },
82                                         null,
83                                         { "bVisible": false }
84                                 ]
85                         } );
86                 },
87                 function () { return $('#example tbody tr:eq(0) td').length == 2; }
88         );
89         
90         oTest.fnWaitTest( 
91                 "Multiple hide - removes thead th column from DOM",
92                 null,
93                 function () { return $('#example thead tr:eq(0) th').length == 2; }
94         );
95         
96         oTest.fnWaitTest( 
97                 "Multiple hide - the correct thead columns have been hidden",
98                 null,
99                 function () {
100                         var jqNodes = $('#example thead tr:eq(0) th');
101                         var bReturn = 
102                                 jqNodes[0].innerHTML == "Rendering engine" &&
103                                 jqNodes[1].innerHTML == "Engine version"
104                         return bReturn;
105                 }
106         );
107         
108         oTest.fnWaitTest( 
109                 "Multiple hide - the correct tbody columns have been hidden",
110                 function () {
111                         oDispacher.click( $('#example thead th:eq(1)')[0], { 'shift': true } );
112                 },
113                 function () {
114                         var jqNodes = $('#example tbody tr:eq(0) td');
115                         var bReturn = 
116                                 jqNodes[0].innerHTML == "Gecko" &&
117                                 jqNodes[1].innerHTML == "1"
118                         return bReturn;
119                 }
120         );
121         
122         
123         oTest.fnComplete();
124 } );