blob: d9bcd73a91f27670a9f612ac82624acddec3b632 [file] [log] [blame]
<!DOCTYPE html>
<title>VTTCue exceptions are properly messaged to developers</title>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script>
function getExceptionMsg(property, value) {
return "Failed to set the '" + property
+ "' property on 'VTTCue': The value provided ("
+ value + ") is outside the range [0, 100].";
}
var cue = new VTTCue(0, 0, "Test.");
function testProperty(property, value) {
var expected_exception_msg = getExceptionMsg(property, value);
test(function() {
try {
cue[property] = value;
assert_unreached("should throw");
} catch (e) {
assert_equals(e.name, "IndexSizeError");
assert_equals(e.message, expected_exception_msg);
}
}, expected_exception_msg);
}
testProperty("position", -1);
testProperty("position", 101);
testProperty("size", -1);
testProperty("size", 101);
</script>