mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
Widget: Tests code cleanup
This commit is contained in:
parent
609e1f87f4
commit
d12180d1a5
@ -571,23 +571,23 @@ test( ".widget() - overriden", function() {
|
||||
|
||||
test( "._bind() to element (default)", function() {
|
||||
expect( 12 );
|
||||
var self;
|
||||
var that;
|
||||
$.widget( "ui.testWidget", {
|
||||
_create: function() {
|
||||
self = this;
|
||||
that = this;
|
||||
this._bind({
|
||||
keyup: this.keyup,
|
||||
keydown: "keydown"
|
||||
});
|
||||
},
|
||||
keyup: function( event ) {
|
||||
equals( self, this );
|
||||
equals( self.element[0], event.currentTarget );
|
||||
equals( that, this );
|
||||
equals( that.element[0], event.currentTarget );
|
||||
equals( "keyup", event.type );
|
||||
},
|
||||
keydown: function( event ) {
|
||||
equals( self, this );
|
||||
equals( self.element[0], event.currentTarget );
|
||||
equals( that, this );
|
||||
equals( that.element[0], event.currentTarget );
|
||||
equals( "keydown", event.type );
|
||||
}
|
||||
});
|
||||
@ -611,23 +611,23 @@ test( "._bind() to element (default)", function() {
|
||||
|
||||
test( "._bind() to descendent", function() {
|
||||
expect( 12 );
|
||||
var self;
|
||||
var that;
|
||||
$.widget( "ui.testWidget", {
|
||||
_create: function() {
|
||||
self = this;
|
||||
that = this;
|
||||
this._bind( this.element.find( "strong" ), {
|
||||
keyup: this.keyup,
|
||||
keydown: "keydown"
|
||||
});
|
||||
},
|
||||
keyup: function( event ) {
|
||||
equals( self, this );
|
||||
equals( self.element.find( "strong" )[0], event.currentTarget );
|
||||
equals( that, this );
|
||||
equals( that.element.find( "strong" )[0], event.currentTarget );
|
||||
equals( "keyup", event.type );
|
||||
},
|
||||
keydown: function(event) {
|
||||
equals( self, this );
|
||||
equals( self.element.find( "strong" )[0], event.currentTarget );
|
||||
equals( that, this );
|
||||
equals( that.element.find( "strong" )[0], event.currentTarget );
|
||||
equals( "keydown", event.type );
|
||||
}
|
||||
});
|
||||
|
@ -6,7 +6,6 @@ test( "$.widget.extend()", function() {
|
||||
optionsCopy = { xnumber2: 1, xstring2: "x", xxx: "newstring" },
|
||||
merged = { xnumber1: 5, xnumber2: 1, xstring1: "peter", xstring2: "x", xxx: "newstring" },
|
||||
deep1 = { foo: { bar: true } },
|
||||
deep1copy = { foo: { bar: true } },
|
||||
deep2 = { foo: { baz: true }, foo2: document },
|
||||
deep2copy = { foo: { baz: true }, foo2: document },
|
||||
deepmerged = { foo: { bar: true, baz: true }, foo2: document },
|
||||
@ -96,7 +95,7 @@ test( "$.widget.extend()", function() {
|
||||
|
||||
var input = {
|
||||
key: [ 1, 2, 3 ]
|
||||
}
|
||||
};
|
||||
var output = $.widget.extend( {}, input );
|
||||
deepEqual( input, output, "don't clone arrays" );
|
||||
input.key[0] = 10;
|
||||
|
Loading…
Reference in New Issue
Block a user