[6286] | 1 | // DATA_TEMPLATE: js_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 | "aaData": gaaData |
---|
| 10 | } ); |
---|
| 11 | var oSettings = oTable.fnSettings(); |
---|
| 12 | var mPass; |
---|
| 13 | |
---|
| 14 | oTest.fnTest( |
---|
| 15 | "Default should be null", |
---|
| 16 | null, |
---|
| 17 | function () { return oSettings.fnInitComplete == null; } |
---|
| 18 | ); |
---|
| 19 | |
---|
| 20 | |
---|
| 21 | oTest.fnTest( |
---|
| 22 | "One argument passed (for DOM!)", |
---|
| 23 | function () { |
---|
| 24 | oSession.fnRestore(); |
---|
| 25 | |
---|
| 26 | mPass = -1; |
---|
| 27 | $('#example').dataTable( { |
---|
| 28 | "aaData": gaaData, |
---|
| 29 | "fnInitComplete": function ( ) { |
---|
| 30 | mPass = arguments.length; |
---|
| 31 | } |
---|
| 32 | } ); |
---|
| 33 | }, |
---|
| 34 | function () { return mPass == 1; } |
---|
| 35 | ); |
---|
| 36 | |
---|
| 37 | |
---|
| 38 | oTest.fnTest( |
---|
| 39 | "That one argument is the settings object", |
---|
| 40 | function () { |
---|
| 41 | oSession.fnRestore(); |
---|
| 42 | |
---|
| 43 | oTable = $('#example').dataTable( { |
---|
| 44 | "aaData": gaaData, |
---|
| 45 | "fnInitComplete": function ( oSettings ) { |
---|
| 46 | mPass = oSettings; |
---|
| 47 | } |
---|
| 48 | } ); |
---|
| 49 | }, |
---|
| 50 | function () { return oTable.fnSettings() == mPass; } |
---|
| 51 | ); |
---|
| 52 | |
---|
| 53 | |
---|
| 54 | oTest.fnTest( |
---|
| 55 | "fnInitComplete called once on first draw", |
---|
| 56 | function () { |
---|
| 57 | oSession.fnRestore(); |
---|
| 58 | |
---|
| 59 | mPass = 0; |
---|
| 60 | $('#example').dataTable( { |
---|
| 61 | "aaData": gaaData, |
---|
| 62 | "fnInitComplete": function ( ) { |
---|
| 63 | mPass++; |
---|
| 64 | } |
---|
| 65 | } ); |
---|
| 66 | }, |
---|
| 67 | function () { return mPass == 1; } |
---|
| 68 | ); |
---|
| 69 | |
---|
| 70 | oTest.fnTest( |
---|
| 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 | |
---|
| 82 | oTest.fnComplete(); |
---|
| 83 | } ); |
---|