X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=webapp%2Fresources%2Fdatatables-1.9.4%2Fmedia%2Funit_testing%2Ftests_onhold%2F6_delayed_rendering%2FfnServerData.js;fp=webapp%2Fresources%2Fdatatables-1.9.4%2Fmedia%2Funit_testing%2Ftests_onhold%2F6_delayed_rendering%2FfnServerData.js;h=5c4b31917bf77bcf33cfddc268032718909eb613;hb=9bb6ee99ca7f738fac1087190b5481b8fe6e8d9f;hp=0000000000000000000000000000000000000000;hpb=2e3f6b76be585306f1003d849831840c0adb3360;p=proteocache.git diff --git a/webapp/resources/datatables-1.9.4/media/unit_testing/tests_onhold/6_delayed_rendering/fnServerData.js b/webapp/resources/datatables-1.9.4/media/unit_testing/tests_onhold/6_delayed_rendering/fnServerData.js new file mode 100644 index 0000000..5c4b319 --- /dev/null +++ b/webapp/resources/datatables-1.9.4/media/unit_testing/tests_onhold/6_delayed_rendering/fnServerData.js @@ -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