mirror of
https://github.com/jquery/jquery-ui.git
synced 2025-01-07 20:34:24 +00:00
Tests: Lint.
This commit is contained in:
parent
a28983086e
commit
a0fb2c227e
@ -15,7 +15,7 @@ test("create", function() {
|
|||||||
change: function() {
|
change: function() {
|
||||||
ok(false, 'create() has triggered change()');
|
ok(false, 'create() has triggered change()');
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test("change", function() {
|
test("change", function() {
|
||||||
|
@ -20,7 +20,7 @@ test("init", function() {
|
|||||||
$('<div></div>').resizable().resizable("foo").remove();
|
$('<div></div>').resizable().resizable("foo").remove();
|
||||||
ok(true, 'arbitrary method called after init');
|
ok(true, 'arbitrary method called after init');
|
||||||
|
|
||||||
el = $('<div></div>').resizable()
|
el = $('<div></div>').resizable();
|
||||||
var foo = el.resizable("option", "foo");
|
var foo = el.resizable("option", "foo");
|
||||||
el.remove();
|
el.remove();
|
||||||
ok(true, 'arbitrary option getter after init');
|
ok(true, 'arbitrary option getter after init');
|
||||||
|
@ -20,7 +20,7 @@ test("init", function() {
|
|||||||
$("<div></div>").selectable().selectable("foo").remove();
|
$("<div></div>").selectable().selectable("foo").remove();
|
||||||
ok(true, 'arbitrary method called after init');
|
ok(true, 'arbitrary method called after init');
|
||||||
|
|
||||||
el = $("<div></div>").selectable()
|
el = $("<div></div>").selectable();
|
||||||
var foo = el.selectable("option", "foo");
|
var foo = el.selectable("option", "foo");
|
||||||
el.remove();
|
el.remove();
|
||||||
ok(true, 'arbitrary option getter after init');
|
ok(true, 'arbitrary option getter after init');
|
||||||
@ -49,7 +49,8 @@ test("destroy", function() {
|
|||||||
|
|
||||||
test("enable", function() {
|
test("enable", function() {
|
||||||
expect(3);
|
expect(3);
|
||||||
var fired = false;
|
var expected, actual,
|
||||||
|
fired = false;
|
||||||
|
|
||||||
el = $("#selectable1");
|
el = $("#selectable1");
|
||||||
el.selectable({
|
el.selectable({
|
||||||
@ -63,14 +64,15 @@ test("enable", function() {
|
|||||||
equal(fired, true, "start fired");
|
equal(fired, true, "start fired");
|
||||||
el.selectable("destroy");
|
el.selectable("destroy");
|
||||||
|
|
||||||
var expected = $('<div></div>').selectable(),
|
expected = $('<div></div>').selectable();
|
||||||
actual = expected.selectable('enable');
|
actual = expected.selectable('enable');
|
||||||
equal(actual, expected, 'enable is chainable');
|
equal(actual, expected, 'enable is chainable');
|
||||||
});
|
});
|
||||||
|
|
||||||
test("disable", function() {
|
test("disable", function() {
|
||||||
expect(3);
|
expect(3);
|
||||||
var fired = false;
|
var expected, actual,
|
||||||
|
fired = false;
|
||||||
|
|
||||||
el = $("#selectable1");
|
el = $("#selectable1");
|
||||||
el.selectable({
|
el.selectable({
|
||||||
@ -85,7 +87,7 @@ test("disable", function() {
|
|||||||
equal(fired, false, "start fired");
|
equal(fired, false, "start fired");
|
||||||
el.selectable("destroy");
|
el.selectable("destroy");
|
||||||
|
|
||||||
var expected = $('<div></div>').selectable(),
|
expected = $('<div></div>').selectable();
|
||||||
actual = expected.selectable('disable');
|
actual = expected.selectable('disable');
|
||||||
equal(actual, expected, 'disable is chainable');
|
equal(actual, expected, 'disable is chainable');
|
||||||
});
|
});
|
||||||
|
@ -8,7 +8,7 @@ module("selectable: options");
|
|||||||
test("autoRefresh", function() {
|
test("autoRefresh", function() {
|
||||||
expect(3);
|
expect(3);
|
||||||
el = $("#selectable1");
|
el = $("#selectable1");
|
||||||
var actual, sel = $("*", el), selected = function() { actual += 1 };
|
var actual, sel = $("*", el), selected = function() { actual += 1; };
|
||||||
|
|
||||||
actual = 0;
|
actual = 0;
|
||||||
el = $("#selectable1").selectable({ autoRefresh: false, selected: selected });
|
el = $("#selectable1").selectable({ autoRefresh: false, selected: selected });
|
||||||
@ -33,12 +33,12 @@ test("autoRefresh", function() {
|
|||||||
test("filter", function() {
|
test("filter", function() {
|
||||||
expect(2);
|
expect(2);
|
||||||
el = $("#selectable1");
|
el = $("#selectable1");
|
||||||
var actual, sel = $("*", el), selected = function() { actual += 1 };
|
var actual, sel = $("*", el), selected = function() { actual += 1; };
|
||||||
|
|
||||||
actual = 0;
|
actual = 0;
|
||||||
el = $("#selectable1").selectable({ filter: '.special', selected: selected });
|
el = $("#selectable1").selectable({ filter: '.special', selected: selected });
|
||||||
drag(1000, 1000);
|
drag(1000, 1000);
|
||||||
ok(sel.length != 1, "this test assumes more than 1 selectee");
|
ok(sel.length !== 1, "this test assumes more than 1 selectee");
|
||||||
equal(actual, 1);
|
equal(actual, 1);
|
||||||
el.selectable("destroy");
|
el.selectable("destroy");
|
||||||
});
|
});
|
||||||
|
@ -17,8 +17,8 @@ test("init", function() {
|
|||||||
$('<div></div>').slider().remove();
|
$('<div></div>').slider().remove();
|
||||||
ok(true, '.slider() called on disconnected DOMElement');
|
ok(true, '.slider() called on disconnected DOMElement');
|
||||||
|
|
||||||
var el = $('<div></div>').slider();
|
var el = $('<div></div>').slider(),
|
||||||
var foo = el.slider("option", "foo");
|
foo = el.slider("option", "foo");
|
||||||
el.remove();
|
el.remove();
|
||||||
ok(true, 'arbitrary option getter after init');
|
ok(true, 'arbitrary option getter after init');
|
||||||
|
|
||||||
@ -42,11 +42,12 @@ test("destroy", function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test("enable", function() {
|
test("enable", function() {
|
||||||
var expected = $('<div></div>').slider(),
|
var el,
|
||||||
|
expected = $('<div></div>').slider(),
|
||||||
actual = expected.slider('enable');
|
actual = expected.slider('enable');
|
||||||
equal(actual, expected, 'enable is chainable');
|
equal(actual, expected, 'enable is chainable');
|
||||||
|
|
||||||
var el = $('<div></div>').slider({ disabled: true });
|
el = $('<div></div>').slider({ disabled: true });
|
||||||
ok(el.hasClass('ui-disabled'), 'slider has ui-disabled class before enable method call');
|
ok(el.hasClass('ui-disabled'), 'slider has ui-disabled class before enable method call');
|
||||||
ok(el.hasClass('ui-slider-disabled'), 'slider has ui-slider-disabled class before enable method call');
|
ok(el.hasClass('ui-slider-disabled'), 'slider has ui-slider-disabled class before enable method call');
|
||||||
el.slider('enable');
|
el.slider('enable');
|
||||||
@ -55,11 +56,12 @@ test("enable", function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test("disable", function() {
|
test("disable", function() {
|
||||||
var expected = $('<div></div>').slider(),
|
var el,
|
||||||
|
expected = $('<div></div>').slider(),
|
||||||
actual = expected.slider('disable');
|
actual = expected.slider('disable');
|
||||||
equal(actual, expected, 'disable is chainable');
|
equal(actual, expected, 'disable is chainable');
|
||||||
|
|
||||||
var el = $('<div></div>').slider({ disabled: false });
|
el = $('<div></div>').slider({ disabled: false });
|
||||||
ok(!el.hasClass('ui-disabled'), 'slider does not have ui-disabled class before disabled method call');
|
ok(!el.hasClass('ui-disabled'), 'slider does not have ui-disabled class before disabled method call');
|
||||||
ok(!el.hasClass('ui-slider-disabled'), 'slider does not have ui-slider-disabled class before disable method call');
|
ok(!el.hasClass('ui-slider-disabled'), 'slider does not have ui-slider-disabled class before disable method call');
|
||||||
el.slider('disable');
|
el.slider('disable');
|
||||||
|
@ -23,8 +23,8 @@ test("max", function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
el.slider(options);
|
el.slider(options);
|
||||||
ok(el.slider("option", "value") == options.value, "value option is not contained by max");
|
ok(el.slider("option", "value") === options.value, "value option is not contained by max");
|
||||||
ok(el.slider("value") == options.max, "value method is contained by max");
|
ok(el.slider("value") === options.max, "value method is contained by max");
|
||||||
el.slider('destroy');
|
el.slider('destroy');
|
||||||
|
|
||||||
});
|
});
|
||||||
@ -41,8 +41,8 @@ test("min", function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
el.slider(options);
|
el.slider(options);
|
||||||
ok(el.slider("option", "value") == options.value, "value option is not contained by min");
|
ok(el.slider("option", "value") === options.value, "value option is not contained by min");
|
||||||
ok(el.slider("value") == options.min, "value method is contained by min");
|
ok(el.slider("value") === options.min, "value method is contained by min");
|
||||||
el.slider('destroy');
|
el.slider('destroy');
|
||||||
|
|
||||||
});
|
});
|
||||||
@ -73,7 +73,7 @@ test("orientation", function() {
|
|||||||
value: -1
|
value: -1
|
||||||
};
|
};
|
||||||
|
|
||||||
var percentVal = (options.value - options.min) / (options.max - options.min) * 100;
|
percentVal = (options.value - options.min) / (options.max - options.min) * 100;
|
||||||
|
|
||||||
el.slider(options).slider("option", "orientation", "vertical");
|
el.slider(options).slider("option", "orientation", "vertical");
|
||||||
ok(el.is('.ui-slider-vertical'), "vertical slider has class .ui-slider-vertical");
|
ok(el.is('.ui-slider-vertical'), "vertical slider has class .ui-slider-vertical");
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
var el, offsetBefore, offsetAfter, dragged;
|
var el, offsetBefore, offsetAfter, dragged;
|
||||||
|
|
||||||
var drag = function(handle, dx, dy) {
|
function drag(handle, dx, dy) {
|
||||||
offsetBefore = $(handle).offset();
|
offsetBefore = $(handle).offset();
|
||||||
$(handle).simulate("drag", {
|
$(handle).simulate("drag", {
|
||||||
dx: dx || 0,
|
dx: dx || 0,
|
||||||
@ -15,7 +15,7 @@ var drag = function(handle, dx, dy) {
|
|||||||
offsetAfter = $(handle).offset();
|
offsetAfter = $(handle).offset();
|
||||||
}
|
}
|
||||||
|
|
||||||
var sort = function(handle, dx, dy, index, msg) {
|
function sort(handle, dx, dy, index, msg) {
|
||||||
drag(handle, dx, dy);
|
drag(handle, dx, dy);
|
||||||
equal($(handle).parent().children().index(handle), index, msg);
|
equal($(handle).parent().children().index(handle), index, msg);
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
var el, offsetBefore, offsetAfter, dragged;
|
var el, offsetBefore, offsetAfter, dragged;
|
||||||
|
|
||||||
var drag = function(handle, dx, dy) {
|
function drag(handle, dx, dy) {
|
||||||
offsetBefore = $(handle).offset();
|
offsetBefore = $(handle).offset();
|
||||||
$(handle).simulate("drag", {
|
$(handle).simulate("drag", {
|
||||||
dx: dx || 0,
|
dx: dx || 0,
|
||||||
@ -15,7 +15,7 @@ var drag = function(handle, dx, dy) {
|
|||||||
offsetAfter = $(handle).offset();
|
offsetAfter = $(handle).offset();
|
||||||
}
|
}
|
||||||
|
|
||||||
var sort = function(handle, dx, dy, index, msg) {
|
function sort(handle, dx, dy, index, msg) {
|
||||||
drag(handle, dx, dy);
|
drag(handle, dx, dy);
|
||||||
equal($(handle).parent().children().index(handle), index, msg);
|
equal($(handle).parent().children().index(handle), index, msg);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user