-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
autocomplete-error-event-constructor.html
52 lines (45 loc) · 2.95 KB
/
autocomplete-error-event-constructor.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<!DOCTYPE html>
<html>
<head>
<script src="../../../resources/js-test-pre.js"></script>
</head>
<body>
<script>
description("This tests the constructor for the AutocompleteErrorEvent DOM class.");
if (!window.AutocompleteErrorEvent) {
testFailed('no AutocompleteErrorEvent');
finishJSTest();
} else {
// No initializer is passed.
shouldBe("new AutocompleteErrorEvent('eventType').bubbles", "false");
shouldBe("new AutocompleteErrorEvent('eventType').cancelable", "false");
shouldBeEqualToString("new AutocompleteErrorEvent('eventType').reason", "");
// bubbles is passed.
shouldBe("new AutocompleteErrorEvent('eventType', { bubbles: false }).bubbles", "false");
shouldBe("new AutocompleteErrorEvent('eventType', { bubbles: true }).bubbles", "true");
// cancelable is passed.
shouldBe("new AutocompleteErrorEvent('eventType', { cancelable: false }).cancelable", "false");
shouldBe("new AutocompleteErrorEvent('eventType', { cancelable: true }).cancelable", "true");
// reason is passed.
shouldBeEqualToString("new AutocompleteErrorEvent('eventType', { reason: 'doremi' }).reason", "doremi");
shouldBeEqualToString("new AutocompleteErrorEvent('eventType', { reason: '' }).reason", "");
shouldBeEqualToString("new AutocompleteErrorEvent('eventType', { reason: undefined }).reason", "undefined");
shouldBeEqualToString("new AutocompleteErrorEvent('eventType', { reason: null }).reason", "null");
shouldBeEqualToString("new AutocompleteErrorEvent('eventType', { reason: false }).reason", "false");
shouldBeEqualToString("new AutocompleteErrorEvent('eventType', { reason: true }).reason", "true");
shouldBeEqualToString("new AutocompleteErrorEvent('eventType', { reason: 12345 }).reason", "12345");
shouldBeEqualToString("new AutocompleteErrorEvent('eventType', { reason: 18446744073709551615 }).reason", "18446744073709552000");
shouldBeEqualToString("new AutocompleteErrorEvent('eventType', { reason: NaN }).reason", "NaN");
shouldBeEqualToString("new AutocompleteErrorEvent('eventType', { reason: [] }).reason", "");
shouldBeEqualToString("new AutocompleteErrorEvent('eventType', { reason: [1, 2, 3] }).reason", "1,2,3");
shouldBeEqualToString("new AutocompleteErrorEvent('eventType', { reason: {doremi: 12345} }).reason", "[object Object]");
shouldBeEqualToString("new AutocompleteErrorEvent('eventType', { reason: {valueOf: function () { return 'doremi'; } } }).reason", "[object Object]");
// All initializers are passed.
shouldBe("new AutocompleteErrorEvent('eventType', { bubbles: true, cancelable: true, reason: 'doremi' }).bubbles", "true");
shouldBe("new AutocompleteErrorEvent('eventType', { bubbles: true, cancelable: true, reason: 'doremi' }).cancelable", "true");
shouldBeEqualToString("new AutocompleteErrorEvent('eventType', { bubbles: true, cancelable: true, reason: 'doremi' }).reason", "doremi");
}
</script>
<script src="../../../resources/js-test-post.js"></script>
</body>
</html>