/[projects]/misc/horsensspejder-web/jquery/DataTables-1.9.4/media/unit_testing/tests_onhold/1_dom/2746-stable-sort.js
ViewVC logotype

Contents of /misc/horsensspejder-web/jquery/DataTables-1.9.4/media/unit_testing/tests_onhold/1_dom/2746-stable-sort.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, 3 months ago) by torben
File MIME type: application/javascript
File size: 6214 byte(s)
initial import
1 // DATA_TEMPLATE: dom_data
2 oTest.fnStart( "2746 - Stable sorting" );
3
4 $(document).ready( function () {
5 $('#example').dataTable();
6
7 oTest.fnTest(
8 "Initial sort",
9 null,
10 function () {
11 var ret =
12 $('#example tbody tr:eq(0) td:eq(0)').html() == 'Gecko' &&
13 $('#example tbody tr:eq(1) td:eq(0)').html() == 'Gecko' &&
14 $('#example tbody tr:eq(0) td:eq(1)').html() == 'Firefox 1.0' &&
15 $('#example tbody tr:eq(1) td:eq(1)').html() == 'Firefox 1.5' &&
16 $('#example tbody tr:eq(2) td:eq(1)').html() == 'Firefox 2.0';
17 return ret;
18 }
19 );
20
21 oTest.fnTest(
22 "Reserve initial sort",
23 function () {
24 $('#example thead th:eq(0)').click();
25 },
26 function () {
27 var ret =
28 $('#example tbody tr:eq(0) td:eq(0)').html() == 'Webkit' &&
29 $('#example tbody tr:eq(1) td:eq(0)').html() == 'Webkit' &&
30 $('#example tbody tr:eq(0) td:eq(1)').html() == 'Safari 1.2' &&
31 $('#example tbody tr:eq(1) td:eq(1)').html() == 'Safari 1.3' &&
32 $('#example tbody tr:eq(2) td:eq(1)').html() == 'Safari 2.0';
33 return ret;
34 }
35 );
36
37 oTest.fnTest(
38 "Reserve to go back to initial sort sort",
39 function () {
40 $('#example thead th:eq(0)').click();
41 },
42 function () {
43 var ret =
44 $('#example tbody tr:eq(0) td:eq(0)').html() == 'Gecko' &&
45 $('#example tbody tr:eq(1) td:eq(0)').html() == 'Gecko' &&
46 $('#example tbody tr:eq(0) td:eq(1)').html() == 'Firefox 1.0' &&
47 $('#example tbody tr:eq(1) td:eq(1)').html() == 'Firefox 1.5' &&
48 $('#example tbody tr:eq(2) td:eq(1)').html() == 'Firefox 2.0';
49 return ret;
50 }
51 );
52
53 oTest.fnTest(
54 "Reserve initial sort again",
55 function () {
56 $('#example thead th:eq(0)').click();
57 },
58 function () {
59 var ret =
60 $('#example tbody tr:eq(0) td:eq(0)').html() == 'Webkit' &&
61 $('#example tbody tr:eq(1) td:eq(0)').html() == 'Webkit' &&
62 $('#example tbody tr:eq(0) td:eq(1)').html() == 'Safari 1.2' &&
63 $('#example tbody tr:eq(1) td:eq(1)').html() == 'Safari 1.3' &&
64 $('#example tbody tr:eq(2) td:eq(1)').html() == 'Safari 2.0';
65 return ret;
66 }
67 );
68
69 oTest.fnTest(
70 "And once more back to the initial sort",
71 function () {
72 $('#example thead th:eq(0)').click();
73 },
74 function () {
75 var ret =
76 $('#example tbody tr:eq(0) td:eq(0)').html() == 'Gecko' &&
77 $('#example tbody tr:eq(1) td:eq(0)').html() == 'Gecko' &&
78 $('#example tbody tr:eq(0) td:eq(1)').html() == 'Firefox 1.0' &&
79 $('#example tbody tr:eq(1) td:eq(1)').html() == 'Firefox 1.5' &&
80 $('#example tbody tr:eq(2) td:eq(1)').html() == 'Firefox 2.0';
81 return ret;
82 }
83 );
84
85 oTest.fnTest(
86 "Sort on second column",
87 function () {
88 $('#example thead th:eq(1)').click();
89 },
90 function () {
91 var ret =
92 $('#example tbody tr:eq(0) td:eq(0)').html() == 'Other browsers' &&
93 $('#example tbody tr:eq(1) td:eq(0)').html() == 'Trident' &&
94 $('#example tbody tr:eq(0) td:eq(1)').html() == 'All others' &&
95 $('#example tbody tr:eq(1) td:eq(1)').html() == 'AOL browser (AOL desktop)' &&
96 $('#example tbody tr:eq(2) td:eq(1)').html() == 'Camino 1.0';
97 return ret;
98 }
99 );
100
101 oTest.fnTest(
102 "Reserve sort on second column",
103 function () {
104 $('#example thead th:eq(1)').click();
105 },
106 function () {
107 var ret =
108 $('#example tbody tr:eq(0) td:eq(0)').html() == 'Gecko' &&
109 $('#example tbody tr:eq(1) td:eq(0)').html() == 'Webkit' &&
110 $('#example tbody tr:eq(0) td:eq(1)').html() == 'Seamonkey 1.1' &&
111 $('#example tbody tr:eq(1) td:eq(1)').html() == 'Safari 3.0' &&
112 $('#example tbody tr:eq(2) td:eq(1)').html() == 'Safari 2.0';
113 return ret;
114 }
115 );
116
117 oTest.fnTest(
118 "And back to asc sorting on second column",
119 function () {
120 $('#example thead th:eq(1)').click();
121 },
122 function () {
123 var ret =
124 $('#example tbody tr:eq(0) td:eq(0)').html() == 'Other browsers' &&
125 $('#example tbody tr:eq(1) td:eq(0)').html() == 'Trident' &&
126 $('#example tbody tr:eq(0) td:eq(1)').html() == 'All others' &&
127 $('#example tbody tr:eq(1) td:eq(1)').html() == 'AOL browser (AOL desktop)' &&
128 $('#example tbody tr:eq(2) td:eq(1)').html() == 'Camino 1.0';
129 return ret;
130 }
131 );
132
133 oTest.fnTest(
134 "Sort on third column, having now sorted on second",
135 function () {
136 $('#example thead th:eq(2)').click();
137 },
138 function () {
139 var ret =
140 $('#example tbody tr:eq(0) td:eq(0)').html() == 'Other browsers' &&
141 $('#example tbody tr:eq(1) td:eq(0)').html() == 'Misc' &&
142 $('#example tbody tr:eq(0) td:eq(1)').html() == 'All others' &&
143 $('#example tbody tr:eq(1) td:eq(1)').html() == 'Dillo 0.8' &&
144 $('#example tbody tr:eq(2) td:eq(1)').html() == 'NetFront 3.1';
145 return ret;
146 }
147 );
148
149 oTest.fnTest(
150 "Reserve sort on third column",
151 function () {
152 $('#example thead th:eq(2)').click();
153 },
154 function () {
155 var ret =
156 $('#example tbody tr:eq(0) td:eq(0)').html() == 'Misc' &&
157 $('#example tbody tr:eq(1) td:eq(0)').html() == 'Trident' &&
158 $('#example tbody tr:eq(0) td:eq(1)').html() == 'IE Mobile' &&
159 $('#example tbody tr:eq(1) td:eq(1)').html() == 'Internet Explorer 7' &&
160 $('#example tbody tr:eq(2) td:eq(1)').html() == 'AOL browser (AOL desktop)';
161 return ret;
162 }
163 );
164
165 oTest.fnTest(
166 "Return sorting on third column to asc",
167 function () {
168 $('#example thead th:eq(2)').click();
169 },
170 function () {
171 var ret =
172 $('#example tbody tr:eq(0) td:eq(0)').html() == 'Other browsers' &&
173 $('#example tbody tr:eq(1) td:eq(0)').html() == 'Misc' &&
174 $('#example tbody tr:eq(0) td:eq(1)').html() == 'All others' &&
175 $('#example tbody tr:eq(1) td:eq(1)').html() == 'Dillo 0.8' &&
176 $('#example tbody tr:eq(2) td:eq(1)').html() == 'NetFront 3.1';
177 return ret;
178 }
179 );
180
181 oTest.fnTest(
182 "Sort on first column having sorted on second then third columns",
183 function () {
184 $('#example thead th:eq(0)').click();
185 },
186 function () {
187 var ret =
188 $('#example tbody tr:eq(0) td:eq(0)').html() == 'Gecko' &&
189 $('#example tbody tr:eq(1) td:eq(0)').html() == 'Gecko' &&
190 $('#example tbody tr:eq(0) td:eq(1)').html() == 'Epiphany 2.20' &&
191 $('#example tbody tr:eq(1) td:eq(1)').html() == 'Camino 1.0' &&
192 $('#example tbody tr:eq(2) td:eq(1)').html() == 'Camino 1.5';
193 return ret;
194 }
195 );
196
197
198 oTest.fnComplete();
199 } );

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.20