1
0
mirror of https://github.com/DataTables/DataTables.git synced 2024-11-30 12:24:10 +01:00
DataTables/media/unit_testing/tests_onhold/3_ajax/iDisplayLength.js
2010-08-17 08:42:13 +01:00

81 lines
1.8 KiB
JavaScript

// DATA_TEMPLATE: empty_table
oTest.fnStart( "iDisplayLength" );
$(document).ready( function () {
/* Check the default */
$('#example').dataTable( {
"sAjaxSource": "../../../examples/examples_support/json_source.txt"
} );
oTest.fnWaitTest(
"Default length is ten",
null,
function () { return $('#example tbody tr').length == 10; }
);
oTest.fnWaitTest(
"Select menu shows 10",
null,
function () { return $('#example_length select').val() == 10; }
);
oTest.fnWaitTest(
"Set initial length to 25",
function () {
oSession.fnRestore();
$('#example').dataTable( {
"sAjaxSource": "../../../examples/examples_support/json_source.txt",
"iDisplayLength": 25
} );
},
function () { return $('#example tbody tr').length == 25; }
);
oTest.fnWaitTest(
"Select menu shows 25",
null,
function () { return $('#example_length select').val() == 25; }
);
oTest.fnWaitTest(
"Set initial length to 100",
function () {
oSession.fnRestore();
$('#example').dataTable( {
"sAjaxSource": "../../../examples/examples_support/json_source.txt",
"iDisplayLength": 100
} );
},
function () { return $('#example tbody tr').length == 57; }
);
oTest.fnWaitTest(
"Select menu shows 25",
null,
function () { return $('#example_length select').val() == 100; }
);
oTest.fnWaitTest(
"Set initial length to 23 (unknown select menu length)",
function () {
oSession.fnRestore();
$('#example').dataTable( {
"sAjaxSource": "../../../examples/examples_support/json_source.txt",
"iDisplayLength": 23
} );
},
function () { return $('#example tbody tr').length == 23; }
);
oTest.fnWaitTest(
"Select menu shows 10 (since 23 is unknow)",
null,
function () { return $('#example_length select').val() == 10; }
);
oTest.fnComplete();
} );