X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=webapp%2Fresources%2Fdatatables-1.9.4%2Fmedia%2Funit_testing%2Ftests_onhold%2F1_dom%2FsDom.js;fp=webapp%2Fresources%2Fdatatables-1.9.4%2Fmedia%2Funit_testing%2Ftests_onhold%2F1_dom%2FsDom.js;h=165071c642e360017b2b2e206cd7dc433ca0c696;hb=9bb6ee99ca7f738fac1087190b5481b8fe6e8d9f;hp=0000000000000000000000000000000000000000;hpb=2e3f6b76be585306f1003d849831840c0adb3360;p=proteocache.git diff --git a/webapp/resources/datatables-1.9.4/media/unit_testing/tests_onhold/1_dom/sDom.js b/webapp/resources/datatables-1.9.4/media/unit_testing/tests_onhold/1_dom/sDom.js new file mode 100755 index 0000000..165071c --- /dev/null +++ b/webapp/resources/datatables-1.9.4/media/unit_testing/tests_onhold/1_dom/sDom.js @@ -0,0 +1,319 @@ +// DATA_TEMPLATE: dom_data +oTest.fnStart( "sDom" ); + +/* This is going to be brutal on the browser! There is a lot that can be tested here... */ + +$(document).ready( function () { + /* Check the default */ + var oTable = $('#example').dataTable(); + var oSettings = oTable.fnSettings(); + + oTest.fnTest( + "Default DOM varaible", + null, + function () { return oSettings.sDom == "lfrtip"; } + ); + + oTest.fnTest( + "Default DOM in document", + null, + function () { + var nNodes = $('#demo div, #demo table'); + var nWrapper = document.getElementById('example_wrapper'); + var nLength = document.getElementById('example_length'); + var nFilter = document.getElementById('example_filter'); + var nInfo = document.getElementById('example_info'); + var nPaging = document.getElementById('example_paginate'); + var nTable = document.getElementById('example'); + + var bReturn = + nNodes[0] == nWrapper && + nNodes[1] == nLength && + nNodes[2] == nFilter && + nNodes[3] == nTable && + nNodes[4] == nInfo && + nNodes[5] == nPaging; + return bReturn; + } + ); + + oTest.fnTest( + "Check example 1 in code propagates", + function () { + oSession.fnRestore(); + oTable = $('#example').dataTable( { + "sDom": '<"wrapper"flipt>' + } ); + oSettings = oTable.fnSettings(); + }, + function () { return oSettings.sDom == '<"wrapper"flipt>'; } + ); + + oTest.fnTest( + "Check example 1 in DOM", + null, + function () { + var jqNodes = $('#demo div, #demo table'); + var nNodes = []; + + /* Strip the paging nodes */ + for ( var i=0, iLen=jqNodes.length ; iip>' + } ); + }, + function () { + var jqNodes = $('#demo div, #demo table'); + var nNodes = []; + var nCustomWrappers = [] + + /* Strip the paging nodes */ + for ( var i=0, iLen=jqNodes.length ; irti' + } ); + }, + function () { + return $('#test').length == 1; + } + ); + + oTest.fnTest( + "Element with an id and a class", + function () { + $('#example').dataTable( { + "bDestroy": true, + "sDom": '<"#test.classTest"lf>rti' + } ); + }, + function () { + return ($('#test').length == 1 && $('#test')[0].className == "classTest"); + } + ); + + oTest.fnTest( + "Element with just a class", + function () { + $('#example').dataTable( { + "bDestroy": true, + "sDom": '<"classTest"lf>rti' + } ); + }, + function () { + return ($('div.classTest').length == 1 ); + } + ); + + oTest.fnTest( + "Two elements with an id", + function () { + $('#example').dataTable( { + "bDestroy": true, + "sDom": '<"#test1"lf>rti<"#test2"lf>' + } ); + }, + function () { + return ($('#test1').length == 1 && $('#test2').length == 1); + } + ); + + oTest.fnTest( + "Two elements with an id and one with a class", + function () { + $('#example').dataTable( { + "bDestroy": true, + "sDom": '<"#test1"lf>rti<"#test2.classTest"lf>' + } ); + }, + function () { + return ($('#test1').length == 1 && $('#test2').length == 1 && $('div.classTest').length == 1); + } + ); + + + oTest.fnComplete(); +} ); \ No newline at end of file