/[projects]/misc/horsensspejder-web/jquery/DataTables-1.9.4/media/unit_testing/tests_onhold/3_ajax/fnInitComplete.js
ViewVC logotype

Contents of /misc/horsensspejder-web/jquery/DataTables-1.9.4/media/unit_testing/tests_onhold/3_ajax/fnInitComplete.js

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2125 - (show annotations) (download) (as text)
Wed Mar 12 19:30:05 2014 UTC (10 years, 2 months ago) by torben
File MIME type: application/javascript
File size: 2112 byte(s)
initial import
1 // DATA_TEMPLATE: empty_table
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 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt"
10 } );
11 var oSettings = oTable.fnSettings();
12 var mPass;
13
14 oTest.fnWaitTest(
15 "Default should be null",
16 null,
17 function () { return oSettings.fnInitComplete == null; }
18 );
19
20
21 oTest.fnWaitTest(
22 "Two arguments passed (for Ajax!)",
23 function () {
24 oSession.fnRestore();
25
26 mPass = -1;
27 $('#example').dataTable( {
28 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
29 "fnInitComplete": function ( ) {
30 mPass = arguments.length;
31 }
32 } );
33 },
34 function () { return mPass == 2; }
35 );
36
37
38 oTest.fnWaitTest(
39 "That one argument is the settings object",
40 function () {
41 oSession.fnRestore();
42
43 oTable = $('#example').dataTable( {
44 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
45 "fnInitComplete": function ( oSettings ) {
46 mPass = oSettings;
47 }
48 } );
49 },
50 function () { return oTable.fnSettings() == mPass; }
51 );
52
53
54 oTest.fnWaitTest(
55 "fnInitComplete called once on first draw",
56 function () {
57 oSession.fnRestore();
58
59 mPass = 0;
60 $('#example').dataTable( {
61 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
62 "fnInitComplete": function ( ) {
63 mPass++;
64 }
65 } );
66 },
67 function () { return mPass == 1; }
68 );
69
70 oTest.fnWaitTest(
71 "fnInitComplete never called there after",
72 function () {
73 $('#example_next').click();
74 $('#example_next').click();
75 $('#example_next').click();
76 },
77 function () { return mPass == 1; }
78 );
79
80
81 oTest.fnWaitTest(
82 "10 rows in the table on complete",
83 function () {
84 oSession.fnRestore();
85
86 mPass = 0;
87 $('#example').dataTable( {
88 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
89 "fnInitComplete": function ( ) {
90 mPass = $('#example tbody tr').length;
91 }
92 } );
93 },
94 function () { return mPass == 10; }
95 );
96
97
98
99 oTest.fnComplete();
100 } );

  ViewVC Help
Powered by ViewVC 1.1.20