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 / bSortCellsTop.js
1 // DATA_TEMPLATE: dom_data_two_headers
2 oTest.fnStart( "bSortCellsTop" );
3
4 $(document).ready( function () {
5         /* Check the default */
6         var oTable = $('#example').dataTable();
7         var oSettings = oTable.fnSettings();
8         
9         oTest.fnTest( 
10                 "Sorting class is on the bottom cells by default",
11                 null,
12                 function () { return $('#example thead tr:eq(1) th:eq(0)').hasClass('sorting_asc'); }
13         );
14         
15         oTest.fnTest( 
16                 "Sorting is performed on bottom cells",
17                 function () { return $('#example thead tr:eq(1) th:eq(0)').click(); },
18                 function () { return $('#example tbody tr:eq(0) td:eq(0)').html() == "Webkit"; }
19         );
20         
21         oTest.fnTest( 
22                 "Sorting class is updated on the bottom cells",
23                 null,
24                 function () { return $('#example thead tr:eq(1) th:eq(0)').hasClass('sorting_desc'); }
25         );
26         
27         oTest.fnTest( 
28                 "Clicking on top cells has no effect",
29                 function () { return $('#example thead tr:eq(0) th:eq(0)').click(); },
30                 function () { return $('#example tbody tr:eq(0) td:eq(0)').html() == "Webkit"; }
31         );
32         
33         oTest.fnTest( 
34                 "Clicking on another top cell has no effect",
35                 function () { return $('#example thead tr:eq(0) th:eq(3)').click(); },
36                 function () { return $('#example tbody tr:eq(0) td:eq(0)').html() == "Webkit"; }
37         );
38         
39         
40         oTest.fnTest( 
41                 "Sorting class is on the top cell when bSortCellsTop is true",
42                 function () {
43                         oSession.fnRestore();
44                         $('#example').dataTable( {
45                                 "bSortCellsTop": true
46                         } );
47                 },
48                 function () { return $('#example thead tr:eq(0) th:eq(0)').hasClass('sorting_asc'); }
49         );
50         
51         oTest.fnTest( 
52                 "Sorting is performed on top cells now",
53                 function () { return $('#example thead tr:eq(0) th:eq(0)').click(); },
54                 function () { return $('#example tbody tr:eq(0) td:eq(0)').html() == "Webkit"; }
55         );
56         
57         oTest.fnTest( 
58                 "Sorting class is updated on the top cells",
59                 null,
60                 function () { return $('#example thead tr:eq(0) th:eq(0)').hasClass('sorting_desc'); }
61         );
62         
63         oTest.fnTest( 
64                 "Clicking on bottom cells has no effect",
65                 function () { return $('#example thead tr:eq(1) th:eq(0)').click(); },
66                 function () { return $('#example tbody tr:eq(0) td:eq(0)').html() == "Webkit"; }
67         );
68         
69         oTest.fnTest( 
70                 "Clicking on another bottom cell has no effect",
71                 function () { return $('#example thead tr:eq(1) th:eq(3)').click(); },
72                 function () { return $('#example tbody tr:eq(0) td:eq(0)').html() == "Webkit"; }
73         );
74         
75         
76         oTest.fnComplete();
77 } );