diff options
Diffstat (limited to 'testing/web-platform/tests/html/rendering')
7 files changed, 274 insertions, 14 deletions
diff --git a/testing/web-platform/tests/html/rendering/bidi-rendering/unicode-bidi-ua-rules.html b/testing/web-platform/tests/html/rendering/bidi-rendering/unicode-bidi-ua-rules.html index 78bfb80e6f..00f4c96317 100644 --- a/testing/web-platform/tests/html/rendering/bidi-rendering/unicode-bidi-ua-rules.html +++ b/testing/web-platform/tests/html/rendering/bidi-rendering/unicode-bidi-ua-rules.html @@ -4,22 +4,104 @@ <link rel="help" href="https://html.spec.whatwg.org/multipage/rendering.html#bidi-rendering"> <script src=/resources/testharness.js></script> <script src=/resources/testharnessreport.js></script> +<script src='../../resources/common.js'></script> <body> <script> - const elements = ['address', 'blockquote', 'center', 'div', 'figure', + function getUnicodeBidi(el) { + return window.getComputedStyle(el, "").unicodeBidi; + } + + // These elements should have `unicode-bidi: isolate` in the UA stylesheet: + const isolateElements = ['address', 'blockquote', 'center', 'div', 'figure', 'figcaption', 'footer', 'form', 'header', 'hr', 'legend', 'listing', 'main', 'p', 'plaintext', 'pre', 'summary', 'xmp', 'article', 'aside', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'hgroup', 'nav', 'section', 'search', 'table', 'caption', 'colgroup', 'col', 'thead', 'tbody', 'tfoot', 'tr', 'td', 'th', 'dir', 'dd', 'dl', 'dt', 'menu', 'ol', 'ul', 'li', 'bdi', 'output']; - for(let tagname of elements) { + const allButSeparateTests = HTML5_ELEMENTS.filter(el => (!['bdo','input','textarea','pre'].includes(el))); + for(let tagname of allButSeparateTests) { + test((t) => { + const element = document.createElement(tagname); + t.add_cleanup(() => element.remove()); + document.body.appendChild(element); + const expectation = isolateElements.includes(tagname) ? 'isolate' : 'normal'; + assert_equals(getUnicodeBidi(element),expectation); + + element.setAttribute('dir','ltr'); + assert_equals(getUnicodeBidi(element),'isolate','with dir=ltr'); + element.setAttribute('dir','LtR'); + assert_equals(getUnicodeBidi(element),'isolate','with dir=LtR (case insensitive)'); + element.setAttribute('dir','rtl'); + assert_equals(getUnicodeBidi(element),'isolate','with dir=rtl'); + element.setAttribute('dir','auto'); + assert_equals(getUnicodeBidi(element),'isolate','with dir=auto'); + element.setAttribute('dir','INVALID'); + assert_equals(getUnicodeBidi(element),expectation,'invalid dir value goes back to normal defaults'); + },`UA stylesheet rule for unicode-bidi, for <${tagname}>`); + } + + test((t) => { + const element = document.createElement('bdo'); + t.add_cleanup(() => element.remove()); + document.body.appendChild(element); + assert_equals(getUnicodeBidi(element),'isolate-override'); + element.setAttribute('dir','ltr'); + assert_equals(getUnicodeBidi(element),'isolate-override','with dir=ltr'); + element.setAttribute('dir','LtR'); + assert_equals(getUnicodeBidi(element),'isolate-override','with dir=LtR (case insensitive)'); + element.setAttribute('dir','rtl'); + assert_equals(getUnicodeBidi(element),'isolate-override','with dir=rtl'); + element.setAttribute('dir','auto'); + assert_equals(getUnicodeBidi(element),'isolate-override','with dir=auto'); + element.setAttribute('dir','INVALID'); + assert_equals(getUnicodeBidi(element),'isolate-override','invalid dir value'); + },`UA stylesheet rule for unicode-bidi, for <bdo>`); + + const shouldBePlaintext = ['search','tel','url','email']; + for(let type of HTML5_INPUT_TYPES) { + test((t) => { + const element = document.createElement('input'); + t.add_cleanup(() => element.remove()); + element.type = type; + document.body.appendChild(element); + const autoExpectation = shouldBePlaintext.includes(type) ? 'plaintext' : 'isolate'; + assert_equals(getUnicodeBidi(element),'normal'); + element.setAttribute('dir','ltr'); + assert_equals(getUnicodeBidi(element),'isolate','with dir=ltr'); + element.setAttribute('dir','LtR'); + assert_equals(getUnicodeBidi(element),'isolate','with dir=LtR (case insensitive)'); + element.setAttribute('dir','rtl'); + assert_equals(getUnicodeBidi(element),'isolate','with dir=rtl'); + element.setAttribute('dir','auto'); + assert_equals(getUnicodeBidi(element),autoExpectation,'with dir=auto'); + element.setAttribute('dir','AuTo'); + assert_equals(getUnicodeBidi(element),autoExpectation,'with dir=auto (case insensitive)'); + element.setAttribute('dir','INVALID'); + assert_equals(getUnicodeBidi(element),'normal','invalid dir value'); + },`UA stylesheet rule for unicode-bidi, for <input type=${type}>`); + } + + for(let tagname of ['textarea','pre']) { test((t) => { const element = document.createElement(tagname); t.add_cleanup(() => element.remove()); document.body.appendChild(element); - assert_equals(window.getComputedStyle(element, "").unicodeBidi,'isolate'); + const expectation = tagname === 'textarea' ? 'normal' : 'isolate'; + assert_equals(getUnicodeBidi(element),expectation); + element.setAttribute('dir','ltr'); + assert_equals(getUnicodeBidi(element),'isolate','with dir=ltr'); + element.setAttribute('dir','LtR'); + assert_equals(getUnicodeBidi(element),'isolate','with dir=LtR (case insensitive)'); + element.setAttribute('dir','rtl'); + assert_equals(getUnicodeBidi(element),'isolate','with dir=rtl'); + element.setAttribute('dir','auto'); + assert_equals(getUnicodeBidi(element),'plaintext','with dir=auto'); + element.setAttribute('dir','AuTo'); + assert_equals(getUnicodeBidi(element),'plaintext','with dir=auto (case insensitive)'); + element.setAttribute('dir','INVALID'); + assert_equals(getUnicodeBidi(element),expectation,'invalid dir value'); },`UA stylesheet rule for unicode-bidi, for <${tagname}>`); } </script> diff --git a/testing/web-platform/tests/html/rendering/non-replaced-elements/sections-and-headings/headings-styles-no-h1-in-section.tentative.html b/testing/web-platform/tests/html/rendering/non-replaced-elements/sections-and-headings/headings-styles-no-h1-in-section.tentative.html new file mode 100644 index 0000000000..61610c2fd6 --- /dev/null +++ b/testing/web-platform/tests/html/rendering/non-replaced-elements/sections-and-headings/headings-styles-no-h1-in-section.tentative.html @@ -0,0 +1,147 @@ +<!doctype html> +<title>default styles for h1..h6, hgroup, article, aside, nav, section (no h1 in section UA styles)</title> +<meta name="viewport" content="width=device-width"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/rendering/support/test-ua-stylesheet.js"></script> +<link rel="help" href="https://github.com/whatwg/html/issues/7867"> +<style> +/* Specify this bogus namespace, so the rules in this stylesheet only apply to the `fakeClone`d elements in #refs, not the HTML elements in #tests. */ +@namespace url(urn:not-html); + +article, aside, h1, h2, h3, h4, h5, h6, hgroup, nav, section { + display: block; +} + +h1 { margin-block: 0.67em; font-size: 2.00em; font-weight: bold; } +h2 { margin-block: 0.83em; font-size: 1.50em; font-weight: bold; } +h3 { margin-block: 1.00em; font-size: 1.17em; font-weight: bold; } +h4 { margin-block: 1.33em; font-size: 1.00em; font-weight: bold; } +h5 { margin-block: 1.67em; font-size: 0.83em; font-weight: bold; } +h6 { margin-block: 2.33em; font-size: 0.67em; font-weight: bold; } + +</style> + +<div id="log"></div> + +<div id="tests"> + <h1></h1> + <h2></h2> + <h3></h3> + <h4></h4> + <h5></h5> + <h6></h6> + <hgroup></hgroup> + <article></article> + <aside></aside> + <nav></nav> + <section></section> + <article data-skip> + <h1></h1> + <article data-skip> + <h1></h1> + <article data-skip> + <h1></h1> + <article data-skip> + <h1></h1> + <article data-skip> + <h1></h1> + <hgroup data-skip> + <h1></h1> + <h2></h2> + <h3></h3> + <h4></h4> + <h5></h5> + </hgroup> + </article> + </article> + </article> + </article> + </article> + <aside data-skip> + <h1></h1> + <aside data-skip> + <h1></h1> + <aside data-skip> + <h1></h1> + <aside data-skip> + <h1></h1> + <aside data-skip> + <h1></h1> + <hgroup data-skip> + <h1></h1> + <h2></h2> + <h3></h3> + <h4></h4> + <h5></h5> + </hgroup> + </aside> + </aside> + </aside> + </aside> + </aside> + <nav data-skip> + <h1></h1> + <nav data-skip> + <h1></h1> + <nav data-skip> + <h1></h1> + <nav data-skip> + <h1></h1> + <nav data-skip> + <h1></h1> + <hgroup data-skip> + <h1></h1> + <h2></h2> + <h3></h3> + <h4></h4> + <h5></h5> + </hgroup> + </nav> + </nav> + </nav> + </nav> + </nav> + <section data-skip> + <h1></h1> + <section data-skip> + <h1></h1> + <section data-skip> + <h1></h1> + <section data-skip> + <h1></h1> + <section data-skip> + <h1></h1> + <hgroup data-skip> + <h1></h1> + <h2></h2> + <h3></h3> + <h4></h4> + <h5></h5> + </hgroup> + </section> + </section> + </section> + </section> + </section> +</div> + +<div id="refs"></div> + +<script> + const props = [ + 'display', + 'margin-top', + 'margin-right', + 'margin-bottom', + 'margin-left', + 'padding-top', + 'padding-right', + 'padding-bottom', + 'padding-left', + 'font-size', + 'font-weight', + ]; + runUAStyleTests(props); + +</script> diff --git a/testing/web-platform/tests/html/rendering/non-replaced-elements/sections-and-headings/headings-styles.html b/testing/web-platform/tests/html/rendering/non-replaced-elements/sections-and-headings/headings-styles.html index 63e6a83e88..be531adfcf 100644 --- a/testing/web-platform/tests/html/rendering/non-replaced-elements/sections-and-headings/headings-styles.html +++ b/testing/web-platform/tests/html/rendering/non-replaced-elements/sections-and-headings/headings-styles.html @@ -12,18 +12,18 @@ article, aside, h1, h2, h3, h4, h5, h6, hgroup, nav, section { display: block; } -h1 { margin-block-start: 0.67em; margin-block-end: 0.67em; font-size: 2.00em; font-weight: bold; } -h2 { margin-block-start: 0.83em; margin-block-end: 0.83em; font-size: 1.50em; font-weight: bold; } -h3 { margin-block-start: 1.00em; margin-block-end: 1.00em; font-size: 1.17em; font-weight: bold; } -h4 { margin-block-start: 1.33em; margin-block-end: 1.33em; font-size: 1.00em; font-weight: bold; } -h5 { margin-block-start: 1.67em; margin-block-end: 1.67em; font-size: 0.83em; font-weight: bold; } -h6 { margin-block-start: 2.33em; margin-block-end: 2.33em; font-size: 0.67em; font-weight: bold; } +h1 { margin-block: 0.67em; font-size: 2.00em; font-weight: bold; } +h2 { margin-block: 0.83em; font-size: 1.50em; font-weight: bold; } +h3 { margin-block: 1.00em; font-size: 1.17em; font-weight: bold; } +h4 { margin-block: 1.33em; font-size: 1.00em; font-weight: bold; } +h5 { margin-block: 1.67em; font-size: 0.83em; font-weight: bold; } +h6 { margin-block: 2.33em; font-size: 0.67em; font-weight: bold; } -:is(article, aside, nav, section) h1 { margin-block-start: 0.83em; margin-block-end: 0.83em; font-size: 1.50em; } -:is(article, aside, nav, section) :is(article, aside, nav, section) h1 { margin-block-start: 1.00em; margin-block-end: 1.00em; font-size: 1.17em; } -:is(article, aside, nav, section) :is(article, aside, nav, section) :is(article, aside, nav, section) h1 { margin-block-start: 1.33em; margin-block-end: 1.33em; font-size: 1.00em; } -:is(article, aside, nav, section) :is(article, aside, nav, section) :is(article, aside, nav, section) :is(article, aside, nav, section) h1 { margin-block-start: 1.67em; margin-block-end: 1.67em; font-size: 0.83em; } -:is(article, aside, nav, section) :is(article, aside, nav, section) :is(article, aside, nav, section) :is(article, aside, nav, section) :is(article, aside, nav, section) h1 { margin-block-start: 2.33em; margin-block-end: 2.33em; font-size: 0.67em; } +:is(article, aside, nav, section) h1 { margin-block: 0.83em; font-size: 1.50em; } +:is(article, aside, nav, section) :is(article, aside, nav, section) h1 { margin-block: 1.00em; font-size: 1.17em; } +:is(article, aside, nav, section) :is(article, aside, nav, section) :is(article, aside, nav, section) h1 { margin-block: 1.33em; font-size: 1.00em; } +:is(article, aside, nav, section) :is(article, aside, nav, section) :is(article, aside, nav, section) :is(article, aside, nav, section) h1 { margin-block: 1.67em; font-size: 0.83em; } +:is(article, aside, nav, section) :is(article, aside, nav, section) :is(article, aside, nav, section) :is(article, aside, nav, section) :is(article, aside, nav, section) h1 { margin-block: 2.33em; font-size: 0.67em; } </style> diff --git a/testing/web-platform/tests/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/fieldset-overflow.html b/testing/web-platform/tests/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/fieldset-overflow.html index 83813f9020..089b0d9300 100644 --- a/testing/web-platform/tests/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/fieldset-overflow.html +++ b/testing/web-platform/tests/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/fieldset-overflow.html @@ -1,5 +1,6 @@ <!DOCTYPE HTML> <title>fieldset overflow</title> +<meta name="fuzzy" content="1;0-50"> <link rel=match href=fieldset-overflow-ref.html> <style> fieldset, legend { diff --git a/testing/web-platform/tests/html/rendering/replaced-elements/the-select-element/select-button-min-height-001-ref.html b/testing/web-platform/tests/html/rendering/replaced-elements/the-select-element/select-button-min-height-001-ref.html new file mode 100644 index 0000000000..c35ad5fc42 --- /dev/null +++ b/testing/web-platform/tests/html/rendering/replaced-elements/the-select-element/select-button-min-height-001-ref.html @@ -0,0 +1,11 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>CSS Test Reference</title> +<style> + select, input, button { height: 100px; } +</style> +<div> + <select><option>Select</option></select> + <button>Button</button> + <input type="button" value="Input"> +</div> diff --git a/testing/web-platform/tests/html/rendering/replaced-elements/the-select-element/select-button-min-height-001.html b/testing/web-platform/tests/html/rendering/replaced-elements/the-select-element/select-button-min-height-001.html new file mode 100644 index 0000000000..c099105076 --- /dev/null +++ b/testing/web-platform/tests/html/rendering/replaced-elements/the-select-element/select-button-min-height-001.html @@ -0,0 +1,15 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>min-height and height both trigger same rendering for select and buttons by default</title> +<link rel="author" title="Emilio Cobos Álvarez" href="mailto:emilio@crisal.io"> +<link rel="author" title="Mozilla" href="https://mozilla.org"> +<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1362907"> +<link rel="match" href="select-button-min-height-001-ref.html"> +<style> + select, input, button { min-height: 100px; } +</style> +<div> + <select><option>Select</option></select> + <button>Button</button> + <input type="button" value="Input"> +</div> diff --git a/testing/web-platform/tests/html/rendering/widgets/field-sizing-textarea.html b/testing/web-platform/tests/html/rendering/widgets/field-sizing-textarea.html index f8d90dc659..114d60c72d 100644 --- a/testing/web-platform/tests/html/rendering/widgets/field-sizing-textarea.html +++ b/testing/web-platform/tests/html/rendering/widgets/field-sizing-textarea.html @@ -3,6 +3,10 @@ <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> <style> +textarea { + font-family: monospace; +} + .disable-default { field-sizing: content; } |