mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
parent
57537d09a4
commit
3dd8a09b44
@ -786,7 +786,7 @@ QUnit.test( ".widget() - overriden", function( assert ) {
|
|||||||
} );
|
} );
|
||||||
|
|
||||||
QUnit.test( ".instance()", function( assert ) {
|
QUnit.test( ".instance()", function( assert ) {
|
||||||
assert.expect( 2 );
|
assert.expect( 3 );
|
||||||
var div;
|
var div;
|
||||||
|
|
||||||
$.widget( "ui.testWidget", {
|
$.widget( "ui.testWidget", {
|
||||||
@ -794,9 +794,11 @@ QUnit.test( ".instance()", function( assert ) {
|
|||||||
} );
|
} );
|
||||||
|
|
||||||
div = $( "<div>" );
|
div = $( "<div>" );
|
||||||
assert.equal( div.testWidget( "instance" ), undefined );
|
assert.equal( div.testWidget( "instance" ), undefined, "uninitialized" );
|
||||||
div.testWidget();
|
div.testWidget();
|
||||||
assert.equal( div.testWidget( "instance" ), div.testWidget( "instance" ) );
|
assert.equal( div.testWidget( "instance" ), div.testWidget( "instance" ), "initialized" );
|
||||||
|
|
||||||
|
assert.equal( $().testWidget( "instance" ), undefined, "empty set" );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
QUnit.test( "._on() to element (default)", function( assert ) {
|
QUnit.test( "._on() to element (default)", function( assert ) {
|
||||||
|
@ -215,6 +215,12 @@ $.widget.bridge = function( name, object ) {
|
|||||||
var returnValue = this;
|
var returnValue = this;
|
||||||
|
|
||||||
if ( isMethodCall ) {
|
if ( isMethodCall ) {
|
||||||
|
|
||||||
|
// If this is an empty collection, we need to have the instance method
|
||||||
|
// return undefined instead of the jQuery instance
|
||||||
|
if ( !this.length && options === "instance" ) {
|
||||||
|
returnValue = undefined;
|
||||||
|
} else {
|
||||||
this.each( function() {
|
this.each( function() {
|
||||||
var methodValue;
|
var methodValue;
|
||||||
var instance = $.data( this, fullName );
|
var instance = $.data( this, fullName );
|
||||||
@ -244,6 +250,7 @@ $.widget.bridge = function( name, object ) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
// Allow multiple hashes to be passed on init
|
// Allow multiple hashes to be passed on init
|
||||||
|
Loading…
Reference in New Issue
Block a user