OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <script src="../../../resources/js-test.js"></script> | 4 <script src="../../../resources/js-test.js"></script> |
5 </head> | 5 </head> |
6 <body> | 6 <body> |
7 <script> | 7 <script> |
8 | 8 |
9 description("This tests the constructor for the AutocompleteErrorEvent DOM class
."); | 9 description("This tests the constructor for the AutocompleteErrorEvent DOM class
."); |
10 | 10 |
11 if (!window.AutocompleteErrorEvent) { | 11 if (!window.AutocompleteErrorEvent) { |
12 testFailed('no AutocompleteErrorEvent'); | 12 testFailed('no AutocompleteErrorEvent'); |
13 finishJSTest(); | 13 finishJSTest(); |
14 } else { | 14 } else { |
15 // No initializer is passed. | 15 // No initializer is passed. |
16 shouldBe("new AutocompleteErrorEvent('eventType').bubbles", "false"); | 16 shouldBe("new AutocompleteErrorEvent('eventType').bubbles", "false"); |
17 shouldBe("new AutocompleteErrorEvent('eventType').cancelable", "false"); | 17 shouldBe("new AutocompleteErrorEvent('eventType').cancelable", "false"); |
18 shouldBeEqualToString("new AutocompleteErrorEvent('eventType').reason", ""); | 18 shouldBeEqualToString("new AutocompleteErrorEvent('eventType').reason", ""); |
19 | 19 |
20 // bubbles is passed. | 20 // bubbles is passed. |
21 shouldBe("new AutocompleteErrorEvent('eventType', { bubbles: false }).bubble
s", "false"); | 21 shouldBe("new AutocompleteErrorEvent('eventType', { bubbles: false }).bubble
s", "false"); |
22 shouldBe("new AutocompleteErrorEvent('eventType', { bubbles: true }).bubbles
", "true"); | 22 shouldBe("new AutocompleteErrorEvent('eventType', { bubbles: true }).bubbles
", "true"); |
23 | 23 |
24 // cancelable is passed. | 24 // cancelable is passed. |
25 shouldBe("new AutocompleteErrorEvent('eventType', { cancelable: false }).can
celable", "false"); | 25 shouldBe("new AutocompleteErrorEvent('eventType', { cancelable: false }).can
celable", "false"); |
26 shouldBe("new AutocompleteErrorEvent('eventType', { cancelable: true }).canc
elable", "true"); | 26 shouldBe("new AutocompleteErrorEvent('eventType', { cancelable: true }).canc
elable", "true"); |
27 | 27 |
28 // reason is passed. | 28 // reason is passed. |
29 shouldBeEqualToString("new AutocompleteErrorEvent('eventType', { reason: 'do
remi' }).reason", "doremi"); | 29 shouldBeEqualToString("new AutocompleteErrorEvent('eventType', { reason: 'ca
ncel' }).reason", "cancel"); |
30 shouldBeEqualToString("new AutocompleteErrorEvent('eventType', { reason: ''
}).reason", ""); | 30 shouldBeEqualToString("new AutocompleteErrorEvent('eventType', { reason: ''
}).reason", ""); |
| 31 shouldBeEqualToString("new AutocompleteErrorEvent('eventType', { reason: 'di
sabled' }).reason", "disabled"); |
| 32 shouldBeEqualToString("new AutocompleteErrorEvent('eventType', { reason: 'in
valid' }).reason", "invalid"); |
31 shouldBeEqualToString("new AutocompleteErrorEvent('eventType', { reason: und
efined }).reason", ""); | 33 shouldBeEqualToString("new AutocompleteErrorEvent('eventType', { reason: und
efined }).reason", ""); |
32 shouldBeEqualToString("new AutocompleteErrorEvent('eventType', { reason: nul
l }).reason", "null"); | 34 |
33 shouldBeEqualToString("new AutocompleteErrorEvent('eventType', { reason: fal
se }).reason", "false"); | 35 // Invalid reason throws exception |
34 shouldBeEqualToString("new AutocompleteErrorEvent('eventType', { reason: tru
e }).reason", "true"); | 36 shouldThrow("new AutocompleteErrorEvent('eventType', { reason: 'doremi' })")
; |
35 shouldBeEqualToString("new AutocompleteErrorEvent('eventType', { reason: 123
45 }).reason", "12345"); | 37 shouldThrow("new AutocompleteErrorEvent('eventType', { reason: null })"); |
36 shouldBeEqualToString("new AutocompleteErrorEvent('eventType', { reason: 184
46744073709551615 }).reason", "18446744073709552000"); | 38 shouldThrow("new AutocompleteErrorEvent('eventType', { reason: false })"); |
37 shouldBeEqualToString("new AutocompleteErrorEvent('eventType', { reason: NaN
}).reason", "NaN"); | 39 shouldThrow("new AutocompleteErrorEvent('eventType', { reason: true })"); |
38 shouldBeEqualToString("new AutocompleteErrorEvent('eventType', { reason: []
}).reason", ""); | 40 shouldThrow("new AutocompleteErrorEvent('eventType', { reason: 12345 })"); |
39 shouldBeEqualToString("new AutocompleteErrorEvent('eventType', { reason: [1,
2, 3] }).reason", "1,2,3"); | 41 shouldThrow("new AutocompleteErrorEvent('eventType', { reason: NaN })"); |
40 shouldBeEqualToString("new AutocompleteErrorEvent('eventType', { reason: {do
remi: 12345} }).reason", "[object Object]"); | |
41 shouldBeEqualToString("new AutocompleteErrorEvent('eventType', { reason: {va
lueOf: function () { return 'doremi'; } } }).reason", "[object Object]"); | |
42 | 42 |
43 // All initializers are passed. | 43 // All initializers are passed. |
44 shouldBe("new AutocompleteErrorEvent('eventType', { bubbles: true, cancelabl
e: true, reason: 'doremi' }).bubbles", "true"); | 44 shouldBe("new AutocompleteErrorEvent('eventType', { bubbles: true, cancelabl
e: true, reason: '' }).bubbles", "true"); |
45 shouldBe("new AutocompleteErrorEvent('eventType', { bubbles: true, cancelabl
e: true, reason: 'doremi' }).cancelable", "true"); | 45 shouldBe("new AutocompleteErrorEvent('eventType', { bubbles: true, cancelabl
e: true, reason: 'cancel' }).cancelable", "true"); |
46 shouldBeEqualToString("new AutocompleteErrorEvent('eventType', { bubbles: tr
ue, cancelable: true, reason: 'doremi' }).reason", "doremi"); | 46 shouldBeEqualToString("new AutocompleteErrorEvent('eventType', { bubbles: tr
ue, cancelable: true, reason: 'disabled' }).reason", "disabled"); |
47 } | 47 } |
48 | 48 |
49 </script> | 49 </script> |
50 </body> | 50 </body> |
51 </html> | 51 </html> |
OLD | NEW |