diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /testing/web-platform/tests/html/semantics/forms/the-option-element | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'testing/web-platform/tests/html/semantics/forms/the-option-element')
11 files changed, 432 insertions, 0 deletions
diff --git a/testing/web-platform/tests/html/semantics/forms/the-option-element/.gitkeep b/testing/web-platform/tests/html/semantics/forms/the-option-element/.gitkeep new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/testing/web-platform/tests/html/semantics/forms/the-option-element/.gitkeep diff --git a/testing/web-platform/tests/html/semantics/forms/the-option-element/option-disabled-manual.html b/testing/web-platform/tests/html/semantics/forms/the-option-element/option-disabled-manual.html new file mode 100644 index 000000000..25dfcc87a --- /dev/null +++ b/testing/web-platform/tests/html/semantics/forms/the-option-element/option-disabled-manual.html @@ -0,0 +1,28 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>HTMLOptionElement Test: disabled</title> +<meta name="flags" content="interact"> +<link rel="author" title="Intel" href="http://www.intel.com/"> + +<div> + <select> + <option id="testOption1" text="Option1" >Option1</option> + <option id="testOption2" disabled >Option2</option> + <option id="testOption3" >Option3</option> + </select> +</div> + +<h2>Description</h2> +<p> + This test validates that an option element is disabled if its disabled attribute is present. +</p> + +<h2>Test steps:</h2> +<ol> + <li> + Click the select flag to select 'Option2' + </li> +</ol> + +<h2>Result:</h2> +<p>Test passes if not able to select 'Option2'</p> diff --git a/testing/web-platform/tests/html/semantics/forms/the-option-element/option-form.html b/testing/web-platform/tests/html/semantics/forms/the-option-element/option-form.html new file mode 100644 index 000000000..1a68b5c1c --- /dev/null +++ b/testing/web-platform/tests/html/semantics/forms/the-option-element/option-form.html @@ -0,0 +1,32 @@ +<!doctype html> +<meta charset=utf-8> +<title>HTMLOptionElement.form</title> +<link rel=author title="Sergey Alexandrov" href="mailto:splavgm@gmail.com"> +<link rel=help href="https://html.spec.whatwg.org/multipage/#dom-option-form"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<form id="form"> + <select id="select"> + <optgroup id="optgroup"></optgroup> + </select> +</form> +<div id=log></div> + +<script> +test(function () { + var form = document.getElementById("form"); + var select = document.getElementById("select"); + var optgroup = document.getElementById("optgroup"); + + var o1 = document.createElement("option"); + assert_equals(o1.form, null); + + select.appendChild(o1); + assert_equals(o1.form, select.form); + + var o2 = document.createElement("option"); + select.appendChild(o2); + assert_equals(o2.form, select.form); + +}, "form"); +</script> diff --git a/testing/web-platform/tests/html/semantics/forms/the-option-element/option-label-value.js b/testing/web-platform/tests/html/semantics/forms/the-option-element/option-label-value.js new file mode 100644 index 000000000..5c453f173 --- /dev/null +++ b/testing/web-platform/tests/html/semantics/forms/the-option-element/option-label-value.js @@ -0,0 +1,82 @@ +function test_option(member) { + test(function() { + var option = document.createElement("option"); + assert_equals(option[member], ""); + }, "No children, no " + member); + + test(function() { + var option = document.createElement("option"); + option.setAttribute(member, "") + assert_equals(option[member], ""); + }, "No children, empty " + member); + + test(function() { + var option = document.createElement("option"); + option.setAttribute(member, member) + assert_equals(option[member], member); + }, "No children, " + member); + + test(function() { + var option = document.createElement("option"); + option.setAttributeNS("http://www.example.com/", member, member) + assert_equals(option[member], ""); + }, "No children, namespaced " + member); + + test(function() { + var option = document.createElement("option"); + option.appendChild(document.createTextNode(" child ")); + assert_equals(option[member], "child"); + }, "Single child, no " + member); + + test(function() { + var option = document.createElement("option"); + option.appendChild(document.createTextNode(" child ")); + option.setAttribute(member, "") + assert_equals(option[member], ""); + }, "Single child, empty " + member); + + test(function() { + var option = document.createElement("option"); + option.appendChild(document.createTextNode(" child ")); + option.setAttribute(member, member) + assert_equals(option[member], member); + }, "Single child, " + member); + + test(function() { + var option = document.createElement("option"); + option.appendChild(document.createTextNode(" child ")); + option.setAttributeNS("http://www.example.com/", member, member) + assert_equals(option[member], "child"); + }, "Single child, namespaced " + member); + + test(function() { + var option = document.createElement("option"); + option.appendChild(document.createTextNode(" child ")); + option.appendChild(document.createTextNode(" node ")); + assert_equals(option[member], "child node"); + }, "Two children, no " + member); + + test(function() { + var option = document.createElement("option"); + option.appendChild(document.createTextNode(" child ")); + option.appendChild(document.createTextNode(" node ")); + option.setAttribute(member, "") + assert_equals(option[member], ""); + }, "Two children, empty " + member); + + test(function() { + var option = document.createElement("option"); + option.appendChild(document.createTextNode(" child ")); + option.appendChild(document.createTextNode(" node ")); + option.setAttribute(member, member) + assert_equals(option[member], member); + }, "Two children, " + member); + + test(function() { + var option = document.createElement("option"); + option.appendChild(document.createTextNode(" child ")); + option.appendChild(document.createTextNode(" node ")); + option.setAttributeNS("http://www.example.com/", member, member) + assert_equals(option[member], "child node"); + }, "Two children, namespaced " + member); +} diff --git a/testing/web-platform/tests/html/semantics/forms/the-option-element/option-label.html b/testing/web-platform/tests/html/semantics/forms/the-option-element/option-label.html new file mode 100644 index 000000000..f931b9622 --- /dev/null +++ b/testing/web-platform/tests/html/semantics/forms/the-option-element/option-label.html @@ -0,0 +1,12 @@ +<!doctype html> +<meta charset=utf-8> +<title>HTMLOptionElement.label</title> +<link rel=author title=Ms2ger href="mailto:Ms2ger@gmail.com"> +<link rel=help href="https://html.spec.whatwg.org/multipage/#dom-option-label"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src=option-label-value.js></script> +<div id=log></div> +<script> +test_option("label") +</script> diff --git a/testing/web-platform/tests/html/semantics/forms/the-option-element/option-selected.html b/testing/web-platform/tests/html/semantics/forms/the-option-element/option-selected.html new file mode 100644 index 000000000..e18e90b85 --- /dev/null +++ b/testing/web-platform/tests/html/semantics/forms/the-option-element/option-selected.html @@ -0,0 +1,61 @@ +<!doctype html> +<meta charset=utf-8> +<title>HTMLOptionElement.selected</title> +<link rel=author title="Corey Farwell" href="mailto:coreyf@rwell.org"> +<link rel=help href="https://html.spec.whatwg.org/multipage/#dom-option-selected"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id=log></div> + +<script> +test(function () { + var elem = document.createElement("option"); + assert_equals(elem.selected, false); + + elem.setAttribute("selected", ""); + assert_equals(elem.selected, true); + + elem.removeAttribute("selected"); + assert_equals(elem.selected, false); + + elem.defaultSelected = true + assert_equals(elem.selected, true); + + elem.defaultSelected = false; + assert_equals(elem.selected, false); +}, "not dirty"); + +test(function () { + testDirty(true); +}, "dirty, selected"); + +test(function () { + testDirty(false); +}, "dirty, not selected"); + +function testDirty(isSelected) { + var elem = document.createElement("option"); + + elem.selected = isSelected; // After this assignment, dirtiness=true + assertDirty(elem, isSelected); + + elem.selected = !isSelected; // Change the value, still dirty + assertDirty(elem, !isSelected); +}; + +function assertDirty(elem, expect) { + assert_equals(elem.selected, expect); + + elem.setAttribute("selected", ""); + assert_equals(elem.selected, expect); + + elem.removeAttribute("selected"); + assert_equals(elem.selected, expect); + + elem.defaultSelected = true; + assert_equals(elem.selected, expect); + + elem.defaultSelected = false; + assert_equals(elem.selected, expect); +} +</script> diff --git a/testing/web-platform/tests/html/semantics/forms/the-option-element/option-text-backslash.html b/testing/web-platform/tests/html/semantics/forms/the-option-element/option-text-backslash.html new file mode 100644 index 000000000..34bd0d368 --- /dev/null +++ b/testing/web-platform/tests/html/semantics/forms/the-option-element/option-text-backslash.html @@ -0,0 +1,15 @@ +<!doctype html> +<meta charset=EUC-JP> +<title>Test for the backslash sign in option.text</title> +<script src=/resources/testharness.js></script> +<script src=/resources/testharnessreport.js></script> +<div id=log></div> +<select id=test><option>\</option></select> +<script> +test(function() { + var select = document.getElementById("test"); + var option = select.firstChild; + assert_equals(option.text, "\\"); + assert_equals(option.textContent, "\\"); +}); +</script> diff --git a/testing/web-platform/tests/html/semantics/forms/the-option-element/option-text-label.html b/testing/web-platform/tests/html/semantics/forms/the-option-element/option-text-label.html new file mode 100644 index 000000000..9259aecf3 --- /dev/null +++ b/testing/web-platform/tests/html/semantics/forms/the-option-element/option-text-label.html @@ -0,0 +1,23 @@ +<!doctype html> +<meta charset=utf-8> +<title>HTMLOptionElement.text</title> +<link rel=author title=Ms2ger href="mailto:Ms2ger@gmail.com"> +<link rel=help href="https://html.spec.whatwg.org/multipage/#dom-option-text"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id=log></div> +<script> +test(function() { + var option = document.createElement("option"); + option.setAttribute("label", "label"); + option.textContent = "text"; + assert_equals(option.text, "text"); +}, "Option with non-empty label."); + +test(function() { + var option = document.createElement("option"); + option.setAttribute("label", ""); + option.textContent = "text"; + assert_equals(option.text, "text"); +}, "Option with empty label."); +</script> diff --git a/testing/web-platform/tests/html/semantics/forms/the-option-element/option-text-recurse.html b/testing/web-platform/tests/html/semantics/forms/the-option-element/option-text-recurse.html new file mode 100644 index 000000000..cf854f526 --- /dev/null +++ b/testing/web-platform/tests/html/semantics/forms/the-option-element/option-text-recurse.html @@ -0,0 +1,92 @@ +<!doctype html> +<meta charset=utf-8> +<title>HTMLOptionElement.text</title> +<link rel=author title=Ms2ger href="mailto:Ms2ger@gmail.com"> +<link rel=help href="https://html.spec.whatwg.org/multipage/#dom-option-text"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id=log></div> +<script> +test(function() { + var option = document.createElement("option"); + option.appendChild(document.createElement("font")) + .appendChild(document.createTextNode(" font ")); + assert_equals(option.text, "font"); +}, "option.text should recurse"); + +test(function() { + var option = document.createElement("option"); + option.appendChild(document.createTextNode(" before ")); + option.appendChild(document.createElement("script")) + .appendChild(document.createTextNode(" script ")); + option.appendChild(document.createTextNode(" after ")); + assert_equals(option.text, "before after"); +}, "option.text should not recurse into HTML script elements"); +test(function() { + var option = document.createElement("option"); + option.appendChild(document.createTextNode(" before ")); + option.appendChild(document.createElementNS("http://www.w3.org/2000/svg", "script")) + .appendChild(document.createTextNode(" script ")); + option.appendChild(document.createTextNode(" after ")); + assert_equals(option.text, "before after"); +}, "option.text should not recurse into SVG script elements"); +test(function() { + var option = document.createElement("option"); + option.appendChild(document.createTextNode(" before ")); + option.appendChild(document.createElementNS("http://www.w3.org/1998/Math/MathML", "script")) + .appendChild(document.createTextNode(" script ")); + option.appendChild(document.createTextNode(" after ")); + assert_equals(option.text, "before script after"); +}, "option.text should recurse into MathML script elements"); +test(function() { + var option = document.createElement("option"); + option.appendChild(document.createTextNode(" before ")); + option.appendChild(document.createElementNS(null, "script")) + .appendChild(document.createTextNode(" script ")); + option.appendChild(document.createTextNode(" after ")); + assert_equals(option.text, "before script after"); +}, "option.text should recurse into null script elements"); +test(function() { + var option = document.createElement("option"); + var span = option.appendChild(document.createElement("span")); + span.appendChild(document.createTextNode(" Some ")); + span.appendChild(document.createElement("script")) + .appendChild(document.createTextNode(" script ")); + option.appendChild(document.createTextNode(" Text ")); + assert_equals(option.text, "Some Text"); +}, "option.text should work if a child of the option ends with a script"); + +test(function() { + var script = document.createElement("script"); + var option = script.appendChild(document.createElement("option")); + option.appendChild(document.createTextNode("text")); + assert_equals(option.text, "text"); +}, "option.text should work if the option is in an HTML script element"); +test(function() { + var script = document.createElementNS("http://www.w3.org/2000/svg", "script"); + var option = script.appendChild(document.createElement("option")); + option.appendChild(document.createTextNode("text")); + assert_equals(option.text, "text"); +}, "option.text should work if the option is in an SVG script element"); +test(function() { + var script = document.createElementNS("http://www.w3.org/1998/Math/MathML", "script"); + var option = script.appendChild(document.createElement("option")); + option.appendChild(document.createTextNode("text")); + assert_equals(option.text, "text"); +}, "option.text should work if the option is in a MathML script element"); + +test(function() { + var option = document.createElement("option"); + option.appendChild(document.createTextNode("te")); + option.appendChild(document.createComment("comment")); + option.appendChild(document.createTextNode("xt")); + assert_equals(option.text, "text"); +}, "option.text should ignore comment children"); +test(function() { + var option = document.createElement("option"); + option.appendChild(document.createTextNode("te")); + option.appendChild(document.createProcessingInstruction("target", "data")); + option.appendChild(document.createTextNode("xt")); + assert_equals(option.text, "text"); +}, "option.text should ignore PI children"); +</script> diff --git a/testing/web-platform/tests/html/semantics/forms/the-option-element/option-text-spaces.html b/testing/web-platform/tests/html/semantics/forms/the-option-element/option-text-spaces.html new file mode 100644 index 000000000..2c712655a --- /dev/null +++ b/testing/web-platform/tests/html/semantics/forms/the-option-element/option-text-spaces.html @@ -0,0 +1,75 @@ +<!doctype html> +<meta charset=utf-8> +<title>HTMLOptionElement.text</title> +<link rel=author title=Ms2ger href="mailto:Ms2ger@gmail.com"> +<link rel=help href="https://html.spec.whatwg.org/multipage/#dom-option-text"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id=log></div> +<script> +test(function() { + var spaces = ["\u0020", "\u0009", "\u000A", "\u000C", "\u000D"]; + spaces.forEach(function(space) { + test(function() { + var option = document.createElement("option"); + option.textContent = space + "text"; + assert_equals(option.text, "text"); + }, "option.text should strip leading space characters (" + + format_value(space) + ")"); + }); + spaces.forEach(function(space) { + test(function() { + var option = document.createElement("option"); + option.textContent = "text" + space; + assert_equals(option.text, "text"); + }, "option.text should strip trailing space characters (" + + format_value(space) + ")"); + }); + spaces.forEach(function(space) { + test(function() { + var option = document.createElement("option"); + option.textContent = space + "text" + space; + assert_equals(option.text, "text"); + }, "option.text should strip leading and trailing space characters (" + + format_value(space) + ")"); + }); + spaces.forEach(function(space) { + test(function() { + var option = document.createElement("option"); + option.textContent = "before" + space + "after"; + assert_equals(option.text, "before after"); + }, "option.text should replace single internal space characters (" + + format_value(space) + ")"); + }); + spaces.forEach(function(space1) { + spaces.forEach(function(space2) { + test(function() { + var option = document.createElement("option"); + option.textContent = "before" + space1 + space2 + "after"; + assert_equals(option.text, "before after"); + }, "option.text should replace multiple internal space characters (" + + format_value(space1) + ", " + format_value(space2) + ")"); + }); + }); + test(function() { + var option = document.createElement("option"); + option.textContent = "\u00a0text"; + assert_equals(option.text, "\u00a0text"); + }, "option.text should leave leading NBSP alone."); + test(function() { + var option = document.createElement("option"); + option.textContent = "text\u00a0"; + assert_equals(option.text, "text\u00a0"); + }, "option.text should leave trailing NBSP alone."); + test(function() { + var option = document.createElement("option"); + option.textContent = "before\u00a0after"; + assert_equals(option.text, "before\u00a0after"); + }, "option.text should leave a single internal NBSP alone."); + test(function() { + var option = document.createElement("option"); + option.textContent = "before\u00a0\u00a0after"; + assert_equals(option.text, "before\u00a0\u00a0after"); + }, "option.text should leave two internal NBSPs alone."); +}); +</script> diff --git a/testing/web-platform/tests/html/semantics/forms/the-option-element/option-value.html b/testing/web-platform/tests/html/semantics/forms/the-option-element/option-value.html new file mode 100644 index 000000000..cccdc3748 --- /dev/null +++ b/testing/web-platform/tests/html/semantics/forms/the-option-element/option-value.html @@ -0,0 +1,12 @@ +<!doctype html> +<meta charset=utf-8> +<title>HTMLOptionElement.value</title> +<link rel=author title=Ms2ger href="mailto:Ms2ger@gmail.com"> +<link rel=help href="https://html.spec.whatwg.org/multipage/#dom-option-label"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src=option-label-value.js></script> +<div id=log></div> +<script> +test_option("value") +</script> |