1 // DATA_TEMPLATE: empty_table
2 oTest.fnStart( "Sanity checks for DataTables with data from JS - Deep data source" );
5 "jQuery.dataTable function",
7 function () { return typeof jQuery().dataTable == "function"; }
11 "jQuery.dataTableSettings storage array",
13 function () { return typeof jQuery().dataTableSettings == "object"; }
17 "jQuery.dataTableExt plugin object",
19 function () { return typeof jQuery().dataTableExt == "object"; }
22 $(document).ready( function () {
25 { "mData": "engine" },
26 { "mData": "browser" },
27 { "mData": "platform.inner" },
28 { "mData": "platform.details.0" },
29 { "mData": "platform.details.1" }
34 "browser": "Internet Explorer 4.0",
45 "browser": "Internet Explorer 5.0",
56 "browser": "Internet Explorer 5.5",
67 "browser": "Internet Explorer 6",
78 "browser": "Internet Explorer 7",
80 "inner": "Win XP SP2+",
89 "browser": "AOL browser (AOL desktop)",
100 "browser": "Firefox 1.0",
102 "inner": "Win 98+ / OSX.2+",
111 "browser": "Firefox 1.5",
113 "inner": "Win 98+ / OSX.2+",
122 "browser": "Firefox 2.0",
124 "inner": "Win 98+ / OSX.2+",
133 "browser": "Firefox 3.0",
135 "inner": "Win 2k+ / OSX.3+",
144 "browser": "Camino 1.0",
155 "browser": "Camino 1.5",
166 "browser": "Netscape 7.2",
168 "inner": "Win 95+ / Mac OS 8.6-9.2",
177 "browser": "Netscape Browser 8",
179 "inner": "Win 98SE+",
188 "browser": "Netscape Navigator 9",
190 "inner": "Win 98+ / OSX.2+",
199 "browser": "Mozilla 1.0",
201 "inner": "Win 95+ / OSX.1+",
210 "browser": "Mozilla 1.1",
212 "inner": "Win 95+ / OSX.1+",
221 "browser": "Mozilla 1.2",
223 "inner": "Win 95+ / OSX.1+",
232 "browser": "Mozilla 1.3",
234 "inner": "Win 95+ / OSX.1+",
243 "browser": "Mozilla 1.4",
245 "inner": "Win 95+ / OSX.1+",
254 "browser": "Mozilla 1.5",
256 "inner": "Win 95+ / OSX.1+",
265 "browser": "Mozilla 1.6",
267 "inner": "Win 95+ / OSX.1+",
276 "browser": "Mozilla 1.7",
278 "inner": "Win 98+ / OSX.1+",
287 "browser": "Mozilla 1.8",
289 "inner": "Win 98+ / OSX.1+",
298 "browser": "Seamonkey 1.1",
300 "inner": "Win 98+ / OSX.2+",
309 "browser": "Epiphany 2.20",
320 "browser": "Safari 1.2",
331 "browser": "Safari 1.3",
342 "browser": "Safari 2.0",
353 "browser": "Safari 3.0",
364 "browser": "OmniWeb 5.5",
375 "browser": "iPod Touch / iPhone",
397 "browser": "Opera 7.0",
399 "inner": "Win 95+ / OSX.1+",
408 "browser": "Opera 7.5",
410 "inner": "Win 95+ / OSX.2+",
419 "browser": "Opera 8.0",
421 "inner": "Win 95+ / OSX.2+",
430 "browser": "Opera 8.5",
432 "inner": "Win 95+ / OSX.2+",
441 "browser": "Opera 9.0",
443 "inner": "Win 95+ / OSX.3+",
452 "browser": "Opera 9.2",
454 "inner": "Win 88+ / OSX.3+",
463 "browser": "Opera 9.5",
465 "inner": "Win 88+ / OSX.3+",
474 "browser": "Opera for Wii",
485 "browser": "Nokia N800",
496 "browser": "Nintendo DS browser",
498 "inner": "Nintendo DS",
507 "browser": "Konqureror 3.1",
518 "browser": "Konqureror 3.3",
529 "browser": "Konqureror 3.5",
540 "browser": "Internet Explorer 4.5",
542 "inner": "Mac OS 8-9",
551 "browser": "Internet Explorer 5.1",
553 "inner": "Mac OS 7.6-9",
562 "browser": "Internet Explorer 5.2",
564 "inner": "Mac OS 8-X",
573 "browser": "NetFront 3.1",
575 "inner": "Embedded devices",
584 "browser": "NetFront 3.4",
586 "inner": "Embedded devices",
595 "browser": "Dillo 0.8",
597 "inner": "Embedded devices",
608 "inner": "Text only",
619 "inner": "Text only",
628 "browser": "IE Mobile",
630 "inner": "Windows Mobile 6",
639 "browser": "PSP browser",
649 "engine": "Other browsers",
650 "browser": "All others",
661 $('#example').dataTable( oInit );
665 "Length changing div exists",
667 function () { return document.getElementById('example_length') != null; }
671 "Filtering div exists",
673 function () { return document.getElementById('example_filter') != null; }
677 "Information div exists",
679 function () { return document.getElementById('example_info') != null; }
683 "Pagination div exists",
685 function () { return document.getElementById('example_paginate') != null; }
689 "Processing div is off by default",
691 function () { return document.getElementById('example_processing') == null; }
695 "10 rows shown on the first page",
697 function () { return $('#example tbody tr').length == 10; }
701 "Initial sort occured",
703 function () { return $('#example tbody td:eq(0)').html() == "Gecko"; }
706 /* Need to use the WaitTest for sorting due to the setTimeout datatables uses */
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"; }
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"; }
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"; }
726 "Sorting (first click) on numeric column",
727 function () { $('#example thead th:eq(3)').click(); },
728 function () { return $('#example tbody td:eq(3)').html() == "-"; }
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"; }
738 "Sorting multi-column (first click)",
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; }
748 "Sorting multi-column - sorting second column only",
750 $('#example thead th:eq(1)').click(); },
751 function () { return $('#example tbody td:eq(1)').html() == "All others"; }
756 "Paging to second page",
757 function () { $('#example_next').click(); },
758 function () { return $('#example tbody td:eq(1)').html() == "IE Mobile"; }
762 "Paging to first page",
763 function () { $('#example_previous').click(); },
764 function () { return $('#example tbody td:eq(1)').html() == "All others"; }
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"; }
773 /* Changing length */
775 "Changing table length to 25 records",
776 function () { $("select[name=example_length]").val('25').change(); },
777 function () { return $('#example tbody tr').length == 25; }
781 "Changing table length to 50 records",
782 function () { $("select[name=example_length]").val('50').change(); },
783 function () { return $('#example tbody tr').length == 50; }
787 "Changing table length to 100 records",
788 function () { $("select[name=example_length]").val('100').change(); },
789 function () { return $('#example tbody tr').length == 57; }
793 "Changing table length to 10 records",
794 function () { $("select[name=example_length]").val('10').change(); },
795 function () { return $('#example tbody tr').length == 10; }
799 * Information element
802 "Information on zero config",
804 function () { return document.getElementById('example_info').innerHTML == "Showing 1 to 10 of 57 entries"; }
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"; }
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"; }
820 "Information on last page",
822 $('#example_next').click();
823 $('#example_next').click();
824 $('#example_next').click();
826 function () { return document.getElementById('example_info').innerHTML == "Showing 51 to 57 of 57 entries"; }
830 "Information back on first page",
832 $('#example_previous').click();
833 $('#example_previous').click();
834 $('#example_previous').click();
835 $('#example_previous').click();
836 $('#example_previous').click();
838 function () { return document.getElementById('example_info').innerHTML == "Showing 1 to 10 of 57 entries"; }
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"; }
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"; }
854 "Information with 100 records - first page",
856 $('#example_previous').click();
857 $("select[name=example_length]").val('100').change();
859 function () { return document.getElementById('example_info').innerHTML == "Showing 1 to 57 of 57 entries"; }
863 "Information back to 10 records",
865 $('#example_previous').click();
866 $("select[name=example_length]").val('10').change();
868 function () { return document.getElementById('example_info').innerHTML == "Showing 1 to 10 of 57 entries"; }
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)"; }
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)"; }
886 "Information with filter 'Win' last page",
888 $('#example_next').click();
889 $('#example_next').click();
891 function () { return document.getElementById('example_info').innerHTML ==
892 "Showing 31 to 31 of 31 entries (filtered from 57 total entries)"; }
896 "Information with filter 'Win' back to first page",
898 $('#example_previous').click();
899 $('#example_previous').click();
900 $('#example_previous').click();
902 function () { return document.getElementById('example_info').innerHTML ==
903 "Showing 1 to 10 of 31 entries (filtered from 57 total entries)"; }
907 "Information with filter 'Win' second page - second time",
909 $('#example_next').click();
911 function () { return document.getElementById('example_info').innerHTML ==
912 "Showing 11 to 20 of 31 entries (filtered from 57 total entries)"; }
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)"; }
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)"; }
930 "Information with filter 'Win' second page - third time",
932 $('#example_next').click();
934 function () { return document.getElementById('example_info').innerHTML ==
935 "Showing 11 to 20 of 31 entries (filtered from 57 total entries)"; }
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"; }
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"; }
962 function () { return document.getElementById('example_info').innerHTML ==
963 "Showing 1 to 10 of 42 entries (filtered from 57 total entries)"; }
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)"; }
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)"; }
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)"; }
987 "Filter 'Win' - sorting column 1 info",
989 function () { return document.getElementById('example_info').innerHTML ==
990 "Showing 1 to 10 of 31 entries (filtered from 57 total entries)"; }
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"; }
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"; }
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"; }
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"; }
1018 "Filter 'Win' - sorting col 3 - reversed info",
1020 function () { return document.getElementById('example_info').innerHTML ==
1021 "Showing 1 to 6 of 6 entries (filtered from 57 total entries)"; }
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"; }
1032 "Filter 'nothinghere' - info",
1034 function () { return document.getElementById('example_info').innerHTML ==
1035 "Showing 0 to 0 of 0 entries (filtered from 57 total entries)"; }
1039 "Filter back to blank and 1st column sorting",
1041 $('#example_filter input').val("").keyup();
1042 $('#example thead th:eq(0)').click();
1044 function () { return document.getElementById('example_info').innerHTML ==
1045 "Showing 1 to 10 of 57 entries"; }
1049 "Prefixing a filter entry",
1051 $('#example_filter input').val("Win").keyup();
1052 $('#example_filter input').val("GeckoWin").keyup();
1054 function () { return document.getElementById('example_info').innerHTML ==
1055 "Showing 0 to 0 of 0 entries (filtered from 57 total entries)"; }
1059 "Prefixing a filter entry with space",
1061 $('#example_filter input').val("Gecko Win").keyup();
1063 function () { return document.getElementById('example_info').innerHTML ==
1064 "Showing 1 to 10 of 17 entries (filtered from 57 total entries)"; }