annotate DataTables-1.9.4/media/unit_testing/tests_onhold/6_delayed_rendering/bLengthChange.js @ 7:0f2b740536fb draft

Uploaded
author saskia-hiltemann
date Mon, 21 Aug 2017 09:16:07 -0400
parents ac5f9272033b
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
1 // DATA_TEMPLATE: empty_table
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
2 oTest.fnStart( "bLengthChange" );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
3
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
4 $(document).ready( function () {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
5 /* Check the default */
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
6 $('#example').dataTable( {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
7 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
8 "bDeferRender": true
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
9 } );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
10
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
11 oTest.fnWaitTest(
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
12 "Length div exists by default",
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
13 null,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
14 function () { return document.getElementById('example_length') != null; }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
15 );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
16
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
17 oTest.fnWaitTest(
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
18 "Four default options",
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
19 null,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
20 function () { return $("select[name=example_length] option").length == 4; }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
21 );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
22
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
23 oTest.fnWaitTest(
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
24 "Default options",
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
25 null,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
26 function () {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
27 var opts = $("select[name='example_length'] option");
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
28 return opts[0].getAttribute('value') == 10 && opts[1].getAttribute('value') == 25 &&
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
29 opts[2].getAttribute('value') == 50 && opts[3].getAttribute('value') == 100;
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
30 }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
31 );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
32
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
33 oTest.fnWaitTest(
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
34 "Info takes length into account",
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
35 null,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
36 function () { return document.getElementById('example_info').innerHTML ==
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
37 "Showing 1 to 10 of 57 entries"; }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
38 );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
39
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
40 /* Check can disable */
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
41 oTest.fnWaitTest(
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
42 "Change length can be disabled",
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
43 function () {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
44 oSession.fnRestore();
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
45 $('#example').dataTable( {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
46 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
47 "bDeferRender": true,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
48 "bLengthChange": false
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
49 } );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
50 },
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
51 function () { return document.getElementById('example_length') == null; }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
52 );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
53
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
54 oTest.fnWaitTest(
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
55 "Information takes length disabled into account",
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
56 null,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
57 function () { return document.getElementById('example_info').innerHTML ==
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
58 "Showing 1 to 10 of 57 entries"; }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
59 );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
60
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
61 /* Enable makes no difference */
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
62 oTest.fnWaitTest(
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
63 "Length change enabled override",
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
64 function () {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
65 oSession.fnRestore();
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
66 $('#example').dataTable( {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
67 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
68 "bDeferRender": true,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
69 "bLengthChange": true
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
70 } );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
71 },
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
72 function () { return document.getElementById('example_length') != null; }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
73 );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
74
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
75
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
76
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
77 oTest.fnComplete();
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
78 } );