diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:22:09 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:22:09 +0000 |
commit | 43a97878ce14b72f0981164f87f2e35e14151312 (patch) | |
tree | 620249daf56c0258faa40cbdcf9cfba06de2a846 /testing/web-platform/tests/css/css-tables/visibility-collapse-rowspan-004-dynamic.html | |
parent | Initial commit. (diff) | |
download | firefox-43a97878ce14b72f0981164f87f2e35e14151312.tar.xz firefox-43a97878ce14b72f0981164f87f2e35e14151312.zip |
Adding upstream version 110.0.1.upstream/110.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/css/css-tables/visibility-collapse-rowspan-004-dynamic.html')
-rw-r--r-- | testing/web-platform/tests/css/css-tables/visibility-collapse-rowspan-004-dynamic.html | 176 |
1 files changed, 176 insertions, 0 deletions
diff --git a/testing/web-platform/tests/css/css-tables/visibility-collapse-rowspan-004-dynamic.html b/testing/web-platform/tests/css/css-tables/visibility-collapse-rowspan-004-dynamic.html new file mode 100644 index 0000000000..e6f65c450f --- /dev/null +++ b/testing/web-platform/tests/css/css-tables/visibility-collapse-rowspan-004-dynamic.html @@ -0,0 +1,176 @@ +<!doctype html> +<meta charset="utf-8"> +<script src='/resources/testharness.js'></script> +<script src='/resources/testharnessreport.js'></script> +<link rel='stylesheet' href='support/base.css' /> +<link rel="author" title="Joy Yu" href="mailto:joysyu@mit.edu"> +<link rel="help" href="https://drafts.csswg.org/css-tables-3/#visibility-collapse-cell-rendering"> +<style> +table { + border-spacing: 0; + border-collapse: collapse; +} +table td { + border: 1px solid blue; + padding: 5px; +} +</style> +<main> + <h1>Visibility collapse</h1> + <a href="https://drafts.csswg.org/css-tables-3/#visibility-collapse-cell-rendering">Spec</a> + <p> + Setting a row to visibility:collapse changes table height but not width. + </p> + <table id="one"> + <tr id="firstRowRef"> + <td rowspan="5" id="spanningCellRef">B<br>B<br>B<br>B<br>B</td> + <td>first row</td> + </tr> + <tr id="secondRowRef"> + <td>aaaa</td> + </tr> + <tr> + <td>bbbb</td> + </tr> + <tr id="fourthRowRef"> + <td>cccc</td> + </tr> + <tr id="fifthRowRef"> + <td>dddd</td> + </tr> + </table> + In the bottom table, a row is dynamically collapsed, made visible, and collapsed again. + <table id="two"> + <tr id="firstRow"> + <td rowspan="5" id="spanningCell">B<br>B<br>B<br>B<br>B</td> + <td>first row</td> + </tr> + <tr id="secondRow"> + <td>aaaa</td> + </tr> + <tr id="thirdRow"> + <td>bbbb</td> + </tr> + <tr id="fourthRow"> + <td>cccc</td> + </tr> + <tr id="fifthRow"> + <td>dddd</td> + </tr> + </table> +</main> + +<script> + function runTests() { + for (i = 0; i< tests.length; i++) { + test(function() + { + assert_equals.apply(this, tests[i]); + }, + tests[i][2]); + }; + } + document.getElementById("thirdRow").style.visibility = "collapse"; + tests = [ + [ + document.getElementById('two').offsetWidth, + document.getElementById('one').offsetWidth, + "spanning row visibility:collapse doesn't change table width" + ], + [ + document.getElementById('firstRow').offsetHeight, + document.getElementById('firstRowRef').offsetHeight, + "when third row is collapsed, first row stays the same height" + ], + [ + document.getElementById('secondRow').offsetHeight, + document.getElementById('secondRowRef').offsetHeight, + "when third row is collapsed, second row stays the same height" + ], + [ document.getElementById('thirdRow').offsetHeight, + 0, + "third row visibility:collapse makes row height 0" + ], + [ + document.getElementById('fourthRow').offsetHeight, + document.getElementById('fourthRowRef').offsetHeight, + "when third row is collapsed, fourth row stays the same height" + ], + [ + document.getElementById('spanningCell').offsetHeight, + document.getElementById('firstRow').offsetHeight + + document.getElementById('secondRow').offsetHeight + + document.getElementById('fourthRow').offsetHeight + + document.getElementById('fifthRow').offsetHeight, + "spanning cell shrinks to sum of remaining three rows' height" + ]]; + runTests(); + document.getElementById("thirdRow").style.visibility = "visible"; + tests = [ + [ + document.getElementById('firstRow').offsetHeight, + document.getElementById('firstRowRef').offsetHeight, + "when third row is visible, first row stays the same height" + ], + [ + document.getElementById('secondRow').offsetHeight, + document.getElementById('secondRowRef').offsetHeight, + "when third row is visible, second row stays the same height" + ], + [ document.getElementById('thirdRow').offsetHeight, + document.getElementById('secondRowRef').offsetHeight, + "when third row is visible, third row stays the same height" + ], + [ + document.getElementById('fourthRow').offsetHeight, + document.getElementById('fourthRowRef').offsetHeight, + "when third row is visible, fourth row stays the same height" + ], + [ + document.getElementById('fifthRow').offsetHeight, + document.getElementById('fifthRowRef').offsetHeight, + "when third row is visible, fifth row stays the same height" + ], + [ + document.getElementById('spanningCell').offsetHeight, + document.getElementById('spanningCellRef').offsetHeight, + "when third row is visible, spanning cell stays the same height" + ]]; + runTests(); + document.getElementById("thirdRow").style.visibility = "collapse"; + tests = [ + [ + document.getElementById('two').offsetWidth, + document.getElementById('one').offsetWidth, + "(2nd collapse) spanning row visibility:collapse doesn't change table width" + ], + [ + document.getElementById('firstRow').offsetHeight, + document.getElementById('firstRowRef').offsetHeight, + "when third row is collapsed again, first row stays the same height" + ], + [ + document.getElementById('secondRow').offsetHeight, + document.getElementById('secondRowRef').offsetHeight, + "when third row is collapsed again, second row stays the same height" + ], + [ document.getElementById('thirdRow').offsetHeight, + 0, + "(2nd collapse) third row visibility:collapse makes row height 0" + ], + [ + document.getElementById('fourthRow').offsetHeight, + document.getElementById('fourthRowRef').offsetHeight, + "when third row is collapsed again, fourth row stays the same height" + ], + [ + document.getElementById('spanningCell').offsetHeight, + document.getElementById('firstRow').offsetHeight + + document.getElementById('secondRow').offsetHeight + + document.getElementById('fourthRow').offsetHeight + + document.getElementById('fifthRow').offsetHeight, + "(2nd collapse) spanning cell shrinks to sum of remaining three rows' height" + ]]; + runTests(); +</script> +</html> |