0
|
1 // DATA_TEMPLATE: empty_table
|
|
2 oTest.fnStart( "Custom data source property - property given" );
|
|
3
|
|
4
|
|
5 $(document).ready( function () {
|
|
6 var oInit = {
|
|
7 "sAjaxSource": "../../../examples/ajax/sources/custom_prop.txt",
|
|
8 "bDeferRender": true,
|
|
9 "sAjaxDataProp": "demo"
|
|
10 };
|
|
11 $('#example').dataTable( oInit );
|
|
12
|
|
13 oTest.fnWaitTest(
|
|
14 "10 rows shown on the first page",
|
|
15 null,
|
|
16 function () { return $('#example tbody tr').length == 10; }
|
|
17 );
|
|
18
|
|
19 oTest.fnTest(
|
|
20 "Initial sort occured",
|
|
21 null,
|
|
22 function () { return $('#example tbody td:eq(0)').html() == "Gecko"; }
|
|
23 );
|
|
24
|
|
25 /* Need to use the WaitTest for sorting due to the setTimeout datatables uses */
|
|
26 oTest.fnTest(
|
|
27 "Sorting (first click) on second column",
|
|
28 function () { $('#example thead th:eq(1)').click(); },
|
|
29 function () { return $('#example tbody td:eq(1)').html() == "All others"; }
|
|
30 );
|
|
31
|
|
32 oTest.fnTest(
|
|
33 "Sorting (second click) on second column",
|
|
34 function () { $('#example thead th:eq(1)').click(); },
|
|
35 function () { return $('#example tbody td:eq(1)').html() == "Seamonkey 1.1"; }
|
|
36 );
|
|
37
|
|
38 oTest.fnTest(
|
|
39 "Sorting (third click) on second column",
|
|
40 function () { $('#example thead th:eq(1)').click(); },
|
|
41 function () { return $('#example tbody td:eq(1)').html() == "All others"; }
|
|
42 );
|
|
43
|
|
44 oTest.fnTest(
|
|
45 "Sorting (first click) on numeric column",
|
|
46 function () { $('#example thead th:eq(3)').click(); },
|
|
47 function () { return $('#example tbody td:eq(3)').html() == "-"; }
|
|
48 );
|
|
49
|
|
50 oTest.fnTest(
|
|
51 "Sorting (second click) on numeric column",
|
|
52 function () { $('#example thead th:eq(3)').click(); },
|
|
53 function () { return $('#example tbody td:eq(3)').html() == "522.1"; }
|
|
54 );
|
|
55
|
|
56 oTest.fnTest(
|
|
57 "Sorting multi-column (first click)",
|
|
58 function () {
|
|
59 $('#example thead th:eq(0)').click();
|
|
60 oDispacher.click( $('#example thead th:eq(1)')[0], { 'shift': true } ); },
|
|
61 function () { var b =
|
|
62 $('#example tbody td:eq(0)').html() == "Gecko" &&
|
|
63 $('#example tbody td:eq(1)').html() == "Camino 1.0"; return b; }
|
|
64 );
|
|
65
|
|
66 oTest.fnTest(
|
|
67 "Sorting multi-column - sorting second column only",
|
|
68 function () {
|
|
69 $('#example thead th:eq(1)').click(); },
|
|
70 function () { return $('#example tbody td:eq(1)').html() == "All others"; }
|
|
71 );
|
|
72
|
|
73 /* Basic paging */
|
|
74 oTest.fnTest(
|
|
75 "Paging to second page",
|
|
76 function () { $('#example_next').click(); },
|
|
77 function () { return $('#example tbody td:eq(1)').html() == "IE Mobile"; }
|
|
78 );
|
|
79
|
|
80 oTest.fnTest(
|
|
81 "Paging to first page",
|
|
82 function () { $('#example_previous').click(); },
|
|
83 function () { return $('#example tbody td:eq(1)').html() == "All others"; }
|
|
84 );
|
|
85
|
|
86 oTest.fnTest(
|
|
87 "Attempting to page back beyond the first page",
|
|
88 function () { $('#example_previous').click(); },
|
|
89 function () { return $('#example tbody td:eq(1)').html() == "All others"; }
|
|
90 );
|
|
91
|
|
92 /* Changing length */
|
|
93 oTest.fnTest(
|
|
94 "Changing table length to 25 records",
|
|
95 function () { $("select[name=example_length]").val('25').change(); },
|
|
96 function () { return $('#example tbody tr').length == 25; }
|
|
97 );
|
|
98
|
|
99 oTest.fnTest(
|
|
100 "Changing table length to 50 records",
|
|
101 function () { $("select[name=example_length]").val('50').change(); },
|
|
102 function () { return $('#example tbody tr').length == 50; }
|
|
103 );
|
|
104
|
|
105 oTest.fnTest(
|
|
106 "Changing table length to 100 records",
|
|
107 function () { $("select[name=example_length]").val('100').change(); },
|
|
108 function () { return $('#example tbody tr').length == 57; }
|
|
109 );
|
|
110
|
|
111 oTest.fnTest(
|
|
112 "Changing table length to 10 records",
|
|
113 function () { $("select[name=example_length]").val('10').change(); },
|
|
114 function () { return $('#example tbody tr').length == 10; }
|
|
115 );
|
|
116
|
|
117 /*
|
|
118 * Information element
|
|
119 */
|
|
120 oTest.fnTest(
|
|
121 "Information on zero config",
|
|
122 null,
|
|
123 function () { return document.getElementById('example_info').innerHTML == "Showing 1 to 10 of 57 entries"; }
|
|
124 );
|
|
125
|
|
126 oTest.fnTest(
|
|
127 "Information on second page",
|
|
128 function () { $('#example_next').click(); },
|
|
129 function () { return document.getElementById('example_info').innerHTML == "Showing 11 to 20 of 57 entries"; }
|
|
130 );
|
|
131
|
|
132 oTest.fnTest(
|
|
133 "Information on third page",
|
|
134 function () { $('#example_next').click(); },
|
|
135 function () { return document.getElementById('example_info').innerHTML == "Showing 21 to 30 of 57 entries"; }
|
|
136 );
|
|
137
|
|
138
|
|
139 oTest.fnComplete();
|
|
140 } ); |