summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/css-tables/html-to-css-mapping-1.html
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
commit36d22d82aa202bb199967e9512281e9a53db42c9 (patch)
tree105e8c98ddea1c1e4784a60a5a6410fa416be2de /testing/web-platform/tests/css/css-tables/html-to-css-mapping-1.html
parentInitial commit. (diff)
downloadfirefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz
firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip
Adding upstream version 115.7.0esr.upstream/115.7.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/css/css-tables/html-to-css-mapping-1.html')
-rw-r--r--testing/web-platform/tests/css/css-tables/html-to-css-mapping-1.html63
1 files changed, 63 insertions, 0 deletions
diff --git a/testing/web-platform/tests/css/css-tables/html-to-css-mapping-1.html b/testing/web-platform/tests/css/css-tables/html-to-css-mapping-1.html
new file mode 100644
index 0000000000..c29fd1db9d
--- /dev/null
+++ b/testing/web-platform/tests/css/css-tables/html-to-css-mapping-1.html
@@ -0,0 +1,63 @@
+<!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/#fixup">
+<link rel="help" href="https://drafts.csswg.org/css-tables-3/#mapping">
+<main>
+
+ <h1>HTML-2-CSS Mapping</h1>
+ <p>Checks that browsers implement properly the html2css stylesheet (rules without attributes)</p>
+
+ <hr/>
+ <p>You should see a 5 2px blue square here, separated by 2px each:</p>
+ <p>Because of the lack of the table element, border-spacing is 0; padding on each td should be 1px on each side. 1px*2*5=10px.</p>
+ <div><table><tbody style="background: blue; height: 2px"><tr><td></td><td></td><td></td><td></td><td></tr></tbody></table></div>
+
+ <hr/>
+ <p>You should see a 10px blue square here:</p>
+ <p>Because of the lack of the table element, border-spacing is 0; padding on each td should be 1px on each side. 1px*2*5=10px.</p>
+ <div><table class="to-remove"><tbody style="background: blue; height: 10px"><tr><td></td><td></td><td></td><td></td><td></tr></tbody></table></div>
+
+ <hr/>
+ <p>You should see a 12px blue square here:</p>
+ <p>The table has the background; x-td elements have no padding, only the border-spacing remains. 6*2px=12px.</p>
+ <div><table style="height: 12px; background: blue;" class="no-td"><tbody><tr><td></td><td></td><td></td><td></td><td></tr></tbody></table></div>
+
+ <hr/>
+ <p>You shouldn't see anything here:</p>
+ <p>The table has the background but is empty; it does not apply border-spacing in this case.</p>
+ <div><table style="height: 2px; background: red"></table></div>
+
+ <script>void function() { var table; while(table = document.querySelector('.to-remove')) table.parentNode.replaceChild(table.firstChild,table) }();</script>
+ <script>void function() { var td; while(td = document.querySelector('table.no-td td')) td.parentNode.replaceChild(document.createElement('x-td'),td) }();</script>
+
+</main>
+
+<script>
+
+ var i = 1;
+ generate_tests(assert_equals, [
+ [
+ "HTML -> CSS Mapping is applied correctly on proper table markup (border-spacing, padding)",
+ document.querySelector("main > div:nth-of-type("+(i++)+") table").offsetWidth,
+ 22
+ ],
+ [
+ "HTML -> CSS Mapping is applied correctly on improper table markup (no table => no border-spacing, but padding)",
+ document.querySelector("main > div:nth-of-type("+(i++)+") tbody").offsetWidth,
+ 10
+ ],
+ [
+ "HTML -> CSS Mapping is applied correctly on improper table markup (no td => border-spacing, but no padding)",
+ document.querySelector("main > div:nth-of-type("+(i++)+") table").offsetWidth,
+ 12
+ ],
+ [
+ "HTML -> CSS Mapping is applied correctly on empty table markup (no content => no border-spacing, no padding)",
+ document.querySelector("main > div:nth-of-type("+(i++)+") table").offsetWidth,
+ 0
+ ],
+ ])
+
+</script>