/[projects]/misc/horsensspejder-web/jquery/DataTables-1.9.4/media/unit_testing/tests_onhold/3_ajax/aaSorting.js
ViewVC logotype

Contents of /misc/horsensspejder-web/jquery/DataTables-1.9.4/media/unit_testing/tests_onhold/3_ajax/aaSorting.js

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2125 - (show annotations) (download) (as text)
Wed Mar 12 19:30:05 2014 UTC (10 years, 2 months ago) by torben
File MIME type: application/javascript
File size: 5407 byte(s)
initial import
1 // DATA_TEMPLATE: empty_table
2 oTest.fnStart( "aaSorting" );
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 "Default sorting is single column",
13 null,
14 function () {
15 return oSettings.aaSorting.length == 1 && typeof oSettings.aaSorting[0] == 'object';
16 }
17 );
18
19 oTest.fnWaitTest(
20 "Default sorting is first column asc",
21 null,
22 function () {
23 return oSettings.aaSorting[0].length == 3 && oSettings.aaSorting[0][0] == 0 &&
24 oSettings.aaSorting[0][1] == 'asc';
25 }
26 );
27
28 oTest.fnWaitTest(
29 "Sorting is applied",
30 null,
31 function () { return $('#example tbody td:eq(0)').html() == "Gecko"; }
32 );
33
34
35 oTest.fnWaitTest(
36 "Custom sorting on single string column asc",
37 function () {
38 oSession.fnRestore();
39 $('#example').dataTable( {
40 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
41 "aaSorting": [['1','asc']]
42 } );
43 },
44 function () { return $('#example tbody td:eq(1)').html() == "All others"; }
45 );
46
47
48 oTest.fnWaitTest(
49 "Custom sorting on single string column desc",
50 function () {
51 oSession.fnRestore();
52 $('#example').dataTable( {
53 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
54 "aaSorting": [['1','desc']]
55 } );
56 },
57 function () { return $('#example tbody td:eq(1)').html() == "Seamonkey 1.1"; }
58 );
59
60
61 oTest.fnWaitTest(
62 "Custom sorting on single int column asc",
63 function () {
64 oSession.fnRestore();
65 $('#example').dataTable( {
66 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
67 "aaSorting": [['1','asc']]
68 } );
69 },
70 function () { return $('#example tbody td:eq(3)').html() == "-"; }
71 );
72
73
74 oTest.fnWaitTest(
75 "Custom sorting on single int column desc",
76 function () {
77 oSession.fnRestore();
78 $('#example').dataTable( {
79 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
80 "aaSorting": [['1','desc']]
81 } );
82 },
83 function () { return $('#example tbody td:eq(1)').html() == "Seamonkey 1.1"; }
84 );
85
86
87 oTest.fnWaitTest(
88 "Multi-column sorting (2 column) - string asc / string asc",
89 function () {
90 oSession.fnRestore();
91 $('#example').dataTable( {
92 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
93 "aaSorting": [['0','asc'], ['1','asc']]
94 } );
95 },
96 function () { return $('#example tbody td:eq(1)').html() == "Camino 1.0"; }
97 );
98
99 oTest.fnWaitTest(
100 "Multi-column sorting (2 column) - string asc / string desc",
101 function () {
102 oSession.fnRestore();
103 $('#example').dataTable( {
104 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
105 "aaSorting": [['0','asc'], ['1','desc']]
106 } );
107 },
108 function () { return $('#example tbody td:eq(1)').html() == "Seamonkey 1.1"; }
109 );
110
111 oTest.fnWaitTest(
112 "Multi-column sorting (2 column) - string desc / string asc",
113 function () {
114 oSession.fnRestore();
115 $('#example').dataTable( {
116 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
117 "aaSorting": [['0','desc'], ['1','asc']]
118 } );
119 },
120 function () { return $('#example tbody td:eq(1)').html() == "iPod Touch / iPhone"; }
121 );
122
123 oTest.fnWaitTest(
124 "Multi-column sorting (2 column) - string desc / string desc",
125 function () {
126 oSession.fnRestore();
127 $('#example').dataTable( {
128 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
129 "aaSorting": [['0','desc'], ['1','desc']]
130 } );
131 },
132 function () { return $('#example tbody td:eq(1)').html() == "Safari 3.0"; }
133 );
134
135
136 oTest.fnWaitTest(
137 "Multi-column sorting (2 column) - string asc / int asc",
138 function () {
139 oSession.fnRestore();
140 $('#example').dataTable( {
141 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
142 "aaSorting": [['0','asc'], ['3','asc']]
143 } );
144 },
145 function () { return $('#example tbody td:eq(3)').html() == "1"; }
146 );
147
148 oTest.fnWaitTest(
149 "Multi-column sorting (2 column) - string asc / int desc",
150 function () {
151 oSession.fnRestore();
152 $('#example').dataTable( {
153 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
154 "aaSorting": [['0','asc'], ['3','desc']]
155 } );
156 },
157 function () { return $('#example tbody td:eq(3)').html() == "1.9"; }
158 );
159
160 oTest.fnWaitTest(
161 "Multi-column sorting (2 column) - string desc / int asc",
162 function () {
163 oSession.fnRestore();
164 $('#example').dataTable( {
165 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
166 "aaSorting": [['0','desc'], ['3','asc']]
167 } );
168 },
169 function () { return $('#example tbody td:eq(3)').html() == "125.5"; }
170 );
171
172 oTest.fnWaitTest(
173 "Multi-column sorting (2 column) - string desc / int desc",
174 function () {
175 oSession.fnRestore();
176 $('#example').dataTable( {
177 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
178 "aaSorting": [['0','desc'], ['3','desc']]
179 } );
180 },
181 function () { return $('#example tbody td:eq(3)').html() == "522.1"; }
182 );
183
184 oTest.fnWaitTest(
185 "Multi-column sorting (3 column) - string asc / int asc / string asc",
186 function () {
187 oSession.fnRestore();
188 $('#example').dataTable( {
189 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
190 "aaSorting": [['0','asc'], ['3','asc'], ['1','asc']]
191 } );
192 },
193 function () { return $('#example tbody tr:eq(7) td:eq(1)').html() == "Firefox 1.0"; }
194 );
195
196
197 oTest.fnComplete();
198 } );

  ViewVC Help
Powered by ViewVC 1.1.20