Add datatables-1.9.4 and jquery-1.10.2 libraries
[proteocache.git] / webapp / resources / datatables-1.9.4 / media / unit_testing / tests_onhold / 3_ajax / bLengthChange.js
1 // DATA_TEMPLATE: empty_table
2 oTest.fnStart( "bLengthChange" );
3
4 $(document).ready( function () {
5         /* Check the default */
6         $('#example').dataTable( {
7                 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt"
8         } );
9         
10         oTest.fnWaitTest( 
11                 "Length div exists by default",
12                 null,
13                 function () { return document.getElementById('example_length') != null; }
14         );
15         
16         oTest.fnWaitTest(
17                 "Four default options",
18                 null,
19                 function () { return $("select[name=example_length] option").length == 4; }
20         );
21         
22         oTest.fnWaitTest(
23                 "Default options",
24                 null,
25                 function () {
26                         var opts = $("select[name='example_length'] option");
27                         return opts[0].getAttribute('value') == 10 && opts[1].getAttribute('value') == 25 &&
28                                 opts[2].getAttribute('value') == 50 && opts[3].getAttribute('value') == 100;
29                 }
30         );
31         
32         oTest.fnWaitTest(
33                 "Info takes length into account",
34                 null,
35                 function () { return document.getElementById('example_info').innerHTML == 
36                         "Showing 1 to 10 of 57 entries"; }
37         );
38         
39         /* Check can disable */
40         oTest.fnWaitTest( 
41                 "Change length can be disabled",
42                 function () {
43                         oSession.fnRestore();
44                         $('#example').dataTable( {
45                                 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
46                                 "bLengthChange": false
47                         } );
48                 },
49                 function () { return document.getElementById('example_length') == null; }
50         );
51         
52         oTest.fnWaitTest(
53                 "Information takes length disabled into account",
54                 null,
55                 function () { return document.getElementById('example_info').innerHTML == 
56                         "Showing 1 to 10 of 57 entries"; }
57         );
58         
59         /* Enable makes no difference */
60         oTest.fnWaitTest( 
61                 "Length change enabled override",
62                 function () {
63                         oSession.fnRestore();
64                         $('#example').dataTable( {
65                                 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
66                                 "bLengthChange": true
67                         } );
68                 },
69                 function () { return document.getElementById('example_length') != null; }
70         );
71         
72         
73         
74         oTest.fnComplete();
75 } );