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%2FbProcessing.js;fp=webapp%2Fresources%2Fdatatables-1.9.4%2Fmedia%2Funit_testing%2Ftests_onhold%2F6_delayed_rendering%2FbProcessing.js;h=4193c701c32c992777c95badcfc234e4a16e513f;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/bProcessing.js b/webapp/resources/datatables-1.9.4/media/unit_testing/tests_onhold/6_delayed_rendering/bProcessing.js new file mode 100644 index 0000000..4193c70 --- /dev/null +++ b/webapp/resources/datatables-1.9.4/media/unit_testing/tests_onhold/6_delayed_rendering/bProcessing.js @@ -0,0 +1,106 @@ +// DATA_TEMPLATE: empty_table +oTest.fnStart( "bProcessing" ); + +/* It's actually a bit hard to set this one due to the fact that it will only be shown + * when DataTables is doing some kind of processing. The server-side processing is a bit + * better to test this than here - so we just the interal functions to enable it and check + * that it is available + */ + +$(document).ready( function () { + /* Check the default */ + var oTable = $('#example').dataTable( { + "sAjaxSource": "../../../examples/ajax/sources/arrays.txt", + "bDeferRender": true + } ); + var oSettings = oTable.fnSettings(); + + oTest.fnWaitTest( + "Processing is off by default", + null, + function () { return oSettings.oFeatures.bProcessing == false; } + ); + + oTest.fnWaitTest( + "Processing div is not in the DOM", + function () { oTable.oApi._fnProcessingDisplay( oSettings, true ); }, + function () { return document.getElementById('example_processing') == null; } + ); + + oTest.fnWaitTest( + "Processing div cannot be shown", + function () { oTable.oApi._fnProcessingDisplay( oSettings, true ); }, + function () { return document.getElementById('example_processing') == null; } + ); + + oTest.fnWaitTest( + "Processing div cannot be hidden", + function () { oTable.oApi._fnProcessingDisplay( oSettings, false ); }, + function () { return document.getElementById('example_processing') == null; } + ); + + + /* Check can disable */ + oTest.fnWaitTest( + "Processing can be enabled", + function () { + oSession.fnRestore(); + oTable = $('#example').dataTable( { + "sAjaxSource": "../../../examples/ajax/sources/arrays.txt", + "bDeferRender": true, + "bProcessing": true + } ); + oSettings = oTable.fnSettings(); + }, + function () { return oSettings.oFeatures.bProcessing == true; } + ); + + oTest.fnWaitTest( + "Processing div is in the DOM", + function () { oTable.oApi._fnProcessingDisplay( oSettings, true ); }, + function () { return document.getElementById('example_processing'); } + ); + + oTest.fnWaitTest( + "Processing div is hidden by default", + function () { oTable.oApi._fnProcessingDisplay( oSettings, true ); }, + function () { return document.getElementById('example_processing').style.visibility = "hidden"; } + ); + + oTest.fnWaitTest( + "Processing div can be shown", + function () { oTable.oApi._fnProcessingDisplay( oSettings, true ); }, + function () { return document.getElementById('example_processing').style.visibility = "visible"; } + ); + + oTest.fnWaitTest( + "Processing div can be hidden", + function () { oTable.oApi._fnProcessingDisplay( oSettings, false ); }, + function () { return document.getElementById('example_processing').style.visibility = "hidden"; } + ); + + /* Enable makes no difference */ + oTest.fnWaitTest( + "Processing disabled override", + function () { + oSession.fnRestore(); + oTable = $('#example').dataTable( { + "sAjaxSource": "../../../examples/ajax/sources/arrays.txt", + "bDeferRender": true, + "bProcessing": false + } ); + oSettings = oTable.fnSettings(); + }, + function () { return oSettings.oFeatures.bProcessing == false; } + ); + + oTest.fnWaitTest( + "Processing div is not in the DOM", + function () { oTable.oApi._fnProcessingDisplay( oSettings, true ); }, + function () { return document.getElementById('example_processing') == null; } + ); + + + + oTest.fnComplete(); +} ); \ No newline at end of file