annotate DataTables-1.9.4/media/unit_testing/tests_onhold/6_delayed_rendering/aoColumns.bVisible.js @ 9:7300ed4c1481 draft default tip

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