OLD | NEW |
(Empty) | |
| 1 'use strict'; |
| 2 |
| 3 importScripts('/resources/testharness.js'); |
| 4 |
| 5 test(function() { |
| 6 assert_own_property(self, 'BackgroundFetchClickEvent'); |
| 7 |
| 8 // The `tag` and `state` are required in the BackgroundFetchClickEventInit. |
| 9 assert_throws(null, () => new BackgroundFetchClickEvent('BackgroundFetchClickE
vent')); |
| 10 assert_throws(null, () => new BackgroundFetchClickEvent('BackgroundFetchClickE
vent', {})); |
| 11 assert_throws(null, () => new BackgroundFetchClickEvent('BackgroundFetchClickE
vent', { tag: 'foo' })); |
| 12 assert_throws(null, () => new BackgroundFetchClickEvent('BackgroundFetchClickE
vent', { tag: 'foo', state: 'foo' })); |
| 13 |
| 14 // The `state` must be one of { pending, succeeded, failed }. This should not
throw. |
| 15 for (let state of ['pending', 'succeeded', 'failed']) |
| 16 new BackgroundFetchClickEvent('BackgroundFetchClickEvent', { tag: 'foo', sta
te }); |
| 17 |
| 18 const event = new BackgroundFetchClickEvent('BackgroundFetchClickEvent', { |
| 19 tag: 'my-tag', |
| 20 state: 'succeeded' |
| 21 }); |
| 22 |
| 23 assert_equals(event.type, 'BackgroundFetchClickEvent'); |
| 24 assert_equals(event.cancelable, false); |
| 25 assert_equals(event.bubbles, false); |
| 26 assert_equals(event.tag, 'my-tag'); |
| 27 assert_equals(event.state, 'succeeded'); |
| 28 |
| 29 assert_inherits(event, 'waitUntil'); |
| 30 |
| 31 }, 'Verifies that the BackgroundFetchClickEvent can be constructed.'); |
OLD | NEW |