Chromium Code Reviews| 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 shouldThrow("new AutocompleteErrorEvent('eventType', { reason: 'doremi' }).r eason"); |
|
philipj_slow
2015/06/16 07:35:48
Please remove the trailing ".reason" as it is the
shiva.jm
2015/06/16 09:04:47
Done.
| |
| 33 shouldBeEqualToString("new AutocompleteErrorEvent('eventType', { reason: fal se }).reason", "false"); | 35 shouldThrow("new AutocompleteErrorEvent('eventType', { reason: null }).reaso n"); |
| 34 shouldBeEqualToString("new AutocompleteErrorEvent('eventType', { reason: tru e }).reason", "true"); | 36 shouldThrow("new AutocompleteErrorEvent('eventType', { reason: false }).reas on"); |
| 35 shouldBeEqualToString("new AutocompleteErrorEvent('eventType', { reason: 123 45 }).reason", "12345"); | 37 shouldThrow("new AutocompleteErrorEvent('eventType', { reason: true }).reaso n"); |
| 36 shouldBeEqualToString("new AutocompleteErrorEvent('eventType', { reason: 184 46744073709551615 }).reason", "18446744073709552000"); | 38 shouldThrow("new AutocompleteErrorEvent('eventType', { reason: 12345 }).reas on"); |
| 37 shouldBeEqualToString("new AutocompleteErrorEvent('eventType', { reason: NaN }).reason", "NaN"); | 39 shouldThrow("new AutocompleteErrorEvent('eventType', { reason: NaN }).reason "); |
| 38 shouldBeEqualToString("new AutocompleteErrorEvent('eventType', { reason: [] }).reason", ""); | |
| 39 shouldBeEqualToString("new AutocompleteErrorEvent('eventType', { reason: [1, 2, 3] }).reason", "1,2,3"); | |
| 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 | 40 |
| 43 // All initializers are passed. | 41 // All initializers are passed. |
| 44 shouldBe("new AutocompleteErrorEvent('eventType', { bubbles: true, cancelabl e: true, reason: 'doremi' }).bubbles", "true"); | 42 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"); | 43 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"); | 44 shouldBeEqualToString("new AutocompleteErrorEvent('eventType', { bubbles: tr ue, cancelable: true, reason: 'disabled' }).reason", "disabled"); |
| 47 } | 45 } |
| 48 | 46 |
| 49 </script> | 47 </script> |
| 50 </body> | 48 </body> |
| 51 </html> | 49 </html> |
| OLD | NEW |