summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend.html
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
commit26a029d407be480d791972afb5975cf62c9360a6 (patch)
treef435a8308119effd964b339f76abb83a57c29483 /testing/web-platform/tests/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend.html
parentInitial commit. (diff)
downloadfirefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz
firefox-26a029d407be480d791972afb5975cf62c9360a6.zip
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend.html')
-rw-r--r--testing/web-platform/tests/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend.html62
1 files changed, 62 insertions, 0 deletions
diff --git a/testing/web-platform/tests/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend.html b/testing/web-platform/tests/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend.html
new file mode 100644
index 0000000000..1cda91f32b
--- /dev/null
+++ b/testing/web-platform/tests/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend.html
@@ -0,0 +1,62 @@
+<!doctype html>
+<title>The legend element</title>
+<script src=/resources/testharness.js></script>
+<script src=/resources/testharnessreport.js></script>
+<style>
+#ref {
+ display: block;
+ unicode-bidi: isolate;
+ padding-left: 2px;
+ padding-right: 2px;
+ /* TODO: uncomment this when these properties are widely supported
+ padding-inline-start: 2px; padding-inline-end: 2px;
+ */
+}
+</style>
+
+<legend id=in-body></legend>
+<fieldset>
+ <legend id=rendered-legend></legend>
+ <legend id=in-fieldset-second-child></legend>
+ <div><legend id=in-fieldset-descendant></legend></div>
+</fieldset>
+<div id=ref></div>
+
+<script>
+setup(() => {
+ self.legends = [].slice.call(document.querySelectorAll('legend'));
+ self.refStyle = getComputedStyle(document.getElementById('ref'));
+ self.props = ['display',
+ 'unicodeBidi',
+ 'marginTop',
+ 'marginRight',
+ 'marginBottom',
+ 'marginLeft',
+ 'paddingTop',
+ 'paddingRight',
+ 'paddingBottom',
+ 'paddingLeft',
+ 'overflow',
+ // Extra tests
+ 'height',
+ 'box-sizing',
+ ];
+});
+legends.forEach(legend => {
+ const testStyle = getComputedStyle(legend);
+ props.forEach(prop => {
+ test(() => {
+ assert_equals(testStyle[prop], refStyle[prop]);
+ }, `${legend.id}: ${prop}`);
+ });
+
+ // Test width separately since it differs outside fieldset vs. in fieldset vs. rendered legend
+ test(() => {
+ if (legend.id === 'rendered-legend') {
+ assert_equals(testStyle.width, '0px');
+ } else {
+ assert_not_equals(testStyle.width, '0px');
+ }
+ }, `${legend.id}: width`);
+});
+</script>