1 |
// DATA_TEMPLATE: empty_table |
2 |
oTest.fnStart( "Sanity checks for DataTables with data from JS - Array / sub-object data source" ); |
3 |
|
4 |
oTest.fnTest( |
5 |
"jQuery.dataTable function", |
6 |
null, |
7 |
function () { return typeof jQuery().dataTable == "function"; } |
8 |
); |
9 |
|
10 |
oTest.fnTest( |
11 |
"jQuery.dataTableSettings storage array", |
12 |
null, |
13 |
function () { return typeof jQuery().dataTableSettings == "object"; } |
14 |
); |
15 |
|
16 |
oTest.fnTest( |
17 |
"jQuery.dataTableExt plugin object", |
18 |
null, |
19 |
function () { return typeof jQuery().dataTableExt == "object"; } |
20 |
); |
21 |
|
22 |
$(document).ready( function () { |
23 |
var oInit = { |
24 |
"aoColumns": [ |
25 |
null, |
26 |
null, |
27 |
{ "mData": 2 }, |
28 |
{ "mData": "3.version" }, |
29 |
{ "mData": "3.grade" } |
30 |
], |
31 |
"aaData": [ |
32 |
[ |
33 |
"Trident", |
34 |
"Internet Explorer 4.0", |
35 |
"Win 95+", |
36 |
{ |
37 |
"version": "4", |
38 |
"grade": "X" |
39 |
} |
40 |
], |
41 |
[ |
42 |
"Trident", |
43 |
"Internet Explorer 5.0", |
44 |
"Win 95+", |
45 |
{ |
46 |
"version": "5", |
47 |
"grade": "C" |
48 |
} |
49 |
], |
50 |
[ |
51 |
"Trident", |
52 |
"Internet Explorer 5.5", |
53 |
"Win 95+", |
54 |
{ |
55 |
"version": "5.5", |
56 |
"grade": "A" |
57 |
} |
58 |
], |
59 |
[ |
60 |
"Trident", |
61 |
"Internet Explorer 6", |
62 |
"Win 98+", |
63 |
{ |
64 |
"version": "6", |
65 |
"grade": "A" |
66 |
} |
67 |
], |
68 |
[ |
69 |
"Trident", |
70 |
"Internet Explorer 7", |
71 |
"Win XP SP2+", |
72 |
{ |
73 |
"version": "7", |
74 |
"grade": "A" |
75 |
} |
76 |
], |
77 |
[ |
78 |
"Trident", |
79 |
"AOL browser (AOL desktop)", |
80 |
"Win XP", |
81 |
{ |
82 |
"version": "6", |
83 |
"grade": "A" |
84 |
} |
85 |
], |
86 |
[ |
87 |
"Gecko", |
88 |
"Firefox 1.0", |
89 |
"Win 98+ / OSX.2+", |
90 |
{ |
91 |
"version": "1.7", |
92 |
"grade": "A" |
93 |
} |
94 |
], |
95 |
[ |
96 |
"Gecko", |
97 |
"Firefox 1.5", |
98 |
"Win 98+ / OSX.2+", |
99 |
{ |
100 |
"version": "1.8", |
101 |
"grade": "A" |
102 |
} |
103 |
], |
104 |
[ |
105 |
"Gecko", |
106 |
"Firefox 2.0", |
107 |
"Win 98+ / OSX.2+", |
108 |
{ |
109 |
"version": "1.8", |
110 |
"grade": "A" |
111 |
} |
112 |
], |
113 |
[ |
114 |
"Gecko", |
115 |
"Firefox 3.0", |
116 |
"Win 2k+ / OSX.3+", |
117 |
{ |
118 |
"version": "1.9", |
119 |
"grade": "A" |
120 |
} |
121 |
], |
122 |
[ |
123 |
"Gecko", |
124 |
"Camino 1.0", |
125 |
"OSX.2+", |
126 |
{ |
127 |
"version": "1.8", |
128 |
"grade": "A" |
129 |
} |
130 |
], |
131 |
[ |
132 |
"Gecko", |
133 |
"Camino 1.5", |
134 |
"OSX.3+", |
135 |
{ |
136 |
"version": "1.8", |
137 |
"grade": "A" |
138 |
} |
139 |
], |
140 |
[ |
141 |
"Gecko", |
142 |
"Netscape 7.2", |
143 |
"Win 95+ / Mac OS 8.6-9.2", |
144 |
{ |
145 |
"version": "1.7", |
146 |
"grade": "A" |
147 |
} |
148 |
], |
149 |
[ |
150 |
"Gecko", |
151 |
"Netscape Browser 8", |
152 |
"Win 98SE+", |
153 |
{ |
154 |
"version": "1.7", |
155 |
"grade": "A" |
156 |
} |
157 |
], |
158 |
[ |
159 |
"Gecko", |
160 |
"Netscape Navigator 9", |
161 |
"Win 98+ / OSX.2+", |
162 |
{ |
163 |
"version": "1.8", |
164 |
"grade": "A" |
165 |
} |
166 |
], |
167 |
[ |
168 |
"Gecko", |
169 |
"Mozilla 1.0", |
170 |
"Win 95+ / OSX.1+", |
171 |
{ |
172 |
"version": "1", |
173 |
"grade": "A" |
174 |
} |
175 |
], |
176 |
[ |
177 |
"Gecko", |
178 |
"Mozilla 1.1", |
179 |
"Win 95+ / OSX.1+", |
180 |
{ |
181 |
"version": "1.1", |
182 |
"grade": "A" |
183 |
} |
184 |
], |
185 |
[ |
186 |
"Gecko", |
187 |
"Mozilla 1.2", |
188 |
"Win 95+ / OSX.1+", |
189 |
{ |
190 |
"version": "1.2", |
191 |
"grade": "A" |
192 |
} |
193 |
], |
194 |
[ |
195 |
"Gecko", |
196 |
"Mozilla 1.3", |
197 |
"Win 95+ / OSX.1+", |
198 |
{ |
199 |
"version": "1.3", |
200 |
"grade": "A" |
201 |
} |
202 |
], |
203 |
[ |
204 |
"Gecko", |
205 |
"Mozilla 1.4", |
206 |
"Win 95+ / OSX.1+", |
207 |
{ |
208 |
"version": "1.4", |
209 |
"grade": "A" |
210 |
} |
211 |
], |
212 |
[ |
213 |
"Gecko", |
214 |
"Mozilla 1.5", |
215 |
"Win 95+ / OSX.1+", |
216 |
{ |
217 |
"version": "1.5", |
218 |
"grade": "A" |
219 |
} |
220 |
], |
221 |
[ |
222 |
"Gecko", |
223 |
"Mozilla 1.6", |
224 |
"Win 95+ / OSX.1+", |
225 |
{ |
226 |
"version": "1.6", |
227 |
"grade": "A" |
228 |
} |
229 |
], |
230 |
[ |
231 |
"Gecko", |
232 |
"Mozilla 1.7", |
233 |
"Win 98+ / OSX.1+", |
234 |
{ |
235 |
"version": "1.7", |
236 |
"grade": "A" |
237 |
} |
238 |
], |
239 |
[ |
240 |
"Gecko", |
241 |
"Mozilla 1.8", |
242 |
"Win 98+ / OSX.1+", |
243 |
{ |
244 |
"version": "1.8", |
245 |
"grade": "A" |
246 |
} |
247 |
], |
248 |
[ |
249 |
"Gecko", |
250 |
"Seamonkey 1.1", |
251 |
"Win 98+ / OSX.2+", |
252 |
{ |
253 |
"version": "1.8", |
254 |
"grade": "A" |
255 |
} |
256 |
], |
257 |
[ |
258 |
"Gecko", |
259 |
"Epiphany 2.20", |
260 |
"Gnome", |
261 |
{ |
262 |
"version": "1.8", |
263 |
"grade": "A" |
264 |
} |
265 |
], |
266 |
[ |
267 |
"Webkit", |
268 |
"Safari 1.2", |
269 |
"OSX.3", |
270 |
{ |
271 |
"version": "125.5", |
272 |
"grade": "A" |
273 |
} |
274 |
], |
275 |
[ |
276 |
"Webkit", |
277 |
"Safari 1.3", |
278 |
"OSX.3", |
279 |
{ |
280 |
"version": "312.8", |
281 |
"grade": "A" |
282 |
} |
283 |
], |
284 |
[ |
285 |
"Webkit", |
286 |
"Safari 2.0", |
287 |
"OSX.4+", |
288 |
{ |
289 |
"version": "419.3", |
290 |
"grade": "A" |
291 |
} |
292 |
], |
293 |
[ |
294 |
"Webkit", |
295 |
"Safari 3.0", |
296 |
"OSX.4+", |
297 |
{ |
298 |
"version": "522.1", |
299 |
"grade": "A" |
300 |
} |
301 |
], |
302 |
[ |
303 |
"Webkit", |
304 |
"OmniWeb 5.5", |
305 |
"OSX.4+", |
306 |
{ |
307 |
"version": "420", |
308 |
"grade": "A" |
309 |
} |
310 |
], |
311 |
[ |
312 |
"Webkit", |
313 |
"iPod Touch / iPhone", |
314 |
"iPod", |
315 |
{ |
316 |
"version": "420.1", |
317 |
"grade": "A" |
318 |
} |
319 |
], |
320 |
[ |
321 |
"Webkit", |
322 |
"S60", |
323 |
"S60", |
324 |
{ |
325 |
"version": "413", |
326 |
"grade": "A" |
327 |
} |
328 |
], |
329 |
[ |
330 |
"Presto", |
331 |
"Opera 7.0", |
332 |
"Win 95+ / OSX.1+", |
333 |
{ |
334 |
"version": "-", |
335 |
"grade": "A" |
336 |
} |
337 |
], |
338 |
[ |
339 |
"Presto", |
340 |
"Opera 7.5", |
341 |
"Win 95+ / OSX.2+", |
342 |
{ |
343 |
"version": "-", |
344 |
"grade": "A" |
345 |
} |
346 |
], |
347 |
[ |
348 |
"Presto", |
349 |
"Opera 8.0", |
350 |
"Win 95+ / OSX.2+", |
351 |
{ |
352 |
"version": "-", |
353 |
"grade": "A" |
354 |
} |
355 |
], |
356 |
[ |
357 |
"Presto", |
358 |
"Opera 8.5", |
359 |
"Win 95+ / OSX.2+", |
360 |
{ |
361 |
"version": "-", |
362 |
"grade": "A" |
363 |
} |
364 |
], |
365 |
[ |
366 |
"Presto", |
367 |
"Opera 9.0", |
368 |
"Win 95+ / OSX.3+", |
369 |
{ |
370 |
"version": "-", |
371 |
"grade": "A" |
372 |
} |
373 |
], |
374 |
[ |
375 |
"Presto", |
376 |
"Opera 9.2", |
377 |
"Win 88+ / OSX.3+", |
378 |
{ |
379 |
"version": "-", |
380 |
"grade": "A" |
381 |
} |
382 |
], |
383 |
[ |
384 |
"Presto", |
385 |
"Opera 9.5", |
386 |
"Win 88+ / OSX.3+", |
387 |
{ |
388 |
"version": "-", |
389 |
"grade": "A" |
390 |
} |
391 |
], |
392 |
[ |
393 |
"Presto", |
394 |
"Opera for Wii", |
395 |
"Wii", |
396 |
{ |
397 |
"version": "-", |
398 |
"grade": "A" |
399 |
} |
400 |
], |
401 |
[ |
402 |
"Presto", |
403 |
"Nokia N800", |
404 |
"N800", |
405 |
{ |
406 |
"version": "-", |
407 |
"grade": "A" |
408 |
} |
409 |
], |
410 |
[ |
411 |
"Presto", |
412 |
"Nintendo DS browser", |
413 |
"Nintendo DS", |
414 |
{ |
415 |
"version": "8.5", |
416 |
"grade": "C/A<sup>1</sup>" |
417 |
} |
418 |
], |
419 |
[ |
420 |
"KHTML", |
421 |
"Konqureror 3.1", |
422 |
"KDE 3.1", |
423 |
{ |
424 |
"version": "3.1", |
425 |
"grade": "C" |
426 |
} |
427 |
], |
428 |
[ |
429 |
"KHTML", |
430 |
"Konqureror 3.3", |
431 |
"KDE 3.3", |
432 |
{ |
433 |
"version": "3.3", |
434 |
"grade": "A" |
435 |
} |
436 |
], |
437 |
[ |
438 |
"KHTML", |
439 |
"Konqureror 3.5", |
440 |
"KDE 3.5", |
441 |
{ |
442 |
"version": "3.5", |
443 |
"grade": "A" |
444 |
} |
445 |
], |
446 |
[ |
447 |
"Tasman", |
448 |
"Internet Explorer 4.5", |
449 |
"Mac OS 8-9", |
450 |
{ |
451 |
"version": "-", |
452 |
"grade": "X" |
453 |
} |
454 |
], |
455 |
[ |
456 |
"Tasman", |
457 |
"Internet Explorer 5.1", |
458 |
"Mac OS 7.6-9", |
459 |
{ |
460 |
"version": "1", |
461 |
"grade": "C" |
462 |
} |
463 |
], |
464 |
[ |
465 |
"Tasman", |
466 |
"Internet Explorer 5.2", |
467 |
"Mac OS 8-X", |
468 |
{ |
469 |
"version": "1", |
470 |
"grade": "C" |
471 |
} |
472 |
], |
473 |
[ |
474 |
"Misc", |
475 |
"NetFront 3.1", |
476 |
"Embedded devices", |
477 |
{ |
478 |
"version": "-", |
479 |
"grade": "C" |
480 |
} |
481 |
], |
482 |
[ |
483 |
"Misc", |
484 |
"NetFront 3.4", |
485 |
"Embedded devices", |
486 |
{ |
487 |
"version": "-", |
488 |
"grade": "A" |
489 |
} |
490 |
], |
491 |
[ |
492 |
"Misc", |
493 |
"Dillo 0.8", |
494 |
"Embedded devices", |
495 |
{ |
496 |
"version": "-", |
497 |
"grade": "X" |
498 |
} |
499 |
], |
500 |
[ |
501 |
"Misc", |
502 |
"Links", |
503 |
"Text only", |
504 |
{ |
505 |
"version": "-", |
506 |
"grade": "X" |
507 |
} |
508 |
], |
509 |
[ |
510 |
"Misc", |
511 |
"Lynx", |
512 |
"Text only", |
513 |
{ |
514 |
"version": "-", |
515 |
"grade": "X" |
516 |
} |
517 |
], |
518 |
[ |
519 |
"Misc", |
520 |
"IE Mobile", |
521 |
"Windows Mobile 6", |
522 |
{ |
523 |
"version": "-", |
524 |
"grade": "C" |
525 |
} |
526 |
], |
527 |
[ |
528 |
"Misc", |
529 |
"PSP browser", |
530 |
"PSP", |
531 |
{ |
532 |
"version": "-", |
533 |
"grade": "C" |
534 |
} |
535 |
], |
536 |
[ |
537 |
"Other browsers", |
538 |
"All others", |
539 |
"-", |
540 |
{ |
541 |
"version": "-", |
542 |
"grade": "U" |
543 |
} |
544 |
] |
545 |
] |
546 |
}; |
547 |
$('#example').dataTable( oInit ); |
548 |
|
549 |
/* Basic checks */ |
550 |
oTest.fnWaitTest( |
551 |
"Length changing div exists", |
552 |
null, |
553 |
function () { return document.getElementById('example_length') != null; } |
554 |
); |
555 |
|
556 |
oTest.fnTest( |
557 |
"Filtering div exists", |
558 |
null, |
559 |
function () { return document.getElementById('example_filter') != null; } |
560 |
); |
561 |
|
562 |
oTest.fnTest( |
563 |
"Information div exists", |
564 |
null, |
565 |
function () { return document.getElementById('example_info') != null; } |
566 |
); |
567 |
|
568 |
oTest.fnTest( |
569 |
"Pagination div exists", |
570 |
null, |
571 |
function () { return document.getElementById('example_paginate') != null; } |
572 |
); |
573 |
|
574 |
oTest.fnTest( |
575 |
"Processing div is off by default", |
576 |
null, |
577 |
function () { return document.getElementById('example_processing') == null; } |
578 |
); |
579 |
|
580 |
oTest.fnWaitTest( |
581 |
"10 rows shown on the first page", |
582 |
null, |
583 |
function () { return $('#example tbody tr').length == 10; } |
584 |
); |
585 |
|
586 |
oTest.fnTest( |
587 |
"Initial sort occured", |
588 |
null, |
589 |
function () { return $('#example tbody td:eq(0)').html() == "Gecko"; } |
590 |
); |
591 |
|
592 |
/* Need to use the WaitTest for sorting due to the setTimeout datatables uses */ |
593 |
oTest.fnTest( |
594 |
"Sorting (first click) on second column", |
595 |
function () { $('#example thead th:eq(1)').click(); }, |
596 |
function () { return $('#example tbody td:eq(1)').html() == "All others"; } |
597 |
); |
598 |
|
599 |
oTest.fnTest( |
600 |
"Sorting (second click) on second column", |
601 |
function () { $('#example thead th:eq(1)').click(); }, |
602 |
function () { return $('#example tbody td:eq(1)').html() == "Seamonkey 1.1"; } |
603 |
); |
604 |
|
605 |
oTest.fnTest( |
606 |
"Sorting (third click) on second column", |
607 |
function () { $('#example thead th:eq(1)').click(); }, |
608 |
function () { return $('#example tbody td:eq(1)').html() == "All others"; } |
609 |
); |
610 |
|
611 |
oTest.fnTest( |
612 |
"Sorting (first click) on numeric column", |
613 |
function () { $('#example thead th:eq(3)').click(); }, |
614 |
function () { return $('#example tbody td:eq(3)').html() == "-"; } |
615 |
); |
616 |
|
617 |
oTest.fnTest( |
618 |
"Sorting (second click) on numeric column", |
619 |
function () { $('#example thead th:eq(3)').click(); }, |
620 |
function () { return $('#example tbody td:eq(3)').html() == "522.1"; } |
621 |
); |
622 |
|
623 |
oTest.fnTest( |
624 |
"Sorting multi-column (first click)", |
625 |
function () { |
626 |
$('#example thead th:eq(0)').click(); |
627 |
oDispacher.click( $('#example thead th:eq(1)')[0], { 'shift': true } ); }, |
628 |
function () { var b = |
629 |
$('#example tbody td:eq(0)').html() == "Gecko" && |
630 |
$('#example tbody td:eq(1)').html() == "Camino 1.0"; return b; } |
631 |
); |
632 |
|
633 |
oTest.fnTest( |
634 |
"Sorting multi-column - sorting second column only", |
635 |
function () { |
636 |
$('#example thead th:eq(1)').click(); }, |
637 |
function () { return $('#example tbody td:eq(1)').html() == "All others"; } |
638 |
); |
639 |
|
640 |
/* Basic paging */ |
641 |
oTest.fnTest( |
642 |
"Paging to second page", |
643 |
function () { $('#example_next').click(); }, |
644 |
function () { return $('#example tbody td:eq(1)').html() == "IE Mobile"; } |
645 |
); |
646 |
|
647 |
oTest.fnTest( |
648 |
"Paging to first page", |
649 |
function () { $('#example_previous').click(); }, |
650 |
function () { return $('#example tbody td:eq(1)').html() == "All others"; } |
651 |
); |
652 |
|
653 |
oTest.fnTest( |
654 |
"Attempting to page back beyond the first page", |
655 |
function () { $('#example_previous').click(); }, |
656 |
function () { return $('#example tbody td:eq(1)').html() == "All others"; } |
657 |
); |
658 |
|
659 |
/* Changing length */ |
660 |
oTest.fnTest( |
661 |
"Changing table length to 25 records", |
662 |
function () { $("select[name=example_length]").val('25').change(); }, |
663 |
function () { return $('#example tbody tr').length == 25; } |
664 |
); |
665 |
|
666 |
oTest.fnTest( |
667 |
"Changing table length to 50 records", |
668 |
function () { $("select[name=example_length]").val('50').change(); }, |
669 |
function () { return $('#example tbody tr').length == 50; } |
670 |
); |
671 |
|
672 |
oTest.fnTest( |
673 |
"Changing table length to 100 records", |
674 |
function () { $("select[name=example_length]").val('100').change(); }, |
675 |
function () { return $('#example tbody tr').length == 57; } |
676 |
); |
677 |
|
678 |
oTest.fnTest( |
679 |
"Changing table length to 10 records", |
680 |
function () { $("select[name=example_length]").val('10').change(); }, |
681 |
function () { return $('#example tbody tr').length == 10; } |
682 |
); |
683 |
|
684 |
/* |
685 |
* Information element |
686 |
*/ |
687 |
oTest.fnTest( |
688 |
"Information on zero config", |
689 |
null, |
690 |
function () { return document.getElementById('example_info').innerHTML == "Showing 1 to 10 of 57 entries"; } |
691 |
); |
692 |
|
693 |
oTest.fnTest( |
694 |
"Information on second page", |
695 |
function () { $('#example_next').click(); }, |
696 |
function () { return document.getElementById('example_info').innerHTML == "Showing 11 to 20 of 57 entries"; } |
697 |
); |
698 |
|
699 |
oTest.fnTest( |
700 |
"Information on third page", |
701 |
function () { $('#example_next').click(); }, |
702 |
function () { return document.getElementById('example_info').innerHTML == "Showing 21 to 30 of 57 entries"; } |
703 |
); |
704 |
|
705 |
oTest.fnTest( |
706 |
"Information on last page", |
707 |
function () { |
708 |
$('#example_next').click(); |
709 |
$('#example_next').click(); |
710 |
$('#example_next').click(); |
711 |
}, |
712 |
function () { return document.getElementById('example_info').innerHTML == "Showing 51 to 57 of 57 entries"; } |
713 |
); |
714 |
|
715 |
oTest.fnTest( |
716 |
"Information back on first page", |
717 |
function () { |
718 |
$('#example_previous').click(); |
719 |
$('#example_previous').click(); |
720 |
$('#example_previous').click(); |
721 |
$('#example_previous').click(); |
722 |
$('#example_previous').click(); |
723 |
}, |
724 |
function () { return document.getElementById('example_info').innerHTML == "Showing 1 to 10 of 57 entries"; } |
725 |
); |
726 |
|
727 |
oTest.fnTest( |
728 |
"Information with 25 records", |
729 |
function () { $("select[name=example_length]").val('25').change(); }, |
730 |
function () { return document.getElementById('example_info').innerHTML == "Showing 1 to 25 of 57 entries"; } |
731 |
); |
732 |
|
733 |
oTest.fnTest( |
734 |
"Information with 25 records - second page", |
735 |
function () { $('#example_next').click(); }, |
736 |
function () { return document.getElementById('example_info').innerHTML == "Showing 26 to 50 of 57 entries"; } |
737 |
); |
738 |
|
739 |
oTest.fnTest( |
740 |
"Information with 100 records - first page", |
741 |
function () { |
742 |
$('#example_previous').click(); |
743 |
$("select[name=example_length]").val('100').change(); |
744 |
}, |
745 |
function () { return document.getElementById('example_info').innerHTML == "Showing 1 to 57 of 57 entries"; } |
746 |
); |
747 |
|
748 |
oTest.fnTest( |
749 |
"Information back to 10 records", |
750 |
function () { |
751 |
$('#example_previous').click(); |
752 |
$("select[name=example_length]").val('10').change(); |
753 |
}, |
754 |
function () { return document.getElementById('example_info').innerHTML == "Showing 1 to 10 of 57 entries"; } |
755 |
); |
756 |
|
757 |
oTest.fnTest( |
758 |
"Information with filter 'Win'", |
759 |
function () { $('#example_filter input').val("Win").keyup(); }, |
760 |
function () { return document.getElementById('example_info').innerHTML == |
761 |
"Showing 1 to 10 of 31 entries (filtered from 57 total entries)"; } |
762 |
); |
763 |
|
764 |
oTest.fnTest( |
765 |
"Information with filter 'Win' second page", |
766 |
function () { $('#example_next').click(); }, |
767 |
function () { return document.getElementById('example_info').innerHTML == |
768 |
"Showing 11 to 20 of 31 entries (filtered from 57 total entries)"; } |
769 |
); |
770 |
|
771 |
oTest.fnTest( |
772 |
"Information with filter 'Win' last page", |
773 |
function () { |
774 |
$('#example_next').click(); |
775 |
$('#example_next').click(); |
776 |
}, |
777 |
function () { return document.getElementById('example_info').innerHTML == |
778 |
"Showing 31 to 31 of 31 entries (filtered from 57 total entries)"; } |
779 |
); |
780 |
|
781 |
oTest.fnTest( |
782 |
"Information with filter 'Win' back to first page", |
783 |
function () { |
784 |
$('#example_previous').click(); |
785 |
$('#example_previous').click(); |
786 |
$('#example_previous').click(); |
787 |
}, |
788 |
function () { return document.getElementById('example_info').innerHTML == |
789 |
"Showing 1 to 10 of 31 entries (filtered from 57 total entries)"; } |
790 |
); |
791 |
|
792 |
oTest.fnTest( |
793 |
"Information with filter 'Win' second page - second time", |
794 |
function () { |
795 |
$('#example_next').click(); |
796 |
}, |
797 |
function () { return document.getElementById('example_info').innerHTML == |
798 |
"Showing 11 to 20 of 31 entries (filtered from 57 total entries)"; } |
799 |
); |
800 |
|
801 |
oTest.fnTest( |
802 |
"Information with filter increased to 'Win 98'", |
803 |
function () { $('#example_filter input').val("Win 98").keyup(); }, |
804 |
function () { return document.getElementById('example_info').innerHTML == |
805 |
"Showing 1 to 9 of 9 entries (filtered from 57 total entries)"; } |
806 |
); |
807 |
|
808 |
oTest.fnTest( |
809 |
"Information with filter decreased to 'Win'", |
810 |
function () { $('#example_filter input').val("Win").keyup(); }, |
811 |
function () { return document.getElementById('example_info').innerHTML == |
812 |
"Showing 1 to 10 of 31 entries (filtered from 57 total entries)"; } |
813 |
); |
814 |
|
815 |
oTest.fnTest( |
816 |
"Information with filter 'Win' second page - third time", |
817 |
function () { |
818 |
$('#example_next').click(); |
819 |
}, |
820 |
function () { return document.getElementById('example_info').innerHTML == |
821 |
"Showing 11 to 20 of 31 entries (filtered from 57 total entries)"; } |
822 |
); |
823 |
|
824 |
oTest.fnTest( |
825 |
"Information with filter removed", |
826 |
function () { $('#example_filter input').val("").keyup(); }, |
827 |
function () { return document.getElementById('example_info').innerHTML == |
828 |
"Showing 1 to 10 of 57 entries"; } |
829 |
); |
830 |
|
831 |
|
832 |
/* |
833 |
* Filtering |
834 |
*/ |
835 |
oTest.fnWaitTest( |
836 |
"Filter 'W' - rows", |
837 |
function () { |
838 |
/* Reset the table such that the old sorting doesn't mess things up */ |
839 |
oSession.fnRestore(); |
840 |
$('#example').dataTable( oInit ); |
841 |
$('#example_filter input').val("W").keyup(); }, |
842 |
function () { return $('#example tbody tr:eq(0) td:eq(0)').html() == "Gecko"; } |
843 |
); |
844 |
|
845 |
oTest.fnTest( |
846 |
"Filter 'W' - info", |
847 |
null, |
848 |
function () { return document.getElementById('example_info').innerHTML == |
849 |
"Showing 1 to 10 of 42 entries (filtered from 57 total entries)"; } |
850 |
); |
851 |
|
852 |
oTest.fnTest( |
853 |
"Filter 'Wi'", |
854 |
function () { $('#example_filter input').val("Wi").keyup(); }, |
855 |
function () { return document.getElementById('example_info').innerHTML == |
856 |
"Showing 1 to 10 of 32 entries (filtered from 57 total entries)"; } |
857 |
); |
858 |
|
859 |
oTest.fnTest( |
860 |
"Filter 'Win'", |
861 |
function () { $('#example_filter input').val("Win").keyup(); }, |
862 |
function () { return document.getElementById('example_info').innerHTML == |
863 |
"Showing 1 to 10 of 31 entries (filtered from 57 total entries)"; } |
864 |
); |
865 |
|
866 |
oTest.fnTest( |
867 |
"Filter 'Win' - sorting column 1", |
868 |
function () { $('#example thead th:eq(1)').click(); }, |
869 |
function () { return $('#example tbody tr:eq(0) td:eq(1)').html() == "AOL browser (AOL desktop)"; } |
870 |
); |
871 |
|
872 |
oTest.fnTest( |
873 |
"Filter 'Win' - sorting column 1 info", |
874 |
null, |
875 |
function () { return document.getElementById('example_info').innerHTML == |
876 |
"Showing 1 to 10 of 31 entries (filtered from 57 total entries)"; } |
877 |
); |
878 |
|
879 |
oTest.fnTest( |
880 |
"Filter 'Win' - sorting column 1 reverse", |
881 |
function () { $('#example thead th:eq(1)').click(); }, |
882 |
function () { return $('#example tbody tr:eq(0) td:eq(1)').html() == "Seamonkey 1.1"; } |
883 |
); |
884 |
|
885 |
oTest.fnTest( |
886 |
"Filter 'Win XP' - maintaing reverse sorting col 1", |
887 |
function () { $('#example_filter input').val("Win XP").keyup(); }, |
888 |
function () { return $('#example tbody tr:eq(0) td:eq(1)').html() == "Internet Explorer 7"; } |
889 |
); |
890 |
|
891 |
oTest.fnTest( |
892 |
"Filter 'Win XP' - sorting col 3", |
893 |
function () { $('#example thead th:eq(3)').click(); }, |
894 |
function () { return $('#example tbody tr:eq(0) td:eq(3)').html() == "4"; } |
895 |
); |
896 |
|
897 |
oTest.fnTest( |
898 |
"Filter 'Win XP' - sorting col 3 - reversed", |
899 |
function () { $('#example thead th:eq(3)').click(); }, |
900 |
function () { return $('#example tbody tr:eq(0) td:eq(3)').html() == "7"; } |
901 |
); |
902 |
|
903 |
oTest.fnTest( |
904 |
"Filter 'Win' - sorting col 3 - reversed info", |
905 |
null, |
906 |
function () { return document.getElementById('example_info').innerHTML == |
907 |
"Showing 1 to 6 of 6 entries (filtered from 57 total entries)"; } |
908 |
); |
909 |
|
910 |
oTest.fnTest( |
911 |
"Filter 'nothinghere'", |
912 |
function () { $('#example_filter input').val("nothinghere").keyup(); }, |
913 |
function () { return $('#example tbody tr:eq(0) td:eq(0)').html() == |
914 |
"No matching records found"; } |
915 |
); |
916 |
|
917 |
oTest.fnTest( |
918 |
"Filter 'nothinghere' - info", |
919 |
null, |
920 |
function () { return document.getElementById('example_info').innerHTML == |
921 |
"Showing 0 to 0 of 0 entries (filtered from 57 total entries)"; } |
922 |
); |
923 |
|
924 |
oTest.fnTest( |
925 |
"Filter back to blank and 1st column sorting", |
926 |
function () { |
927 |
$('#example_filter input').val("").keyup(); |
928 |
$('#example thead th:eq(0)').click(); |
929 |
}, |
930 |
function () { return document.getElementById('example_info').innerHTML == |
931 |
"Showing 1 to 10 of 57 entries"; } |
932 |
); |
933 |
|
934 |
oTest.fnTest( |
935 |
"Prefixing a filter entry", |
936 |
function () { |
937 |
$('#example_filter input').val("Win").keyup(); |
938 |
$('#example_filter input').val("GeckoWin").keyup(); |
939 |
}, |
940 |
function () { return document.getElementById('example_info').innerHTML == |
941 |
"Showing 0 to 0 of 0 entries (filtered from 57 total entries)"; } |
942 |
); |
943 |
|
944 |
oTest.fnTest( |
945 |
"Prefixing a filter entry with space", |
946 |
function () { |
947 |
$('#example_filter input').val("Gecko Win").keyup(); |
948 |
}, |
949 |
function () { return document.getElementById('example_info').innerHTML == |
950 |
"Showing 1 to 10 of 17 entries (filtered from 57 total entries)"; } |
951 |
); |
952 |
|
953 |
|
954 |
|
955 |
|
956 |
|
957 |
|
958 |
|
959 |
|
960 |
oTest.fnComplete(); |
961 |
} ); |