Skip to content

Commit

Permalink
Tests: fix function reference for unbinding
Browse files Browse the repository at this point in the history
  • Loading branch information
timmywil committed Jan 8, 2018
1 parent c9efd11 commit 50b94f4
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions test/unit/event.js
Expand Up @@ -687,15 +687,15 @@ QUnit.test( "on(), with different this object", function( assert ) {
data = { myData: true },
handler1 = function() {
assert.equal( this, thisObject, "on() with different this object" );
},
}.bind( thisObject ),
handler2 = function( event ) {
assert.equal( this, thisObject, "on() with different this object and data" );
assert.equal( event.data, data, "on() with different this object and data" );
};
}.bind( thisObject );

jQuery( "#firstp" )
.on( "click", handler1.bind( thisObject ) ).trigger( "click" ).off( "click", handler1 )
.on( "click", data, handler2.bind( thisObject ) ).trigger( "click" ).off( "click", handler2 );
.on( "click", handler1 ).trigger( "click" ).off( "click", handler1 )
.on( "click", data, handler2 ).trigger( "click" ).off( "click", handler2 );

assert.ok( !jQuery._data( jQuery( "#firstp" )[ 0 ], "events" ), "Event handler unbound when using different this object and data." );
} );
Expand Down

0 comments on commit 50b94f4

Please sign in to comment.