1
0
mirror of https://github.com/DataTables/DataTables.git synced 2024-12-12 00:08:48 +01:00
DataTables/media/unit_testing/tests_onhold/4_server-side/fnServerData.js

68 lines
1.4 KiB
JavaScript
Raw Normal View History

// DATA_TEMPLATE: empty_table
oTest.fnStart( "fnServerData for SSP sourced data" );
$(document).ready( function () {
var mPass;
oTest.fnTest(
"Argument length",
function () {
$('#example').dataTable( {
"bServerSide": true,
"sAjaxSource": "../data_sources/param.php",
"fnServerData": function () {
mPass = arguments.length;
}
} );
},
function () { return mPass == 4; }
);
oTest.fnTest(
"Url",
function () {
$('#example').dataTable( {
"bDestroy": true,
"bServerSide": true,
"sAjaxSource": "../data_sources/param.php",
"fnServerData": function (sUrl, aoData, fnCallback, oSettings) {
mPass = sUrl == "../data_sources/param.php";
}
} );
},
function () { return mPass; }
);
oTest.fnTest(
"Data array",
function () {
$('#example').dataTable( {
"bDestroy": true,
"bServerSide": true,
"sAjaxSource": "../data_sources/param.php",
"fnServerData": function (sUrl, aoData, fnCallback, oSettings) {
mPass = aoData.length==35;
}
} );
},
function () { return mPass; }
);
oTest.fnTest(
"Callback function",
function () {
$('#example').dataTable( {
"bDestroy": true,
"bServerSide": true,
"sAjaxSource": "../data_sources/param.php",
"fnServerData": function (sUrl, aoData, fnCallback, oSettings) {
mPass = typeof fnCallback == 'function';
}
} );
},
function () { return mPass; }
);
oTest.fnComplete();
} );