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 / 6776-scrolling-table-grows.js
1 // DATA_TEMPLATE: 6776
2 oTest.fnStart( "Actions on a scrolling table keep width" );
3
4
5 $(document).ready( function () {
6         var oTable = $('#example').dataTable( {
7         "bFilter": true,
8         "bSort": true,
9         "sScrollY": "100px",
10         "bPaginate": false
11         } );
12         
13         var iWidth = $('div.dataTables_wrapper').width();
14
15         oTest.fnTest( 
16                 "First sort has no effect on width",
17                 function () { $('th:eq(1)').click(); },
18                 function () { return $('div.dataTables_wrapper').width() == iWidth; }
19         );
20
21         oTest.fnTest( 
22                 "Second sort has no effect on width",
23                 function () { $('th:eq(1)').click(); },
24                 function () { return $('div.dataTables_wrapper').width() == iWidth; }
25         );
26
27         oTest.fnTest( 
28                 "Third sort has no effect on width",
29                 function () { $('th:eq(2)').click(); },
30                 function () { return $('div.dataTables_wrapper').width() == iWidth; }
31         );
32
33         oTest.fnTest( 
34                 "Filter has no effect on width",
35                 function () { oTable.fnFilter('i'); },
36                 function () { return $('div.dataTables_wrapper').width() == iWidth; }
37         );
38
39         oTest.fnTest( 
40                 "Filter 2 has no effect on width",
41                 function () { oTable.fnFilter('in'); },
42                 function () { return $('div.dataTables_wrapper').width() == iWidth; }
43         );
44
45         oTest.fnTest( 
46                 "No result filter has header and body at same width",
47                 function () { oTable.fnFilter('xxx'); },
48                 function () { return $('#example').width() == $('div.dataTables_scrollHeadInner').width(); }
49         );
50
51         oTest.fnTest( 
52                 "Filter with no results has no effect on width",
53                 function () { oTable.fnFilter('xxx'); },
54                 function () { return $('div.dataTables_wrapper').width() == iWidth; }
55         );
56
57         oTest.fnTest( 
58                 "Filter with no results has table equal to wrapper width",
59                 function () { oTable.fnFilter('xxx'); },
60                 function () { return $('div.dataTables_wrapper').width() == $('#example').width(); }
61         );
62         
63         oTest.fnComplete();
64 } );