1 |
// DATA_TEMPLATE: empty_table |
2 |
oTest.fnStart( "aoColumns.sClass" ); |
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 |
"By default the test class hasn't been applied to the column (sanity!)", |
13 |
null, |
14 |
function () { return $('#example tbody tr:eq(0) td:eq(2)').hasClass('unittest') == false; } |
15 |
); |
16 |
|
17 |
oTest.fnWaitTest( |
18 |
"Add a class to a single column - first row", |
19 |
function () { |
20 |
oSession.fnRestore(); |
21 |
$('#example').dataTable( { |
22 |
"sAjaxSource": "../../../examples/ajax/sources/arrays.txt", |
23 |
"aoColumns": [ |
24 |
null, |
25 |
null, |
26 |
{ "sClass": 'unittest' }, |
27 |
null, |
28 |
null |
29 |
] |
30 |
} ); |
31 |
}, |
32 |
function () { return $('#example tbody tr:eq(1) td:eq(2)').hasClass('unittest'); } |
33 |
); |
34 |
|
35 |
oTest.fnWaitTest( |
36 |
"Add a class to a single column - third row", |
37 |
null, |
38 |
function () { return $('#example tbody tr:eq(3) td:eq(2)').hasClass('unittest'); } |
39 |
); |
40 |
|
41 |
oTest.fnWaitTest( |
42 |
"Add a class to a single column - last row", |
43 |
null, |
44 |
function () { return $('#example tbody tr:eq(9) td:eq(2)').hasClass('unittest'); } |
45 |
); |
46 |
|
47 |
oTest.fnWaitTest( |
48 |
"Add a class to a single column - has not applied to other columns - 1st", |
49 |
null, |
50 |
function () { return $('#example tbody tr:eq(3) td:eq(0)').hasClass('unittest') == false; } |
51 |
); |
52 |
|
53 |
oTest.fnWaitTest( |
54 |
"Add a class to a single column - has not applied to other columns - 5th", |
55 |
null, |
56 |
function () { return $('#example tbody tr:eq(3) td:eq(4)').hasClass('unittest') == false; } |
57 |
); |
58 |
|
59 |
oTest.fnWaitTest( |
60 |
"Add a class to a single column - seventh row - second page", |
61 |
function () { $('#example_next').click(); }, |
62 |
function () { return $('#example tbody tr:eq(6) td:eq(2)').hasClass('unittest'); } |
63 |
); |
64 |
|
65 |
oTest.fnWaitTest( |
66 |
"Add a class to a single column - has not applied to header", |
67 |
null, |
68 |
function () { return $('#example thead tr:eq(3) th:eq(4)').hasClass('unittest') == false; } |
69 |
); |
70 |
|
71 |
oTest.fnWaitTest( |
72 |
"Add a class to a single column - has not applied to footer", |
73 |
null, |
74 |
function () { return $('#example thead tr:eq(3) th:eq(4)').hasClass('unittest') == false; } |
75 |
); |
76 |
|
77 |
|
78 |
oTest.fnWaitTest( |
79 |
"Class defined for multiple columns - first row", |
80 |
function () { |
81 |
oSession.fnRestore(); |
82 |
$('#example').dataTable( { |
83 |
"sAjaxSource": "../../../examples/ajax/sources/arrays.txt", |
84 |
"aoColumns": [ |
85 |
{ "sClass": 'unittest2' }, |
86 |
null, |
87 |
null, |
88 |
{ "sClass": 'unittest1' }, |
89 |
null |
90 |
] |
91 |
} ); |
92 |
}, |
93 |
function () { |
94 |
var bReturn = |
95 |
$('#example tbody tr:eq(3) td:eq(0)').hasClass('unittest2') && |
96 |
$('#example tbody tr:eq(8) td:eq(3)').hasClass('unittest1'); |
97 |
return bReturn; |
98 |
} |
99 |
); |
100 |
|
101 |
oTest.fnWaitTest( |
102 |
"Class defined for multiple columns - has not applied to other columns - 5th 1", |
103 |
null, |
104 |
function () { return $('#example tbody tr:eq(0) td:eq(4)').hasClass('unittest1') == false; } |
105 |
); |
106 |
|
107 |
oTest.fnWaitTest( |
108 |
"Class defined for multiple columns - has not applied to other columns - 5th 2", |
109 |
null, |
110 |
function () { return $('#example tbody tr:eq(6) td:eq(4)').hasClass('unittest2') == false; } |
111 |
); |
112 |
|
113 |
|
114 |
oTest.fnComplete(); |
115 |
} ); |