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

Contents of /misc/horsensspejder-web/jquery/DataTables-1.9.4/media/unit_testing/tests_onhold/3_ajax/fnDrawCallback.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, 3 months ago) by torben
File MIME type: application/javascript
File size: 2123 byte(s)
initial import
1 // DATA_TEMPLATE: empty_table
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 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt"
10 } );
11 var oSettings = oTable.fnSettings();
12 var mPass, bInit;
13
14 oTest.fnWaitTest(
15 "Default should be null",
16 null,
17 function () { return oSettings.fnDrawCallback == null; }
18 );
19
20
21 oTest.fnWaitTest(
22 "One argument passed",
23 function () {
24 oSession.fnRestore();
25
26 mPass = -1;
27 bInit = false;
28 $('#example').dataTable( {
29 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
30 "fnDrawCallback": function ( ) {
31 mPass = arguments.length;
32 },
33 "fnInitComplete": function () {
34 bInit = true;
35 }
36 } );
37 },
38 function () { return mPass == 1 && bInit; }
39 );
40
41
42 oTest.fnWaitTest(
43 "That one argument is the settings object",
44 function () {
45 oSession.fnRestore();
46
47 bInit = false;
48 oTable = $('#example').dataTable( {
49 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
50 "fnDrawCallback": function ( oSettings ) {
51 mPass = oSettings;
52 },
53 "fnInitComplete": function () {
54 bInit = true;
55 }
56 } );
57 },
58 function () { return oTable.fnSettings() == mPass && bInit; }
59 );
60
61
62 /* The draw callback is called once for the init and then when the data is added */
63 oTest.fnWaitTest(
64 "fnRowCallback called once on first draw",
65 function () {
66 oSession.fnRestore();
67
68 mPass = 0;
69 bInit = false;
70 $('#example').dataTable( {
71 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
72 "fnDrawCallback": function ( ) {
73 mPass++;
74 },
75 "fnInitComplete": function () {
76 bInit = true;
77 }
78 } );
79 },
80 function () { return mPass == 2 && bInit; }
81 );
82
83 oTest.fnWaitTest(
84 "fnRowCallback called once on each draw there after as well",
85 function () {
86 $('#example_next').click();
87 $('#example_next').click();
88 $('#example_next').click();
89 },
90 function () { return mPass == 5; }
91 );
92
93
94
95
96
97 oTest.fnComplete();
98 } );

  ViewVC Help
Powered by ViewVC 1.1.20