mirror of
https://github.com/jquery/jquery-ui.git
synced 2025-01-07 20:34:24 +00:00
updating tests to latest QUnit, using same, fixing a few assertions that relied on type casting (mostly null/undefined)
This commit is contained in:
parent
59109b7894
commit
b6cb342c65
@ -11,11 +11,11 @@ var defaults = {
|
||||
autoResize: true,
|
||||
buttons: {},
|
||||
disabled: false,
|
||||
dialogClass: null,
|
||||
dialogClass: undefined,
|
||||
draggable: true,
|
||||
height: 200,
|
||||
maxHeight: null,
|
||||
maxWidth: null,
|
||||
maxHeight: undefined,
|
||||
maxWidth: undefined,
|
||||
minHeight: 100,
|
||||
minWidth: 150,
|
||||
modal: false,
|
||||
@ -67,7 +67,7 @@ function moved(dx, dy, msg) {
|
||||
msg = msg ? msg + "." : "";
|
||||
var actual = { left: offsetAfter.left, top: offsetAfter.top };
|
||||
var expected = { left: offsetBefore.left + dx, top: offsetBefore.top + dy };
|
||||
compare2(actual, expected, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] ' + msg);
|
||||
same(actual, expected, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] ' + msg);
|
||||
}
|
||||
|
||||
function shouldmove(why) {
|
||||
@ -86,7 +86,7 @@ function resized(dw, dh, msg) {
|
||||
msg = msg ? msg + "." : "";
|
||||
var actual = { width: widthAfter, height: heightAfter };
|
||||
var expected = { width: widthBefore + dw, height: heightBefore + dh };
|
||||
compare2(actual, expected, 'resized[' + dragged.dx + ', ' + dragged.dy + '] ' + msg);
|
||||
same(actual, expected, 'resized[' + dragged.dx + ', ' + dragged.dy + '] ' + msg);
|
||||
}
|
||||
|
||||
function shouldresize(why) {
|
||||
@ -185,10 +185,8 @@ test("element types", function() {
|
||||
test("defaults", function() {
|
||||
el = $('<div/>').dialog();
|
||||
$.each(defaults, function(key, val) {
|
||||
var actual = el.data(key + ".dialog"), expected = val,
|
||||
method = (expected && expected.constructor == Object) ?
|
||||
compare2 : equals;
|
||||
method(actual, expected, key);
|
||||
var actual = el.data(key + ".dialog"), expected = val;
|
||||
same(actual, expected, key);
|
||||
});
|
||||
el.remove();
|
||||
});
|
||||
@ -244,7 +242,7 @@ test("autoResize", function() {
|
||||
handle = $(".ui-resizable-se", dlg());
|
||||
drag(handle, 50, 50);
|
||||
actual = { height: el.height() };
|
||||
compare2(actual, expected, '.dialog({ autoResize: false })');
|
||||
same(actual, expected, '.dialog({ autoResize: false })');
|
||||
el.remove();
|
||||
el = $('<div>content<br>content<br>content<br>content<br>content</div>').dialog({ autoResize: true });
|
||||
before = { width: el.width(), height: el.height() };
|
||||
@ -252,7 +250,7 @@ test("autoResize", function() {
|
||||
drag(handle, 50, 50);
|
||||
expected = { width: before.width + 50, height: before.height + 50 };
|
||||
actual = { width: el.width(), height: el.height() };
|
||||
compare2(actual, expected, '.dialog({ autoResize: true })');
|
||||
same(actual, expected, '.dialog({ autoResize: true })');
|
||||
el.remove();
|
||||
});
|
||||
|
||||
|
@ -22,7 +22,7 @@ var moved = function (dx, dy, msg) {
|
||||
msg = msg ? msg + "." : "";
|
||||
var actual = { left: offsetAfter.left, top: offsetAfter.top };
|
||||
var expected = { left: offsetBefore.left + dx, top: offsetBefore.top + dy };
|
||||
compare2(actual, expected, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] ' + msg);
|
||||
same(actual, expected, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] ' + msg);
|
||||
}
|
||||
|
||||
function shouldmove(why) {
|
||||
@ -266,7 +266,7 @@ test("{ containment: 'parent' }, relative", function() {
|
||||
left: po.left + border(p, 'left') + margin(el, 'left'),
|
||||
top: po.top + border(p, 'top') + margin(el, 'top')
|
||||
}
|
||||
compare2(offsetAfter, expected, 'compare offset to parent');
|
||||
same(offsetAfter, expected, 'compare offset to parent');
|
||||
});
|
||||
|
||||
test("{ containment: 'parent' }, absolute", function() {
|
||||
@ -277,7 +277,7 @@ test("{ containment: 'parent' }, absolute", function() {
|
||||
left: po.left + border(p, 'left') + margin(el, 'left'),
|
||||
top: po.top + border(p, 'top') + margin(el, 'top')
|
||||
}
|
||||
compare2(offsetAfter, expected, 'compare offset to parent');
|
||||
same(offsetAfter, expected, 'compare offset to parent');
|
||||
});
|
||||
|
||||
test("{ cursor: 'move' }", function() {
|
||||
@ -571,7 +571,7 @@ test("{ helper: 'clone' }, absolute", function() {
|
||||
|
||||
drag(el, 1, 1);
|
||||
|
||||
compare2({ top: helperOffset.top-1, left: helperOffset.left-1 }, origOffset, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] ');
|
||||
same({ top: helperOffset.top-1, left: helperOffset.left-1 }, origOffset, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] ');
|
||||
|
||||
});
|
||||
|
||||
@ -587,7 +587,7 @@ test("{ helper: 'clone' }, absolute with scroll offset on parent", function() {
|
||||
|
||||
drag(el, 1, 1);
|
||||
|
||||
compare2({ top: helperOffset.top-1, left: helperOffset.left-1 }, origOffset, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] ');
|
||||
same({ top: helperOffset.top-1, left: helperOffset.left-1 }, origOffset, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] ');
|
||||
$("#main")[0].scrollTop = 0;
|
||||
|
||||
});
|
||||
@ -604,7 +604,7 @@ test("{ helper: 'clone' }, absolute with scroll offset on root", function() {
|
||||
|
||||
drag(el, 1, 1);
|
||||
|
||||
compare2({ top: helperOffset.top-1, left: helperOffset.left-1 }, origOffset, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] ');
|
||||
same({ top: helperOffset.top-1, left: helperOffset.left-1 }, origOffset, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] ');
|
||||
$(document).scrollTop(0);
|
||||
|
||||
});
|
||||
@ -622,7 +622,7 @@ test("{ helper: 'clone' }, absolute with scroll offset on root and parent", func
|
||||
|
||||
drag(el, 1, 1);
|
||||
|
||||
compare2({ top: helperOffset.top-1, left: helperOffset.left-1 }, origOffset, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] ');
|
||||
same({ top: helperOffset.top-1, left: helperOffset.left-1 }, origOffset, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] ');
|
||||
$(document).scrollTop(0);
|
||||
$("#main")[0].scrollTop = 0;
|
||||
|
||||
|
@ -21,19 +21,19 @@ var drag = function(el, dx, dy, complete) {
|
||||
};
|
||||
|
||||
var defaults = {
|
||||
alsoResize: null,
|
||||
alsoResize: undefined,
|
||||
aspectRatio: false,
|
||||
autoHide: false,
|
||||
containment: null,
|
||||
grid: null,
|
||||
containment: undefined,
|
||||
grid: undefined,
|
||||
handles: 'e,s,se',
|
||||
helper: null,
|
||||
disabled: false,
|
||||
maxHeight: null,
|
||||
maxWidth: null,
|
||||
maxHeight: undefined,
|
||||
maxWidth: undefined,
|
||||
minHeight: 10,
|
||||
minWidth: 10,
|
||||
proportionallyResize: null
|
||||
proportionallyResize: undefined
|
||||
};
|
||||
|
||||
// Resizable Tests
|
||||
@ -107,10 +107,8 @@ test("element types", function() {
|
||||
test("defaults", function() {
|
||||
el = $('<div/>').resizable();
|
||||
$.each(defaults, function(key, val) {
|
||||
var actual = el.data(key + ".resizable"), expected = val,
|
||||
method = (expected && expected.constructor == Object) ?
|
||||
compare2 : equals;
|
||||
method(actual, expected, key);
|
||||
var actual = el.data(key + ".resizable"), expected = val;
|
||||
same(actual, expected, key);
|
||||
});
|
||||
el.remove();
|
||||
});
|
||||
|
@ -79,10 +79,8 @@ test("defaults", function() {
|
||||
filter: '*'
|
||||
};
|
||||
$.each(defaults, function(key, val) {
|
||||
var actual = el.data(key + ".selectable"), expected = val,
|
||||
method = (expected && expected.constructor == Object) ?
|
||||
compare2 : equals;
|
||||
method(actual, expected, key);
|
||||
var actual = el.data(key + ".selectable"), expected = val;
|
||||
same(actual, expected, key);
|
||||
});
|
||||
el.remove();
|
||||
});
|
||||
|
@ -61,12 +61,7 @@ module('tabs');
|
||||
|
||||
for (var optionName in expected) {
|
||||
var actual = el.data(optionName + '.tabs'), expects = expected[optionName];
|
||||
|
||||
if (optionName == 'disabled')
|
||||
compare(actual, expects, optionName);
|
||||
else
|
||||
equals(actual, expects, optionName);
|
||||
|
||||
same(actual, expects, optionName);
|
||||
}
|
||||
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user