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 / fnDrawCallback.js
1 // DATA_TEMPLATE: dom_data
2 oTest.fnStart( "fnDrawCallback" );
3
4 /* Fairly boring function compared to the others! */
5
6 $(document).ready( function () {
7         /* Check the default */
8         var oTable = $('#example').dataTable();
9         var oSettings = oTable.fnSettings();
10         var mPass;
11         
12         oTest.fnTest( 
13                 "Default should be null",
14                 null,
15                 function () { return oSettings.fnDrawCallback == null; }
16         );
17         
18         
19         oTest.fnTest( 
20                 "One argument passed",
21                 function () {
22                         oSession.fnRestore();
23                         
24                         mPass = -1;
25                         $('#example').dataTable( {
26                                 "fnDrawCallback": function ( ) {
27                                         mPass = arguments.length;
28                                 }
29                         } );
30                 },
31                 function () { return mPass == 1; }
32         );
33         
34         
35         oTest.fnTest( 
36                 "That one argument is the settings object",
37                 function () {
38                         oSession.fnRestore();
39                         
40                         oTable = $('#example').dataTable( {
41                                 "fnDrawCallback": function ( oSettings ) {
42                                         mPass = oSettings;
43                                 }
44                         } );
45                 },
46                 function () { return oTable.fnSettings() == mPass; }
47         );
48         
49         
50         oTest.fnTest( 
51                 "fnRowCallback called once on first draw",
52                 function () {
53                         oSession.fnRestore();
54                         
55                         mPass = 0;
56                         $('#example').dataTable( {
57                                 "fnDrawCallback": function ( ) {
58                                         mPass++;
59                                 }
60                         } );
61                 },
62                 function () { return mPass == 1; }
63         );
64         
65         oTest.fnTest( 
66                 "fnRowCallback called once on each draw there after as well",
67                 function () {
68                         $('#example_next').click();
69                         $('#example_next').click();
70                         $('#example_next').click();
71                 },
72                 function () { return mPass == 4; }
73         );
74         
75         
76         
77         
78         
79         oTest.fnComplete();
80 } );