Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / dom / DOMError-constructor.html
blobacf0e4205d8a7ea1894d413a84f3aab6d59470c0
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <link rel="help" href="http://dom.spec.whatwg.org/#dom-domerror">
5 <script src="../../resources/js-test.js"></script>
6 </head>
7 <body>
8 <script>
9 description("Tests that DOMError is constructible.");
11 var error;
13 // Passing 2 arguments.
14 shouldNotThrow("error = new DOMError('NotFoundError', 'This item was not found.')");
15 shouldBeEqualToString("error.name", "NotFoundError");
16 shouldBeEqualToString("error.message", "This item was not found.");
18 // Passing 1 argument. Default value for the second argument should be the empty string.
19 shouldNotThrow("error = new DOMError('IndexSizeError')");
20 shouldBeEqualToString("error.name", "IndexSizeError");
21 shouldBeEqualToString("error.message", "");
23 // Not passing any argument. First argument should be mandatory.
24 shouldThrow("new DOMError()", '"TypeError: Failed to construct \'DOMError\': 1 argument required, but only 0 present."');
25 </script>
26 </body>
27 </html>