[Webkit-unassigned] [Bug 25191] HTMLSelectElement doesn't return named options

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Apr 21 09:04:17 PDT 2009


https://bugs.webkit.org/show_bug.cgi?id=25191





------- Comment #4 from eric at webkit.org  2009-04-21 09:04 PDT -------
It doesn't have to be a JS test of course. :)  But I think JS tests are much
cleaner.

This is how this one would look:

resources/named-options.js:

description("This tests that options elements are accessible by name from both
a select element and options collection.");

var sl1 = document.createElement("select");
document.body.appendChild(sl1);
sl1.innerHTML = '<option value="Value" name="test" />';

var sl2 = document.createElement("select");
document.body.appendChild(sl2);
sl1.innerHTML = '<option value="Value1" name="test" /><option value="Value2"
name="test" />';

debug("Confirm that the option named "test" is accessible from the select
element");
shouldBeEqualToString("sl1.test.value", "Value");

debug("Confirm that the option named "test" is accessible from the options
collection");
shouldBeEqualToString("sl1.options.test.value", "Value");

debug("Confirm that both options named "test" are accessible from the select
element");
shouldBe("sl2.test.length", "2");
shouldBe("sl2.test[0].value", "Value1");
shouldBe("sl2.test[1].value", "Value2");

debug("Confirm that both options named "test" are accessible from the options
collection");
shouldBe("sl2.options.test.length", "2");
shouldBe("sl2.options.test[0].value", "Value1");
shouldBe("sl2.options.test[1].value", "Value2");


I think that kind of test is much easier to read, personally.  Actually, if I
were writing this, I would search replace "sl1" with "select1" to make it even
more readable.

As is, the test is OK, but I think a js-style test is better.  We really need
better documentation on our js-style testing.

That test will produce nicely colored output when you view it in Safari, and
will dump as text a bunch of PASS/FAIL messages run under DRT.


-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.



More information about the webkit-unassigned mailing list