1 |
// DATA_TEMPLATE: empty_table |
2 |
oTest.fnStart( "bSort" ); |
3 |
|
4 |
$(document).ready( function () { |
5 |
/* Check the default */ |
6 |
$('#example').dataTable( { |
7 |
"bServerSide": true, |
8 |
"sAjaxSource": "../../../examples/server_side/scripts/server_processing.php" |
9 |
} ); |
10 |
|
11 |
oTest.fnWaitTest( |
12 |
"Sorting is on by default", |
13 |
null, |
14 |
function () { return $('#example tbody td:eq(1)').html() == "Firefox 1.0"; } |
15 |
); |
16 |
|
17 |
oTest.fnWaitTest( |
18 |
"Sorting Asc by default class applied", |
19 |
null, |
20 |
function () { return $('#example thead th:eq(0)').hasClass("sorting_asc"); } |
21 |
); |
22 |
|
23 |
oTest.fnWaitTest( |
24 |
"Click on second column", |
25 |
function () { $('#example thead th:eq(1)').click(); }, |
26 |
function () { return $('#example tbody td:eq(1)').html() == "All others"; } |
27 |
); |
28 |
|
29 |
oTest.fnWaitTest( |
30 |
"Sorting class removed from first column", |
31 |
null, |
32 |
function () { return $('#example thead th:eq(0)').hasClass("sorting_asc") != true; } |
33 |
); |
34 |
|
35 |
oTest.fnWaitTest( |
36 |
"Sorting asc class applied to second column", |
37 |
null, |
38 |
function () { return $('#example thead th:eq(1)').hasClass("sorting_asc"); } |
39 |
); |
40 |
|
41 |
oTest.fnWaitTest( |
42 |
"Reverse on second column", |
43 |
function () { $('#example thead th:eq(1)').click(); }, |
44 |
function () { return $('#example tbody td:eq(1)').html() == "Seamonkey 1.1"; } |
45 |
); |
46 |
|
47 |
oTest.fnWaitTest( |
48 |
"Sorting acs class removed from second column", |
49 |
null, |
50 |
function () { return $('#example thead th:eq(1)').hasClass("sorting_asc") != true; } |
51 |
); |
52 |
|
53 |
oTest.fnWaitTest( |
54 |
"Sorting desc class applied to second column", |
55 |
null, |
56 |
function () { return $('#example thead th:eq(1)').hasClass("sorting_desc"); } |
57 |
); |
58 |
|
59 |
/* Check can disable */ |
60 |
oTest.fnWaitTest( |
61 |
"Pagiantion can be disabled", |
62 |
function () { |
63 |
oSession.fnRestore(); |
64 |
$('#example').dataTable( { |
65 |
"bServerSide": true, |
66 |
"sAjaxSource": "../../../examples/server_side/scripts/server_processing.php", |
67 |
"bSort": false |
68 |
} ); |
69 |
}, |
70 |
function () { return $('#example tbody td:eq(3)').html() == "4"; } |
71 |
); |
72 |
|
73 |
oTest.fnWaitTest( |
74 |
"Click on second column has no effect", |
75 |
function () { $('#example thead th:eq(1)').click(); }, |
76 |
function () { return $('#example tbody td:eq(3)').html() == "4"; } |
77 |
); |
78 |
|
79 |
oTest.fnWaitTest( |
80 |
"Reverse on second column has no effect", |
81 |
function () { $('#example thead th:eq(1)').click(); }, |
82 |
function () { return $('#example tbody td:eq(3)').html() == "4"; } |
83 |
); |
84 |
|
85 |
/* Enable makes no difference */ |
86 |
oTest.fnWaitTest( |
87 |
"Sorting enabled override", |
88 |
function () { |
89 |
oSession.fnRestore(); |
90 |
$('#example').dataTable( { |
91 |
"bServerSide": true, |
92 |
"sAjaxSource": "../../../examples/server_side/scripts/server_processing.php", |
93 |
"bSort": true |
94 |
} ); |
95 |
}, |
96 |
function () { return $('#example tbody td:eq(1)').html() == "Firefox 1.0"; } |
97 |
); |
98 |
|
99 |
|
100 |
|
101 |
oTest.fnComplete(); |
102 |
} ); |