<!DOCTYPE html>
<html>
<head>
<link rel="help" href="https://dom.spec.whatwg.org/#dom-domerror">
<script src="../../resources/js-test.js"></script>
</head>
<body>
<script>
description("Tests that DOMError is constructible.");
var error;
// Passing 2 arguments.
shouldNotThrow("error = new DOMError('NotFoundError', 'This item was not found.')");
shouldBeEqualToString("error.name", "NotFoundError");
shouldBeEqualToString("error.message", "This item was not found.");
// Passing 1 argument. Default value for the second argument should be the empty string.
shouldNotThrow("error = new DOMError('IndexSizeError')");
shouldBeEqualToString("error.name", "IndexSizeError");
shouldBeEqualToString("error.message", "");
// Not passing any argument. First argument should be mandatory.
shouldThrow("new DOMError()", '"TypeError: Failed to construct \'DOMError\': 1 argument required, but only 0 present."');
</script>
</body>
</html>