mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
Spinner: ui() doesn't return instance
This commit is contained in:
parent
bf1d243ce7
commit
c0147da718
@ -7,42 +7,33 @@
|
||||
module("spinner");
|
||||
|
||||
test("init", function() {
|
||||
expect(3);
|
||||
expect(2);
|
||||
|
||||
$("#spin").spinner();
|
||||
ok(true, '.spinner() called on element');
|
||||
|
||||
$([]).spinner().remove();
|
||||
ok(true, '.spinner() called on empty collection');
|
||||
|
||||
$('<input id="spinner_dis">').spinner().remove();
|
||||
ok(true, '.spinner() called on disconnected element');
|
||||
|
||||
});
|
||||
|
||||
test("destroy", function() {
|
||||
expect(3);
|
||||
expect(2);
|
||||
|
||||
$("#spin").spinner().spinner("destroy");
|
||||
ok(true, '.spinner("destroy") called on element');
|
||||
|
||||
$([]).spinner().spinner("destroy").remove();
|
||||
ok(true, '.spinner().spinner("destroy") called on empty collection');
|
||||
|
||||
$('<input id="spinner_dis">').spinner().spinner("destroy").remove();
|
||||
ok(true, '.spinner().spinner("destroy") called on disconnected element');
|
||||
|
||||
});
|
||||
|
||||
test("re-attach", function() {
|
||||
expect(3);
|
||||
expect(2);
|
||||
|
||||
el = $("#spin").spinner().spinner("destroy").spinner();
|
||||
ok(true, '.spinner().spinner("destroy").spinner() called on element');
|
||||
|
||||
$([]).spinner().spinner("destroy").spinner().remove();
|
||||
ok(true, '.spinner().spinner("destroy").spinner() called on empty collection');
|
||||
|
||||
$('<input id="spinner_dis">').spinner().spinner("destroy").spinner().remove();
|
||||
ok(true, '.spinner().spinner("destroy").spinner() called on disconnected element');
|
||||
|
||||
|
@ -204,7 +204,6 @@ $.widget('ui.spinner', {
|
||||
plugins: {},
|
||||
ui: function(e) {
|
||||
return {
|
||||
instance: this,
|
||||
options: this.options,
|
||||
element: this.element,
|
||||
value: this._getValue()
|
||||
@ -216,7 +215,9 @@ $.widget('ui.spinner', {
|
||||
},
|
||||
destroy: function() {
|
||||
if(!$.data(this.element[0], 'spinner')) return;
|
||||
|
||||
if ($.fn.mousewheel) {
|
||||
this.element.unmousewheel();
|
||||
}
|
||||
this.element
|
||||
.removeClass('ui-spinner-box')
|
||||
.removeAttr('disabled')
|
||||
@ -230,10 +231,6 @@ $.widget('ui.spinner', {
|
||||
.before(this.element.clone())
|
||||
.remove()
|
||||
.end();
|
||||
|
||||
if ($.fn.mousewheel) {
|
||||
this.element.unmousewheel();
|
||||
}
|
||||
},
|
||||
enable: function() {
|
||||
this.element
|
||||
|
Loading…
Reference in New Issue
Block a user