38 lines
1.1 KiB
HTML
38 lines
1.1 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
|
|
<html>
|
|
<head>
|
|
<script src="../../resources/js-test-pre.js"></script>
|
|
</head>
|
|
<body>
|
|
<svg id="svgvar"></svg>
|
|
</body>
|
|
<script>
|
|
description("This test checks that setting currentScale fails for non-finite values");
|
|
|
|
var svgvar = document.getElementById('svgvar');
|
|
|
|
svgvar.currentScale = 1.0;
|
|
shouldBe('svgvar.currentScale', '1.0');
|
|
|
|
const testIncorrectScaleValue = (value, description) => {
|
|
try {
|
|
svgvar.currentScale = value;
|
|
testFailed(`Setting currentScale to ${description} should have thrown an exception.`);
|
|
} catch (e) {
|
|
if (e instanceof TypeError)
|
|
testPassed(`Setting currentScale to ${description} threw an exception.`);
|
|
}
|
|
shouldBe('svgvar.currentScale', '1.0');
|
|
};
|
|
|
|
testIncorrectScaleValue(undefined, "undefined");
|
|
testIncorrectScaleValue(NaN, "NaN");
|
|
testIncorrectScaleValue(Infinity, "Infinity");
|
|
testIncorrectScaleValue("a", "a string");
|
|
|
|
var successfullyParsed = true;
|
|
</script>
|
|
|
|
<script src="../../resources/js-test-post.js"></script>
|
|
</html>
|