@@ -7,6 +7,18 @@ var createParagraph = function(text) {
7
7
return p ;
8
8
}
9
9
10
+ function simulateClick ( node ) {
11
+ var oEvent ;
12
+ if ( document . createEvent ) {
13
+ oEvent = document . createEvent ( 'MouseEvents' ) ;
14
+ oEvent . initMouseEvent ( 'click' , true , true , document . defaultView ,
15
+ 0 , 0 , 0 , 0 , 0 , false , false , false , false , 0 , node ) ;
16
+ node . dispatchEvent ( oEvent ) ;
17
+ } else {
18
+ node . click ( ) ;
19
+ }
20
+ }
21
+
10
22
new Test . Unit . Runner ( {
11
23
setup : function ( ) {
12
24
if ( documentViewportProperties ) return ;
@@ -1550,15 +1562,20 @@ new Test.Unit.Runner({
1550
1562
child . store ( 'foo' , 'bar' ) ;
1551
1563
1552
1564
var trigger = false ;
1553
- child . observe ( 'test:event ' , function ( event ) { trigger = true ; } ) ;
1565
+ child . observe ( 'click ' , function ( event ) { trigger = true ; } ) ;
1554
1566
var childUID = child . _prototypeUID ;
1555
1567
1556
1568
parent . update ( "" ) ;
1557
1569
1558
1570
// At this point, `child` should have been purged.
1559
- this . assert ( ! ( childUID in Element . Storage ) , "purged element's UID should no longer exist in `Element.Storage`" ) ;
1560
-
1561
- var event = child . fire ( 'test:event' ) ;
1571
+ this . assert (
1572
+ ! ( childUID in Element . Storage ) ,
1573
+ "purged element's UID should no longer exist in `Element.Storage`"
1574
+ ) ;
1575
+
1576
+ // Simulate a click to be sure the element's handler has been
1577
+ // unregistered.
1578
+ simulateClick ( child ) ;
1562
1579
this . assert ( ! trigger , "fired event should not have triggered handler" ) ;
1563
1580
}
1564
1581
} ) ;
0 commit comments