mirror of
https://github.com/jquery/jquery.git
synced 2024-11-23 02:54:22 +00:00
Tests: fix function reference for unbinding
Ref gh-2958
This commit is contained in:
parent
c9efd11f47
commit
50b94f47d2
@ -687,15 +687,15 @@ QUnit.test( "on(), with different this object", function( assert ) {
|
|||||||
data = { myData: true },
|
data = { myData: true },
|
||||||
handler1 = function() {
|
handler1 = function() {
|
||||||
assert.equal( this, thisObject, "on() with different this object" );
|
assert.equal( this, thisObject, "on() with different this object" );
|
||||||
},
|
}.bind( thisObject ),
|
||||||
handler2 = function( event ) {
|
handler2 = function( event ) {
|
||||||
assert.equal( this, thisObject, "on() with different this object and data" );
|
assert.equal( this, thisObject, "on() with different this object and data" );
|
||||||
assert.equal( event.data, data, "on() with different this object and data" );
|
assert.equal( event.data, data, "on() with different this object and data" );
|
||||||
};
|
}.bind( thisObject );
|
||||||
|
|
||||||
jQuery( "#firstp" )
|
jQuery( "#firstp" )
|
||||||
.on( "click", handler1.bind( thisObject ) ).trigger( "click" ).off( "click", handler1 )
|
.on( "click", handler1 ).trigger( "click" ).off( "click", handler1 )
|
||||||
.on( "click", data, handler2.bind( thisObject ) ).trigger( "click" ).off( "click", handler2 );
|
.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." );
|
assert.ok( !jQuery._data( jQuery( "#firstp" )[ 0 ], "events" ), "Event handler unbound when using different this object and data." );
|
||||||
} );
|
} );
|
||||||
|
Loading…
Reference in New Issue
Block a user