Index: LayoutTests/fast/dom/DOMError-constructor.html |
diff --git a/LayoutTests/fast/dom/DOMError-constructor.html b/LayoutTests/fast/dom/DOMError-constructor.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..acf0e4205d8a7ea1894d413a84f3aab6d59470c0 |
--- /dev/null |
+++ b/LayoutTests/fast/dom/DOMError-constructor.html |
@@ -0,0 +1,27 @@ |
+<!DOCTYPE html> |
+<html> |
+<head> |
+<link rel="help" href="http://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> |