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%2FaoColumns.bVisible2.js;fp=webapp%2Fresources%2Fdatatables-1.9.4%2Fmedia%2Funit_testing%2Ftests_onhold%2F1_dom%2FaoColumns.bVisible2.js;h=5dbe214f652caf6077d8c5d32f7fae2b94c4f9d5;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/aoColumns.bVisible2.js b/webapp/resources/datatables-1.9.4/media/unit_testing/tests_onhold/1_dom/aoColumns.bVisible2.js new file mode 100755 index 0000000..5dbe214 --- /dev/null +++ b/webapp/resources/datatables-1.9.4/media/unit_testing/tests_onhold/1_dom/aoColumns.bVisible2.js @@ -0,0 +1,268 @@ +// DATA_TEMPLATE: complex_header_2 +oTest.fnStart( "aoColumns.bVisible with complex headers" ); + +$(document).ready( function () { + /* Check the default */ + var oTable = $('#example').dataTable(); + var oSettings = oTable.fnSettings(); + + oTest.fnTest( + "All columns are visible by default", + null, + function () { return $('#example tbody tr:eq(0) td').length == 5; } + ); + + oTest.fnTest( + "Hide the first column", + function () { + oSession.fnRestore(); + $('#example').dataTable( { + "aoColumns": [ + { "bVisible": false }, + null, + null, + null, + null + ] + } ); + }, + function () { return $('#example tbody tr:eq(0) td').length == 4; } + ); + + oTest.fnTest( + "First cell is '2' - first column hidden", + null, + function () { return $('#example thead tr:eq(0) th:eq(0)').html() == "2"; } + ); + + oTest.fnTest( + "First cell has colspan of 3", + null, + function () { return $('#example thead tr:eq(0) th:eq(0)')[0].getAttribute('colspan') == 3; } + ); + + oTest.fnTest( + "First cell has rowspan of 2", + null, + function () { return $('#example thead tr:eq(0) th:eq(0)')[0].getAttribute('rowspan') == 2; } + ); + + oTest.fnTest( + "First cell in last column is '11'", + null, + function () { return $('#example thead tr:eq(4) th:eq(0)').html() == 11; } + ); + + oTest.fnTest( + "First cell in last column has been truncated to one column", + null, + function () { return $('#example thead tr:eq(4) th:eq(0)')[0].getAttribute('colspan') == 1; } + ); + + + oTest.fnTest( + "Hide the second column", + function () { + oSession.fnRestore(); + $('#example').dataTable( { + "aoColumns": [ + null, + { "bVisible": false }, + null, + null, + null + ] + } ); + }, + function () { return $('#example tbody tr:eq(0) td').length == 4; } + ); + + oTest.fnTest( + "First cell is '1' - second column hidden", + null, + function () { return $('#example thead tr:eq(0) th:eq(0)').html() == "1"; } + ); + + oTest.fnTest( + "Second cell is '2' - second column hidden", + null, + function () { return $('#example thead tr:eq(0) th:eq(1)').html() == "2"; } + ); + + oTest.fnTest( + "First cell in fourth row is '10' (visibly the first) - second column hidden", + null, + function () { return $('#example thead tr:eq(3) th:eq(0)').html() == "10"; } + ); + + oTest.fnTest( + "First cell has colspan of 1", + null, + function () { return $('#example thead tr:eq(0) th:eq(0)')[0].getAttribute('colspan') == 1; } + ); + + oTest.fnTest( + "Second cell has colspan of 2", + null, + function () { return $('#example thead tr:eq(0) th:eq(1)')[0].getAttribute('colspan') == 2; } + ); + + oTest.fnTest( + "First cell has rowspan of 1", + null, + function () { return $('#example thead tr:eq(0) th:eq(0)')[0].getAttribute('rowspan') == 1; } + ); + + oTest.fnTest( + "Second cell has rowspan of 2", + null, + function () { return $('#example thead tr:eq(0) th:eq(1)')[0].getAttribute('rowspan') == 2; } + ); + + oTest.fnTest( + "First cell in last column is '11'", + null, + function () { return $('#example thead tr:eq(4) th:eq(0)').html() == 11; } + ); + + oTest.fnTest( + "First cell in last column has been truncated to one column", + null, + function () { return $('#example thead tr:eq(4) th:eq(0)')[0].getAttribute('colspan') == 1; } + ); + + + oTest.fnTest( + "Hide the first two columns", + function () { + oSession.fnRestore(); + $('#example').dataTable( { + "aoColumns": [ + { "bVisible": false }, + { "bVisible": false }, + null, + null, + null + ] + } ); + }, + function () { return $('#example tbody tr:eq(0) td').length == 3; } + ); + + oTest.fnTest( + "First cell is '2' - first two columns hidden", + null, + function () { return $('#example thead tr:eq(0) th:eq(0)').html() == "2"; } + ); + + oTest.fnTest( + "Second cell is '3' - first two columns hidden", + null, + function () { return $('#example thead tr:eq(0) th:eq(1)').html() == "3"; } + ); + + oTest.fnTest( + "First cell in third row is '6' - first two columns hidden", + null, + function () { return $('#example thead tr:eq(2) th:eq(0)').html() == "6"; } + ); + + oTest.fnTest( + "First cell has colspan of 2", + null, + function () { return $('#example thead tr:eq(0) th:eq(0)')[0].getAttribute('colspan') == 2; } + ); + + oTest.fnTest( + "First cell has rowspan of 2", + null, + function () { return $('#example thead tr:eq(0) th:eq(0)')[0].getAttribute('rowspan') == 2; } + ); + + oTest.fnTest( + "Second cell has rowspan of 1", + null, + function () { return $('#example thead tr:eq(0) th:eq(1)')[0].getAttribute('rowspan') == 1; } + ); + + oTest.fnTest( + "First cell in last column is '12'", + null, + function () { return $('#example thead tr:eq(4) th:eq(0)').html() == 12; } + ); + + + oTest.fnTest( + "Hide the third column", + function () { + oSession.fnRestore(); + $('#example').dataTable( { + "aoColumns": [ + null, + null, + { "bVisible": false }, + null, + null + ] + } ); + }, + function () { return $('#example tbody tr:eq(0) td').length == 4; } + ); + + oTest.fnTest( + "First cell is '1' - third column hidden", + null, + function () { return $('#example thead tr:eq(0) th:eq(0)').html() == "1"; } + ); + + oTest.fnTest( + "Second cell is '2' - third column hidden", + null, + function () { return $('#example thead tr:eq(0) th:eq(1)').html() == "2"; } + ); + + oTest.fnTest( + "First cell (visible second) in third row is '6' - third column hidden", + null, + function () { return $('#example thead tr:eq(2) th:eq(0)').html() == "6"; } + ); + + oTest.fnTest( + "Second cell has colspan of 2", + null, + function () { return $('#example thead tr:eq(0) th:eq(1)')[0].getAttribute('colspan') == 2; } + ); + + oTest.fnTest( + "Second cell has rowspan of 2", + null, + function () { return $('#example thead tr:eq(0) th:eq(1)')[0].getAttribute('rowspan') == 2; } + ); + + oTest.fnTest( + "Third row first cell (second visible) colspan is 1", + null, + function () { return $('#example thead tr:eq(2) th:eq(0)')[0].getAttribute('colspan') == 1; } + ); + + oTest.fnTest( + "Third row second cell (third visible) value is 7", + null, + function () { return $('#example thead tr:eq(2) th:eq(1)').html() == "7"; } + ); + + oTest.fnTest( + "Third row second cell (third visible) colspan is 1", + null, + function () { return $('#example thead tr:eq(2) th:eq(1)')[0].getAttribute('colspan') == 1; } + ); + + oTest.fnTest( + "Third row second cell (third visible) rowspan is 3", + null, + function () { return $('#example thead tr:eq(2) th:eq(1)')[0].getAttribute('rowspan') == 3; } + ); + + + oTest.fnComplete(); +} ); \ No newline at end of file