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 / fnInitComplete.js
1 // DATA_TEMPLATE: dom_data
2 oTest.fnStart( "fnInitComplete" );
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.fnInitComplete == null; }
16         );
17         
18         
19         oTest.fnTest( 
20                 "Two arguments passed",
21                 function () {
22                         oSession.fnRestore();
23                         
24                         mPass = -1;
25                         $('#example').dataTable( {
26                                 "fnInitComplete": function ( ) {
27                                         mPass = arguments.length===2 && arguments[1]===undefined;
28                                 }
29                         } );
30                 },
31                 function () { return mPass; }
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                                 "fnInitComplete": function ( oSettings ) {
42                                         mPass = oSettings;
43                                 }
44                         } );
45                 },
46                 function () { return oTable.fnSettings() == mPass; }
47         );
48         
49         
50         oTest.fnTest( 
51                 "fnInitComplete called once on first draw",
52                 function () {
53                         oSession.fnRestore();
54                         
55                         mPass = 0;
56                         $('#example').dataTable( {
57                                 "fnInitComplete": function ( ) {
58                                         mPass++;
59                                 }
60                         } );
61                 },
62                 function () { return mPass == 1; }
63         );
64         
65         oTest.fnTest( 
66                 "fnInitComplete never called there after",
67                 function () {
68                         $('#example_next').click();
69                         $('#example_next').click();
70                         $('#example_next').click();
71                 },
72                 function () { return mPass == 1; }
73         );
74         
75         
76         oTest.fnWaitTest( 
77                 "10 rows in the table on complete",
78                 function () {
79                         oSession.fnRestore();
80                         
81                         mPass = 0;
82                         $('#example').dataTable( {
83                                 "fnInitComplete": function ( ) {
84                                         mPass = $('#example tbody tr').length;
85                                 }
86                         } );
87                 },
88                 function () { return mPass == 10; }
89         );
90         
91         
92         
93         oTest.fnComplete();
94 } );