1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
|
// DATA_TEMPLATE: dom_data
oTest.fnStart( "Odd and even are stripped from all rows" );
$(document).ready( function () {
$('table tbody tr').addClass( 'odd even' );
$('table.display').dataTable();
oTest.fnTest(
"Odd is applied to exactly 5 rows",
null,
function () {
return $('#example tbody tr.odd').length === 5;
}
);
oTest.fnTest(
"Even is applied to exactly 5 rows",
null,
function () {
return $('#example tbody tr.even').length === 5;
}
);
oTest.fnTest(
"First row is odd",
null,
function () {
return $('#example tbody tr:eq(0)').hasClass('odd') &&
! $('#example tbody tr:eq(0)').hasClass('even');
}
);
oTest.fnTest(
"Second row is even",
null,
function () {
return $('#example tbody tr:eq(1)').hasClass('even') &&
! $('#example tbody tr:eq(1)').hasClass('odd');
}
);
oTest.fnTest(
"Third row is odd",
null,
function () {
return $('#example tbody tr:eq(2)').hasClass('odd') &&
! $('#example tbody tr:eq(2)').hasClass('even');
}
);
oTest.fnTest(
"Fourth row is even",
null,
function () {
return $('#example tbody tr:eq(3)').hasClass('even') &&
! $('#example tbody tr:eq(3)').hasClass('odd');
}
);
oTest.fnComplete();
} );
|