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