annotate DataTables-1.9.4/media/unit_testing/tests_onhold/6_delayed_rendering/aoColumns.iDataSort.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.iDataSort" );
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 /* Should know that sorting already works by default from other tests, so we can jump
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
6 * right in here
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
7 */
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
8 var oTable = $('#example').dataTable( {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
9 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
10 "bDeferRender": true,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
11 "aoColumns": [
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
12 null,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
13 { "iDataSort": 4 },
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
14 null,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
15 null,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
16 null
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
17 ]
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
18 } );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
19 var oSettings = oTable.fnSettings();
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
20
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
21 oTest.fnWaitTest(
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
22 "Sorting on first column is uneffected",
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
23 null,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
24 function () { return $('#example tbody tr:eq(0) td:eq(0)').html() == 'Gecko'; }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
25 );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
26
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
27 oTest.fnWaitTest(
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
28 "Sorting on second column is the order of the fifth",
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
29 function () { $('#example thead th:eq(1)').click(); },
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
30 function () { return $('#example tbody tr:eq(0) td:eq(4)').html() == 'A'; }
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 oTest.fnWaitTest(
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
34 "Reserve sorting on second column uses fifth column as well",
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
35 function () { $('#example thead th:eq(1)').click(); },
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
36 function () { return $('#example tbody tr:eq(0) td:eq(4)').html() == 'X'; }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
37 );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
38
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
39 oTest.fnWaitTest(
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
40 "Sorting on 5th column retains it's own sorting",
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
41 function () { $('#example thead th:eq(4)').click(); },
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
42 function () { return $('#example tbody tr:eq(0) td:eq(4)').html() == 'A'; }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
43 );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
44
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
45
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
46 oTest.fnWaitTest(
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
47 "Use 2nd col for sorting 5th col and via-versa - no effect on first col sorting",
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
48 function () {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
49 mTmp = 0;
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
50 oSession.fnRestore();
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
51 oTable = $('#example').dataTable( {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
52 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
53 "bDeferRender": true,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
54 "aoColumns": [
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
55 null,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
56 { "iDataSort": 4 },
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
57 null,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
58 null,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
59 { "iDataSort": 1 }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
60 ]
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
61 } );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
62 },
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
63 function () { return $('#example tbody tr:eq(0) td:eq(0)').html() == 'Gecko'; }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
64 );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
65
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
66 oTest.fnWaitTest(
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
67 "2nd col sorting uses fifth col",
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
68 function () { $('#example thead th:eq(1)').click(); },
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
69 function () { return $('#example tbody tr:eq(0) td:eq(4)').html() == 'A'; }
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 oTest.fnWaitTest(
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
73 "2nd col sorting uses fifth col - reversed",
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
74 function () { $('#example thead th:eq(1)').click(); },
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
75 function () { return $('#example tbody tr:eq(0) td:eq(4)').html() == 'X'; }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
76 );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
77
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
78 oTest.fnWaitTest(
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
79 "5th col sorting uses 2nd col",
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
80 function () { $('#example thead th:eq(4)').click(); },
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
81 function () { return $('#example tbody tr:eq(0) td:eq(1)').html() == 'All others'; }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
82 );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
83
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
84 oTest.fnWaitTest(
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
85 "5th col sorting uses 2nd col - reversed",
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
86 function () { $('#example thead th:eq(4)').click(); },
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
87 function () { return $('#example tbody tr:eq(0) td:eq(1)').html() == 'Seamonkey 1.1'; }
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
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
91 oTest.fnComplete();
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
92 } );