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 /dom/html/test/test_bug595449.html | |
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 'dom/html/test/test_bug595449.html')
-rw-r--r-- | dom/html/test/test_bug595449.html | 95 |
1 files changed, 95 insertions, 0 deletions
diff --git a/dom/html/test/test_bug595449.html b/dom/html/test/test_bug595449.html new file mode 100644 index 000000000..14d5e5ced --- /dev/null +++ b/dom/html/test/test_bug595449.html @@ -0,0 +1,95 @@ +<!DOCTYPE HTML> +<html> +<!-- +https://bugzilla.mozilla.org/show_bug.cgi?id=595449 +--> +<head> + <title>Test for Bug 595449</title> + <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> +</head> +<body> +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=595449">Mozilla Bug 595449</a> +<p id="display"></p> +<pre id="test"> +<script type="application/javascript"> + +/** Test for Bug 595449 **/ + +var fieldset = document.createElement("fieldset"); + +ok("elements" in fieldset, + "fieldset element should have an 'elements' IDL attribute"); + +ok(fieldset.elements instanceof HTMLCollection, + "fieldset.elements should be an instance of HTMLCollection"); + +// https://www.w3.org/Bugs/Public/show_bug.cgi?id=23356 +todo(fieldset.elements instanceof HTMLFormControlsCollection, + "fieldset.elements should be an instance of HTMLFormControlsCollection"); + +is(fieldset.elements.length, 0, "Nothing should be in fieldset.elements"); + +var oldElements = fieldset.elements; + +is(fieldset.elements, oldElements, + "fieldset.elements should always return the same object"); + +var tmpElement = document.createElement("input"); + +fieldset.appendChild(tmpElement); + +is(fieldset.elements.length, 1, + "fieldset.elements should now contain one element"); + +is(fieldset.elements[0], tmpElement, + "fieldset.elements[0] should be the input element"); + +tmpElement.name = "foo"; +is(fieldset.elements.foo, tmpElement, + "we should be able to access to an element using it's name as a property on .elements"); + +is(fieldset.elements, oldElements, + "fieldset.elements should always return the same object"); + +fieldset.removeChild(tmpElement); + +var testData = [ + [ "<input>", 1 , [ HTMLInputElement ] ], + [ "<button></button>", 1, [ HTMLButtonElement ] ], + [ "<button><input></button>", 2, [ HTMLButtonElement, HTMLInputElement ] ], + [ "<object>", 1, [ HTMLObjectElement ] ], + [ "<output></output>", 1, [ HTMLOutputElement ] ], + [ "<select></select>", 1, [ HTMLSelectElement ] ], + [ "<select><option>foo</option></select>", 1, [ HTMLSelectElement ] ], + [ "<select><option>foo</option><input></select>", 2, [ HTMLSelectElement, HTMLInputElement ] ], + [ "<textarea></textarea>", 1, [ HTMLTextAreaElement ] ], + [ "<label>foo</label>", 0 ], + [ "<progress>", 0 ], + [ "<meter>", 0 ], + [ "<keygen>", 1, [ HTMLSelectElement ] ], + [ "<legend></legend>", 0 ], + [ "<legend><input></legend>", 1, [ HTMLInputElement ] ], + [ "<legend><input></legend><legend><input></legend>", 2, [ HTMLInputElement, HTMLInputElement ] ], + [ "<legend><input></legend><input>", 2, [ HTMLInputElement, HTMLInputElement ] ], + [ "<fieldset></fieldset>", 1, [ HTMLFieldSetElement ] ], + [ "<fieldset><input></fieldset>", 2, [ HTMLFieldSetElement, HTMLInputElement ] ], + [ "<fieldset><fieldset><input></fieldset></fieldset>", 3, [ HTMLFieldSetElement, HTMLFieldSetElement, HTMLInputElement ] ], + [ "<button></button><fieldset></fieldset><input><keygen><object><output></output><select></select><textarea></textarea>", 8, [ HTMLButtonElement, HTMLFieldSetElement, HTMLInputElement, HTMLSelectElement, HTMLObjectElement, HTMLOutputElement, HTMLSelectElement, HTMLTextAreaElement ] ], +]; + +for (var data of testData) { + fieldset.innerHTML = data[0]; + is(fieldset.elements.length, data[1], + "fieldset.elements should contain " + data[1] + " elements"); + + for (var i=0; i<data[1]; ++i) { + ok(fieldset.elements[i] instanceof data[2][i], + "fieldset.elements[" + i + "] should be instance of " + data[2][i]) + } +} + +</script> +</pre> +</body> +</html> |