annotate DataTables-1.9.4/media/unit_testing/tests_onhold/6_delayed_rendering/bSort.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( "bSort" );
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 $('#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
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
11 oTest.fnWaitTest(
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
12 "Sorting is on by default",
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
13 null,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
14 function () { return $('#example tbody td:eq(0)').html() == "Gecko"; }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
15 );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
16
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
17 oTest.fnWaitTest(
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
18 "Sorting Asc by default class applied",
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
19 null,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
20 function () { return $('#example thead th:eq(0)').hasClass("sorting_asc"); }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
21 );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
22
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
23 oTest.fnWaitTest(
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
24 "Click on second column",
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
25 function () { $('#example thead th:eq(1)').click(); },
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
26 function () { return $('#example tbody td:eq(1)').html() == "All others"; }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
27 );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
28
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
29 oTest.fnWaitTest(
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
30 "Sorting class removed from first column",
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
31 null,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
32 function () { return $('#example thead th:eq(0)').hasClass("sorting_asc") != true; }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
33 );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
34
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
35 oTest.fnWaitTest(
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
36 "Sorting asc class applied to second column",
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
37 null,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
38 function () { return $('#example thead th:eq(1)').hasClass("sorting_asc"); }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
39 );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
40
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
41 oTest.fnWaitTest(
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
42 "Reverse on second column",
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
43 function () { $('#example thead th:eq(1)').click(); },
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
44 function () { return $('#example tbody td:eq(1)').html() == "Seamonkey 1.1"; }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
45 );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
46
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
47 oTest.fnWaitTest(
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
48 "Sorting acs class removed from second column",
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
49 null,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
50 function () { return $('#example thead th:eq(1)').hasClass("sorting_asc") != true; }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
51 );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
52
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
53 oTest.fnWaitTest(
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
54 "Sorting desc class applied to second column",
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
55 null,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
56 function () { return $('#example thead th:eq(1)').hasClass("sorting_desc"); }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
57 );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
58
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
59 /* Check can disable */
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
60 oTest.fnWaitTest(
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
61 "Pagiantion can be disabled",
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
62 function () {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
63 oSession.fnRestore();
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
64 $('#example').dataTable( {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
65 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
66 "bDeferRender": true,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
67 "bSort": false
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
68 } );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
69 },
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
70 function () { return $('#example tbody td:eq(3)').html() == "4"; }
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 oTest.fnWaitTest(
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
74 "Click on second column has no effect",
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
75 function () { $('#example thead th:eq(1)').click(); },
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
76 function () { return $('#example tbody td:eq(3)').html() == "4"; }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
77 );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
78
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
79 oTest.fnWaitTest(
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
80 "Reverse on second column has no effect",
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
81 function () { $('#example thead th:eq(1)').click(); },
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
82 function () { return $('#example tbody td:eq(3)').html() == "4"; }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
83 );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
84
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
85 /* Enable makes no difference */
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
86 oTest.fnWaitTest(
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
87 "Sorting enabled override",
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
88 function () {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
89 oSession.fnRestore();
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
90 $('#example').dataTable( {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
91 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
92 "bDeferRender": true,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
93 "bSort": true
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
94 } );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
95 },
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
96 function () { return $('#example tbody td:eq(0)').html() == "Gecko"; }
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
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
100
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
101 oTest.fnComplete();
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
102 } );