Mercurial > repos > saskia-hiltemann > ireport
diff DataTables-1.9.4/media/unit_testing/tests_onhold/6_delayed_rendering/fnServerData.js @ 0:ac5f9272033b draft
first upload
author | saskia-hiltemann |
---|---|
date | Tue, 01 Jul 2014 11:42:23 -0400 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/DataTables-1.9.4/media/unit_testing/tests_onhold/6_delayed_rendering/fnServerData.js Tue Jul 01 11:42:23 2014 -0400 @@ -0,0 +1,68 @@ +// DATA_TEMPLATE: empty_table +oTest.fnStart( "fnServerData for Ajax sourced data" ); + +$(document).ready( function () { + var mPass; + + oTest.fnTest( + "Argument length", + function () { + $('#example').dataTable( { + "sAjaxSource": "../../../examples/ajax/sources/arrays.txt", + "bDeferRender": true, + "fnServerData": function () { + mPass = arguments.length; + } + } ); + }, + function () { return mPass == 4; } + ); + + oTest.fnTest( + "Url", + function () { + $('#example').dataTable( { + "bDestroy": true, + "sAjaxSource": "../../../examples/ajax/sources/arrays.txt", + "bDeferRender": true, + "fnServerData": function (sUrl, aoData, fnCallback, oSettings) { + mPass = sUrl == "../../../examples/ajax/sources/arrays.txt"; + } + } ); + }, + function () { return mPass; } + ); + + oTest.fnTest( + "Data array", + function () { + $('#example').dataTable( { + "bDestroy": true, + "sAjaxSource": "../../../examples/ajax/sources/arrays.txt", + "bDeferRender": true, + "fnServerData": function (sUrl, aoData, fnCallback, oSettings) { + mPass = aoData.length==0; + } + } ); + }, + function () { return mPass; } + ); + + oTest.fnTest( + "Callback function", + function () { + $('#example').dataTable( { + "bDestroy": true, + "sAjaxSource": "../../../examples/ajax/sources/arrays.txt", + "bDeferRender": true, + "fnServerData": function (sUrl, aoData, fnCallback, oSettings) { + mPass = typeof fnCallback == 'function'; + } + } ); + }, + function () { return mPass; } + ); + + + oTest.fnComplete(); +} ); \ No newline at end of file