Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / events / constructors / autocomplete-error-event-constructor.html
blob7b0006ffafa9435cc804a5856bbcd60f493a520e
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="../../../resources/js-test.js"></script>
5 </head>
6 <body>
7 <script>
9 description("This tests the constructor for the AutocompleteErrorEvent DOM class.");
11 if (!window.AutocompleteErrorEvent) {
12 testFailed('no AutocompleteErrorEvent');
13 finishJSTest();
14 } else {
15 // No initializer is passed.
16 shouldBe("new AutocompleteErrorEvent('eventType').bubbles", "false");
17 shouldBe("new AutocompleteErrorEvent('eventType').cancelable", "false");
18 shouldBeEqualToString("new AutocompleteErrorEvent('eventType').reason", "");
20 // bubbles is passed.
21 shouldBe("new AutocompleteErrorEvent('eventType', { bubbles: false }).bubbles", "false");
22 shouldBe("new AutocompleteErrorEvent('eventType', { bubbles: true }).bubbles", "true");
24 // cancelable is passed.
25 shouldBe("new AutocompleteErrorEvent('eventType', { cancelable: false }).cancelable", "false");
26 shouldBe("new AutocompleteErrorEvent('eventType', { cancelable: true }).cancelable", "true");
28 // reason is passed.
29 shouldBeEqualToString("new AutocompleteErrorEvent('eventType', { reason: 'cancel' }).reason", "cancel");
30 shouldBeEqualToString("new AutocompleteErrorEvent('eventType', { reason: '' }).reason", "");
31 shouldBeEqualToString("new AutocompleteErrorEvent('eventType', { reason: 'disabled' }).reason", "disabled");
32 shouldBeEqualToString("new AutocompleteErrorEvent('eventType', { reason: 'invalid' }).reason", "invalid");
33 shouldBeEqualToString("new AutocompleteErrorEvent('eventType', { reason: undefined }).reason", "");
35 // Invalid reason throws exception
36 shouldThrow("new AutocompleteErrorEvent('eventType', { reason: 'doremi' })");
37 shouldThrow("new AutocompleteErrorEvent('eventType', { reason: null })");
38 shouldThrow("new AutocompleteErrorEvent('eventType', { reason: false })");
39 shouldThrow("new AutocompleteErrorEvent('eventType', { reason: true })");
40 shouldThrow("new AutocompleteErrorEvent('eventType', { reason: 12345 })");
41 shouldThrow("new AutocompleteErrorEvent('eventType', { reason: NaN })");
43 // All initializers are passed.
44 shouldBe("new AutocompleteErrorEvent('eventType', { bubbles: true, cancelable: true, reason: '' }).bubbles", "true");
45 shouldBe("new AutocompleteErrorEvent('eventType', { bubbles: true, cancelable: true, reason: 'cancel' }).cancelable", "true");
46 shouldBeEqualToString("new AutocompleteErrorEvent('eventType', { bubbles: true, cancelable: true, reason: 'disabled' }).reason", "disabled");
49 </script>
50 </body>
51 </html>