summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/css-tables/bounding-box-computation-3.html
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/css/css-tables/bounding-box-computation-3.html')
-rw-r--r--testing/web-platform/tests/css/css-tables/bounding-box-computation-3.html86
1 files changed, 86 insertions, 0 deletions
diff --git a/testing/web-platform/tests/css/css-tables/bounding-box-computation-3.html b/testing/web-platform/tests/css/css-tables/bounding-box-computation-3.html
new file mode 100644
index 0000000000..188257af44
--- /dev/null
+++ b/testing/web-platform/tests/css/css-tables/bounding-box-computation-3.html
@@ -0,0 +1,86 @@
+<!doctype html>
+<script src='/resources/testharness.js'></script>
+<script src='/resources/testharnessreport.js'></script>
+<link rel='stylesheet' href='./support/base.css' />
+<link rel="help" href="https://drafts.csswg.org/css-tables-3/#bounding-box-assignment">
+<main>
+
+ <h1>Bounding box computation</h1>
+ <p>Checks that all table-internal boxes are positioned correctly</p>
+
+ <hr/>
+ <p>The first table-row-group should have width and height 0:</p>
+ <p>The first tbody is empty, and should return an height of 0px. The second one should be 100px tall.</p>
+ <x-table style="border-spacing: 10px; background: yellow; position: relative;">
+ <x-tbody></x-tbody>
+ <x-tbody>
+ <x-tr>
+ <x-td style="padding: 50px; background: blue;"></x-td>
+ </x-tr>
+ </x-tbody>
+ </x-table>
+
+</main>
+
+<script>
+ while(true) {
+ var xtd = document.querySelector('x-td[rowspan], x-td[colspan]'); if(!xtd) break;
+ var td = document.createElement('td'); for(var i = xtd.attributes.length; i--;) { td.setAttribute(xtd.attributes[i].name,xtd.attributes[i].value) }
+ xtd.parentNode.replaceChild(td,xtd);
+ }
+
+ var i = 1;
+ generate_tests(assert_equals, [
+ [
+ "Control test: Table width is 120px",
+ document.querySelector("x-table:nth-of-type("+(i++)+")").offsetWidth,
+ 120
+ ],
+ [
+ "Control test: Table height is 120px",
+ document.querySelector("x-table:nth-of-type("+(i-1)+")").offsetHeight,
+ 120
+ ],
+ [
+ "First (empty) table-row-group is 0px wide",
+ document.querySelector("x-table:nth-of-type("+(i-1)+") x-tbody").offsetWidth,
+ 0
+ ],
+ [
+ "First (empty) table-row-group is 0px tall",
+ document.querySelector("x-table:nth-of-type("+(i-1)+") x-tbody").offsetHeight,
+ 0
+ ],
+ [
+ "First (empty) table-row-group should be located at 10px left",
+ document.querySelector("x-table:nth-of-type("+(i-1)+") x-tbody").offsetLeft,
+ 10
+ ],
+ [
+ "First (empty) table-row-group should be located at 10px top",
+ document.querySelector("x-table:nth-of-type("+(i-1)+") x-tbody").offsetTop,
+ 10
+ ],
+ [
+ "Second table-row-group is 100px wide",
+ document.querySelector("x-table:nth-of-type("+(i-1)+") x-tbody + x-tbody").offsetWidth,
+ 100
+ ],
+ [
+ "Second table-row-group is 100px tall",
+ document.querySelector("x-table:nth-of-type("+(i-1)+") x-tbody + x-tbody").offsetHeight,
+ 100
+ ],
+ [
+ "Second table-row-group should be located at 10px left",
+ document.querySelector("x-table:nth-of-type("+(i-1)+") x-tbody + x-tbody").offsetLeft,
+ 10
+ ],
+ [
+ "Second table-row-group should be located at 10px top",
+ document.querySelector("x-table:nth-of-type("+(i-1)+") x-tbody + x-tbody").offsetTop,
+ 10
+ ],
+ ])
+
+</script>