@@ -2,6 +2,7 @@ import anyTest, { TestInterface } from 'ava';
2
2
import { HTMLElement , appendGlobalEventProperties } from '../../worker-thread/dom/HTMLElement' ;
3
3
import { createTestingDocument } from '../DocumentCreation' ;
4
4
import { Document } from '../../worker-thread/dom/Document' ;
5
+ import { Event } from '../../worker-thread/Event' ;
5
6
import { TransferrableKeys } from '../../transfer/TransferrableKeys' ;
6
7
7
8
const test = anyTest as TestInterface < {
@@ -84,3 +85,17 @@ test('appending as many keys as there are TransferrableKeys functions', (t) => {
84
85
element . ontouchmove = handler ;
85
86
t . is ( element . ontouchmove , handler ) ;
86
87
} ) ;
88
+
89
+ test . serial ( 'unsubscription with `null` value does not cause an error' , ( t ) => {
90
+ const { element } = t . context ;
91
+ const handler = ( e : any ) => console . log ( e ) ;
92
+
93
+ t . is ( element . onclick , null ) ;
94
+ element . onclick = handler ;
95
+ t . is ( element . onclick , handler ) ;
96
+ element . dispatchEvent ( new Event ( "click" , { } ) ) ;
97
+
98
+ element . onclick = null ;
99
+ t . is ( element . onclick , null ) ;
100
+ element . dispatchEvent ( new Event ( "click" , { } ) ) ;
101
+ } ) ;
0 commit comments