Skip to content

Commit b237c4b

Browse files
committed
Refine custom test for InstallEvent
1 parent f9bcb66 commit b237c4b

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

custom/tests.yaml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3293,13 +3293,19 @@ api:
32933293
var instance = new InputEvent('input');
32943294
InstallEvent:
32953295
__base: |-
3296+
if (!('InstallEvent' in self)) {
3297+
return {result: false, message: 'InstallEvent is not defined'}
3298+
}
32963299
// During the installation of the service worker, we set an "installEvent" global variable so that we may easily reuse it here:
32973300
// var installEvent = null;
32983301
// self.addEventListener('install', function (event) {
32993302
// installEvent = event;
33003303
// });
3301-
3302-
var instance = installEvent;
3304+
var name = installEvent.constructor.name;
3305+
if (name !== 'InstallEvent') {
3306+
return {result: true, message: 'InstallEvent is defined, but install event is an instance of ' + name}
3307+
}
3308+
var instance = installEvent instanceof InstallEvent ? installEvent : undefined;
33033309
IntersectionObserver:
33043310
IntersectionObserver:
33053311
__additional:

0 commit comments

Comments
 (0)