| 1 |
// DATA_TEMPLATE: dom_data |
| 2 |
oTest.fnStart( "Every method validation" ); |
| 3 |
|
| 4 |
$(document).ready( function () { |
| 5 |
var test = 0; |
| 6 |
var table = $('#example').DataTable(); |
| 7 |
|
| 8 |
oTest.fnTest( |
| 9 |
"rows().every() will iterate for every row", |
| 10 |
function () { |
| 11 |
test = 0; |
| 12 |
|
| 13 |
table.rows().every( function () { |
| 14 |
test++; |
| 15 |
} ); |
| 16 |
}, |
| 17 |
function () { return test === 57; } |
| 18 |
); |
| 19 |
|
| 20 |
oTest.fnTest( |
| 21 |
"rows().every() will iterate for every row - to filter set", |
| 22 |
function () { |
| 23 |
test = 0; |
| 24 |
|
| 25 |
table.search( 'net' ).draw(); |
| 26 |
table.rows( { search: 'applied' } ).every( function () { |
| 27 |
test++; |
| 28 |
} ); |
| 29 |
}, |
| 30 |
function () { return test === 13; } |
| 31 |
); |
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
oTest.fnTest( |
| 36 |
"columns().every() will iterate for every column", |
| 37 |
function () { |
| 38 |
test = 0; |
| 39 |
|
| 40 |
table.search('').draw(); |
| 41 |
table.columns().every( function () { |
| 42 |
test++; |
| 43 |
} ); |
| 44 |
}, |
| 45 |
function () { return test === 5; } |
| 46 |
); |
| 47 |
|
| 48 |
oTest.fnTest( |
| 49 |
"columns().every() will iterate for every columns, regardless of options", |
| 50 |
function () { |
| 51 |
test = 0; |
| 52 |
|
| 53 |
table.search( 'net' ).draw(); |
| 54 |
table.columns( { search: 'applied' } ).every( function () { |
| 55 |
test++; |
| 56 |
} ); |
| 57 |
}, |
| 58 |
function () { return test === 5; } |
| 59 |
); |
| 60 |
|
| 61 |
oTest.fnTest( |
| 62 |
"columns().every()'s execution context has the selector options applied", |
| 63 |
function () { |
| 64 |
test = 0; |
| 65 |
|
| 66 |
table.columns( { search: 'applied' } ).every( function () { |
| 67 |
test = this.nodes().length; |
| 68 |
} ); |
| 69 |
}, |
| 70 |
function () { return test === 13; } |
| 71 |
); |
| 72 |
|
| 73 |
|
| 74 |
|
| 75 |
oTest.fnTest( |
| 76 |
"cells().every() will iterate for every cell", |
| 77 |
function () { |
| 78 |
test = 0; |
| 79 |
|
| 80 |
table.search('').draw(); |
| 81 |
table.cells().every( function () { |
| 82 |
test++; |
| 83 |
} ); |
| 84 |
}, |
| 85 |
function () { return test === 57*5; } |
| 86 |
); |
| 87 |
|
| 88 |
oTest.fnTest( |
| 89 |
"cells().every() will iterate for only filtered cells for options", |
| 90 |
function () { |
| 91 |
test = 0; |
| 92 |
|
| 93 |
table.search( 'net' ).draw(); |
| 94 |
table.cells( { search: 'applied' } ).every( function () { |
| 95 |
test++; |
| 96 |
} ); |
| 97 |
}, |
| 98 |
function () { return test === 5*13; } |
| 99 |
); |
| 100 |
|
| 101 |
|
| 102 |
oTest.fnComplete(); |
| 103 |
} ); |