Add datatables-1.9.4 and jquery-1.10.2 libraries
[proteocache.git] / webapp / resources / datatables-1.9.4 / media / unit_testing / tests_onhold / 1_dom / bInfiniteScroll.js
1 // DATA_TEMPLATE: dom_data
2 oTest.fnStart( "bInfiniteScroll" );
3
4
5 $(document).ready( function () {
6         var oTable = $('#example').dataTable( {
7                 "bScrollInfinite": true,
8                 "sScrollY": "200px"
9         } );
10         
11         oTest.fnTest( 
12                 "10 rows by default",
13                 null,
14                 function () { return $('#example tbody tr').length == 10; }
15         );
16         
17         oTest.fnTest( 
18                 "Info",
19                 null,
20                 function () { return $('#example_info').html() == "Showing 1 to 10 of 57 entries"; }
21         );
22         
23         oTest.fnTest( 
24                 "Get nodes",
25                 null,
26                 function () { return $('#example tbody>tr').length == 10; }
27         );
28         
29         oTest.fnWaitTest( 
30                 "Scroll on 20px adds 10 rows",
31                 function () { $('div.dataTables_scrollBody').scrollTop(20); },
32                 function () { return $('#example tbody tr').length == 20; }
33         );
34         
35         oTest.fnTest( 
36                 "Info after 20px scroll",
37                 null,
38                 function () { return $('#example_info').html() == "Showing 1 to 20 of 57 entries"; }
39         );
40         
41         oTest.fnTest( 
42                 "Get nodes after 20px scroll",
43                 null,
44                 function () { return $('#example tbody>tr').length == 20; }
45         );
46         
47         oTest.fnTest( 
48                 "Scroll on 10px more results in the same number of rows",
49                 function () { $('div.dataTables_scrollBody').scrollTop(30); },
50                 function () { return $('#example tbody tr').length == 20; }
51         );
52         
53         oTest.fnTest( 
54                 "Info after 10 more px scroll",
55                 null,
56                 function () { return $('#example_info').html() == "Showing 1 to 20 of 57 entries"; }
57         );
58         
59         oTest.fnWaitTest( 
60                 "Scroll to 240px adds another 10 rows",
61                 function () { $('div.dataTables_scrollBody').scrollTop(240); },
62                 function () { return $('#example tbody tr').length == 30; }
63         );
64         
65         oTest.fnTest( 
66                 "Info after 240px scroll",
67                 null,
68                 function () { return $('#example_info').html() == "Showing 1 to 30 of 57 entries"; }
69         );
70         
71         oTest.fnTest( 
72                 "Get nodes after 240px scroll",
73                 null,
74                 function () { return $('#example tbody>tr').length == 30; }
75         );
76         
77         oTest.fnTest( 
78                 "Filtering will drop back to 10 rows",
79                 function () { 
80                         $('div.dataTables_scrollBody').scrollTop(0);
81                         oTable.fnFilter('gec')
82                 },
83                 function () { return $('#example tbody tr').length == 10; }
84         );
85         
86         oTest.fnTest( 
87                 "Info after filtering",
88                 null,
89                 function () { return $('#example_info').html() == "Showing 1 to 10 of 20 entries (filtered from 57 total entries)"; }
90         );
91         
92         oTest.fnTest( 
93                 "Get nodes after filtering",
94                 null,
95                 function () { return $('#example tbody>tr').length == 10; }
96         );
97         
98         oTest.fnWaitTest( 
99                 "Scroll after filtering adds 10",
100                 function () { $('div.dataTables_scrollBody').scrollTop(20); },
101                 function () { return $('#example tbody tr').length == 20; }
102         );
103         
104         oTest.fnTest( 
105                 "Get nodes after filtering",
106                 null,
107                 function () { return $('#example tbody>tr').length == 20; }
108         );
109         
110         oTest.fnTest( 
111                 "Sorting will drop back to 10 rows",
112                 function () { oTable.fnSort([[1,'asc']]) },
113                 function () { return $('#example tbody tr').length == 10; }
114         );
115         
116         oTest.fnWaitTest( 
117                 "Scroll after sorting adds 10",
118                 function () { $('div.dataTables_scrollBody').scrollTop(20); },
119                 function () { return $('#example tbody tr').length == 20; }
120         );
121         
122         oTest.fnTest( 
123                 "Get nodes after scrolling",
124                 null,
125                 function () { return $('#example tbody>tr').length == 20; }
126         );
127         
128         
129         oTest.fnComplete();
130 } );