Skip to content

Commit

Permalink
wpt: move tests for value/min/max/low/high/optimum IDL attributes of …
Browse files Browse the repository at this point in the history
…METER

Since reflection-forms.html does not folow the spec of METER element,
we should update the reflection-forms.html for METER element.

Also, IDL attributes of METER are not reflect attribute, I decide to
move tests of unset attribute into the-meter-element/meter.html.

Bug: 894661
Change-Id: Ic002406f4da84d246cf854d0550ee4f7a1d7cf20
  • Loading branch information
corona10 authored and chromium-wpt-export-bot committed Oct 26, 2018
1 parent 4cd4c01 commit 1497ab6
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
2 changes: 1 addition & 1 deletion html/dom/reflection.js
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,7 @@ ReflectionTests.reflects = function(data, idlName, idlObj, domName, domObj) {
// Hard-coded special case
defaultVal = domObj.ownerDocument.URL;
}
if (defaultVal !== null || data.isNullable) {
if ((defaultVal !== null || data.isNullable) && data.customGetter !== true) {
ReflectionHarness.test(function() {
ReflectionHarness.assertEquals(idlObj[idlName], defaultVal);
}, "IDL get with DOM attribute unset");
Expand Down
27 changes: 26 additions & 1 deletion html/semantics/forms/the-meter-element/meter.html
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ <h1>Meter Element</h1>
var m = meters[i];
test(function() {
var meter = document.createElement("meter");
meter.value = m.value;
if (m.value) meter.value = m.value;
if (m.min) meter.min= m.min;
if (m.max) meter.max = m.max;
if (m.low) meter.low = m.low;
Expand All @@ -79,6 +79,31 @@ <h1>Meter Element</h1>
assert_throws(new TypeError(), function() { meter.high = "foobar"; }, "high attribute");
assert_throws(new TypeError(), function() { meter.optimum = "foobar"; }, "optimum attribute");
}, "Invalid floating-point number values");
test(function() {
var meter = document.createElement("meter");
meter.value = 37.5;
meter.min= 10;
meter.max = 100;
meter.low = 10;
meter.high = 100;
meter.optimum = 55;
assert_equals(meter.value, 37.5, "meter value");
assert_equals(meter.min, 10, "min value");
assert_equals(meter.max, 100, "max value");
assert_equals(meter.low, 10, "low value");
assert_equals(meter.high, 100, "high value");
assert_equals(meter.optimum, 55, "optimum value");
meter.removeAttribute("min");
assert_equals(meter.min, 0.0, "unset min attribute");
meter.removeAttribute("max");
assert_equals(meter.max, 1.0, "unset max attribute");
meter.removeAttribute("low");
assert_equals(meter.low, 0.0, "unset low attribute");
meter.removeAttribute("high");
assert_equals(meter.high, 1.0, "unset high attribute");
meter.removeAttribute("optimum");
assert_equals(meter.optimum, 0.5, "unset optimum attibute");
}, "Unset attributes test");

</script>
<script type="text/javascript">
Expand Down

0 comments on commit 1497ab6

Please sign in to comment.