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