mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
Merge branch 'master' into interactions
Conflicts: tests/unit/draggable/draggable_options.js ui/jquery.ui.draggable.js ui/jquery.ui.droppable.js ui/jquery.ui.sortable.js
This commit is contained in:
commit
a3c8c19775
@ -24,7 +24,7 @@
|
|||||||
$(function() {
|
$(function() {
|
||||||
var tabTitle = $( "#tab_title" ),
|
var tabTitle = $( "#tab_title" ),
|
||||||
tabContent = $( "#tab_content" ),
|
tabContent = $( "#tab_content" ),
|
||||||
tabTemplate = "<li><a href='#{href}'>#{label}</a> <span class='ui-icon ui-icon-close'>Remove Tab</span></li>",
|
tabTemplate = "<li><a href='#{href}'>#{label}</a> <span class='ui-icon ui-icon-close' role='presentation'>Remove Tab</span></li>",
|
||||||
tabCounter = 2;
|
tabCounter = 2;
|
||||||
|
|
||||||
var tabs = $( "#tabs" ).tabs();
|
var tabs = $( "#tabs" ).tabs();
|
||||||
@ -75,11 +75,19 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
// close icon: removing the tab on click
|
// close icon: removing the tab on click
|
||||||
$( "#tabs span.ui-icon-close" ).live( "click", function() {
|
tabs.delegate( "span.ui-icon-close", "click", function() {
|
||||||
var panelId = $( this ).closest( "li" ).remove().attr( "aria-controls" );
|
var panelId = $( this ).closest( "li" ).remove().attr( "aria-controls" );
|
||||||
$( "#" + panelId ).remove();
|
$( "#" + panelId ).remove();
|
||||||
tabs.tabs( "refresh" );
|
tabs.tabs( "refresh" );
|
||||||
});
|
});
|
||||||
|
|
||||||
|
tabs.bind( "keyup", function( event ) {
|
||||||
|
if ( event.altKey && event.keyCode === $.ui.keyCode.BACKSPACE ) {
|
||||||
|
var panelId = tabs.find( ".ui-tabs-active" ).remove().attr( "aria-controls" );
|
||||||
|
$( "#" + panelId ).remove();
|
||||||
|
tabs.tabs( "refresh" );
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
@ -100,7 +108,7 @@
|
|||||||
|
|
||||||
<div id="tabs">
|
<div id="tabs">
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="#tabs-1">Nunc tincidunt</a> <span class="ui-icon ui-icon-close">Remove Tab</span></li>
|
<li><a href="#tabs-1">Nunc tincidunt</a> <span class="ui-icon ui-icon-close" role="presentation">Remove Tab</span></li>
|
||||||
</ul>
|
</ul>
|
||||||
<div id="tabs-1">
|
<div id="tabs-1">
|
||||||
<p>Proin elit arcu, rutrum commodo, vehicula tempus, commodo a, risus. Curabitur nec arcu. Donec sollicitudin mi sit amet mauris. Nam elementum quam ullamcorper ante. Etiam aliquet massa et lorem. Mauris dapibus lacus auctor risus. Aenean tempor ullamcorper leo. Vivamus sed magna quis ligula eleifend adipiscing. Duis orci. Aliquam sodales tortor vitae ipsum. Aliquam nulla. Duis aliquam molestie erat. Ut et mauris vel pede varius sollicitudin. Sed ut dolor nec orci tincidunt interdum. Phasellus ipsum. Nunc tristique tempus lectus.</p>
|
<p>Proin elit arcu, rutrum commodo, vehicula tempus, commodo a, risus. Curabitur nec arcu. Donec sollicitudin mi sit amet mauris. Nam elementum quam ullamcorper ante. Etiam aliquet massa et lorem. Mauris dapibus lacus auctor risus. Aenean tempor ullamcorper leo. Vivamus sed magna quis ligula eleifend adipiscing. Duis orci. Aliquam sodales tortor vitae ipsum. Aliquam nulla. Duis aliquam molestie erat. Ut et mauris vel pede varius sollicitudin. Sed ut dolor nec orci tincidunt interdum. Phasellus ipsum. Nunc tristique tempus lectus.</p>
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
"latedef": true,
|
"latedef": true,
|
||||||
"noarg": true,
|
"noarg": true,
|
||||||
"onevar": true,
|
"onevar": true,
|
||||||
|
"quotmark": "double",
|
||||||
"trailing": true,
|
"trailing": true,
|
||||||
"undef": true,
|
"undef": true,
|
||||||
"unused": true,
|
"unused": true,
|
||||||
|
@ -35,6 +35,10 @@
|
|||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
line-height: 15px;
|
line-height: 15px;
|
||||||
}
|
}
|
||||||
|
/* avoid IE7 oscillating between overflow visible and scroll values */
|
||||||
|
#list1 > div {
|
||||||
|
overflow: visible;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
@ -6,19 +6,19 @@
|
|||||||
module("core - selectors");
|
module("core - selectors");
|
||||||
|
|
||||||
function isFocusable(selector, msg) {
|
function isFocusable(selector, msg) {
|
||||||
QUnit.push($(selector).is(':focusable'), null, null, msg + " - selector " + selector + " is focusable");
|
QUnit.push($(selector).is(":focusable"), null, null, msg + " - selector " + selector + " is focusable");
|
||||||
}
|
}
|
||||||
|
|
||||||
function isNotFocusable(selector, msg) {
|
function isNotFocusable(selector, msg) {
|
||||||
QUnit.push($(selector).length && !$(selector).is(':focusable'), null, null, msg + " - selector " + selector + " is not focusable");
|
QUnit.push($(selector).length && !$(selector).is(":focusable"), null, null, msg + " - selector " + selector + " is not focusable");
|
||||||
}
|
}
|
||||||
|
|
||||||
function isTabbable(selector, msg) {
|
function isTabbable(selector, msg) {
|
||||||
QUnit.push($(selector).is(':tabbable'), null, null, msg + " - selector " + selector + " is tabbable");
|
QUnit.push($(selector).is(":tabbable"), null, null, msg + " - selector " + selector + " is tabbable");
|
||||||
}
|
}
|
||||||
|
|
||||||
function isNotTabbable(selector, msg) {
|
function isNotTabbable(selector, msg) {
|
||||||
QUnit.push($(selector).length && !$(selector).is(':tabbable'), null, null, msg + " - selector " + selector + " is not tabbable");
|
QUnit.push($(selector).length && !$(selector).is(":tabbable"), null, null, msg + " - selector " + selector + " is not tabbable");
|
||||||
}
|
}
|
||||||
|
|
||||||
test("data", function() {
|
test("data", function() {
|
||||||
@ -26,135 +26,135 @@ test("data", function() {
|
|||||||
|
|
||||||
var el;
|
var el;
|
||||||
function shouldHaveData(msg) {
|
function shouldHaveData(msg) {
|
||||||
ok(el.is(':data(test)'), msg);
|
ok(el.is(":data(test)"), msg);
|
||||||
}
|
}
|
||||||
function shouldNotHaveData(msg) {
|
function shouldNotHaveData(msg) {
|
||||||
ok(!el.is(':data(test)'), msg);
|
ok(!el.is(":data(test)"), msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
el = $('<div>');
|
el = $("<div>");
|
||||||
shouldNotHaveData('data never set');
|
shouldNotHaveData("data never set");
|
||||||
|
|
||||||
el = $('<div>').data('test', null);
|
el = $("<div>").data("test", null);
|
||||||
shouldNotHaveData('data is null');
|
shouldNotHaveData("data is null");
|
||||||
|
|
||||||
el = $('<div>').data('test', true);
|
el = $("<div>").data("test", true);
|
||||||
shouldHaveData('data set to true');
|
shouldHaveData("data set to true");
|
||||||
|
|
||||||
el = $('<div>').data('test', false);
|
el = $("<div>").data("test", false);
|
||||||
shouldNotHaveData('data set to false');
|
shouldNotHaveData("data set to false");
|
||||||
|
|
||||||
el = $('<div>').data('test', 0);
|
el = $("<div>").data("test", 0);
|
||||||
shouldNotHaveData('data set to 0');
|
shouldNotHaveData("data set to 0");
|
||||||
|
|
||||||
el = $('<div>').data('test', 1);
|
el = $("<div>").data("test", 1);
|
||||||
shouldHaveData('data set to 1');
|
shouldHaveData("data set to 1");
|
||||||
|
|
||||||
el = $('<div>').data('test', '');
|
el = $("<div>").data("test", "");
|
||||||
shouldNotHaveData('data set to empty string');
|
shouldNotHaveData("data set to empty string");
|
||||||
|
|
||||||
el = $('<div>').data('test', 'foo');
|
el = $("<div>").data("test", "foo");
|
||||||
shouldHaveData('data set to string');
|
shouldHaveData("data set to string");
|
||||||
|
|
||||||
el = $('<div>').data('test', []);
|
el = $("<div>").data("test", []);
|
||||||
shouldHaveData('data set to empty array');
|
shouldHaveData("data set to empty array");
|
||||||
|
|
||||||
el = $('<div>').data('test', [1]);
|
el = $("<div>").data("test", [1]);
|
||||||
shouldHaveData('data set to array');
|
shouldHaveData("data set to array");
|
||||||
|
|
||||||
el = $('<div>').data('test', {});
|
el = $("<div>").data("test", {});
|
||||||
shouldHaveData('data set to empty object');
|
shouldHaveData("data set to empty object");
|
||||||
|
|
||||||
el = $('<div>').data('test', {foo: 'bar'});
|
el = $("<div>").data("test", {foo: "bar"});
|
||||||
shouldHaveData('data set to object');
|
shouldHaveData("data set to object");
|
||||||
|
|
||||||
el = $('<div>').data('test', new Date());
|
el = $("<div>").data("test", new Date());
|
||||||
shouldHaveData('data set to date');
|
shouldHaveData("data set to date");
|
||||||
|
|
||||||
el = $('<div>').data('test', /test/);
|
el = $("<div>").data("test", /test/);
|
||||||
shouldHaveData('data set to regexp');
|
shouldHaveData("data set to regexp");
|
||||||
|
|
||||||
el = $('<div>').data('test', function() {});
|
el = $("<div>").data("test", function() {});
|
||||||
shouldHaveData('data set to function');
|
shouldHaveData("data set to function");
|
||||||
});
|
});
|
||||||
|
|
||||||
test("focusable - visible, enabled elements", function() {
|
test("focusable - visible, enabled elements", function() {
|
||||||
expect(18);
|
expect(18);
|
||||||
|
|
||||||
isNotFocusable('#formNoTabindex', 'form');
|
isNotFocusable("#formNoTabindex", "form");
|
||||||
isFocusable('#formTabindex', 'form with tabindex');
|
isFocusable("#formTabindex", "form with tabindex");
|
||||||
isFocusable('#visibleAncestor-inputTypeNone', 'input, no type');
|
isFocusable("#visibleAncestor-inputTypeNone", "input, no type");
|
||||||
isFocusable('#visibleAncestor-inputTypeText', 'input, type text');
|
isFocusable("#visibleAncestor-inputTypeText", "input, type text");
|
||||||
isFocusable('#visibleAncestor-inputTypeCheckbox', 'input, type checkbox');
|
isFocusable("#visibleAncestor-inputTypeCheckbox", "input, type checkbox");
|
||||||
isFocusable('#visibleAncestor-inputTypeRadio', 'input, type radio');
|
isFocusable("#visibleAncestor-inputTypeRadio", "input, type radio");
|
||||||
isFocusable('#visibleAncestor-inputTypeButton', 'input, type button');
|
isFocusable("#visibleAncestor-inputTypeButton", "input, type button");
|
||||||
isNotFocusable('#visibleAncestor-inputTypeHidden', 'input, type hidden');
|
isNotFocusable("#visibleAncestor-inputTypeHidden", "input, type hidden");
|
||||||
isFocusable('#visibleAncestor-button', 'button');
|
isFocusable("#visibleAncestor-button", "button");
|
||||||
isFocusable('#visibleAncestor-select', 'select');
|
isFocusable("#visibleAncestor-select", "select");
|
||||||
isFocusable('#visibleAncestor-textarea', 'textarea');
|
isFocusable("#visibleAncestor-textarea", "textarea");
|
||||||
isFocusable('#visibleAncestor-object', 'object');
|
isFocusable("#visibleAncestor-object", "object");
|
||||||
isFocusable('#visibleAncestor-anchorWithHref', 'anchor with href');
|
isFocusable("#visibleAncestor-anchorWithHref", "anchor with href");
|
||||||
isNotFocusable('#visibleAncestor-anchorWithoutHref', 'anchor without href');
|
isNotFocusable("#visibleAncestor-anchorWithoutHref", "anchor without href");
|
||||||
isNotFocusable('#visibleAncestor-span', 'span');
|
isNotFocusable("#visibleAncestor-span", "span");
|
||||||
isNotFocusable('#visibleAncestor-div', 'div');
|
isNotFocusable("#visibleAncestor-div", "div");
|
||||||
isFocusable("#visibleAncestor-spanWithTabindex", 'span with tabindex');
|
isFocusable("#visibleAncestor-spanWithTabindex", "span with tabindex");
|
||||||
isFocusable("#visibleAncestor-divWithNegativeTabindex", 'div with tabindex');
|
isFocusable("#visibleAncestor-divWithNegativeTabindex", "div with tabindex");
|
||||||
});
|
});
|
||||||
|
|
||||||
test("focusable - disabled elements", function() {
|
test("focusable - disabled elements", function() {
|
||||||
expect(9);
|
expect(9);
|
||||||
|
|
||||||
isNotFocusable('#disabledElement-inputTypeNone', 'input, no type');
|
isNotFocusable("#disabledElement-inputTypeNone", "input, no type");
|
||||||
isNotFocusable('#disabledElement-inputTypeText', 'input, type text');
|
isNotFocusable("#disabledElement-inputTypeText", "input, type text");
|
||||||
isNotFocusable('#disabledElement-inputTypeCheckbox', 'input, type checkbox');
|
isNotFocusable("#disabledElement-inputTypeCheckbox", "input, type checkbox");
|
||||||
isNotFocusable('#disabledElement-inputTypeRadio', 'input, type radio');
|
isNotFocusable("#disabledElement-inputTypeRadio", "input, type radio");
|
||||||
isNotFocusable('#disabledElement-inputTypeButton', 'input, type button');
|
isNotFocusable("#disabledElement-inputTypeButton", "input, type button");
|
||||||
isNotFocusable('#disabledElement-inputTypeHidden', 'input, type hidden');
|
isNotFocusable("#disabledElement-inputTypeHidden", "input, type hidden");
|
||||||
isNotFocusable('#disabledElement-button', 'button');
|
isNotFocusable("#disabledElement-button", "button");
|
||||||
isNotFocusable('#disabledElement-select', 'select');
|
isNotFocusable("#disabledElement-select", "select");
|
||||||
isNotFocusable('#disabledElement-textarea', 'textarea');
|
isNotFocusable("#disabledElement-textarea", "textarea");
|
||||||
});
|
});
|
||||||
|
|
||||||
test("focusable - hidden styles", function() {
|
test("focusable - hidden styles", function() {
|
||||||
expect(8);
|
expect(8);
|
||||||
|
|
||||||
isNotFocusable('#displayNoneAncestor-input', 'input, display: none parent');
|
isNotFocusable("#displayNoneAncestor-input", "input, display: none parent");
|
||||||
isNotFocusable('#displayNoneAncestor-span', 'span with tabindex, display: none parent');
|
isNotFocusable("#displayNoneAncestor-span", "span with tabindex, display: none parent");
|
||||||
|
|
||||||
isNotFocusable('#visibilityHiddenAncestor-input', 'input, visibility: hidden parent');
|
isNotFocusable("#visibilityHiddenAncestor-input", "input, visibility: hidden parent");
|
||||||
isNotFocusable('#visibilityHiddenAncestor-span', 'span with tabindex, visibility: hidden parent');
|
isNotFocusable("#visibilityHiddenAncestor-span", "span with tabindex, visibility: hidden parent");
|
||||||
|
|
||||||
isNotFocusable('#displayNone-input', 'input, display: none');
|
isNotFocusable("#displayNone-input", "input, display: none");
|
||||||
isNotFocusable('#visibilityHidden-input', 'input, visibility: hidden');
|
isNotFocusable("#visibilityHidden-input", "input, visibility: hidden");
|
||||||
|
|
||||||
isNotFocusable('#displayNone-span', 'span with tabindex, display: none');
|
isNotFocusable("#displayNone-span", "span with tabindex, display: none");
|
||||||
isNotFocusable('#visibilityHidden-span', 'span with tabindex, visibility: hidden');
|
isNotFocusable("#visibilityHidden-span", "span with tabindex, visibility: hidden");
|
||||||
});
|
});
|
||||||
|
|
||||||
test("focusable - natively focusable with various tabindex", function() {
|
test("focusable - natively focusable with various tabindex", function() {
|
||||||
expect(4);
|
expect(4);
|
||||||
|
|
||||||
isFocusable('#inputTabindex0', 'input, tabindex 0');
|
isFocusable("#inputTabindex0", "input, tabindex 0");
|
||||||
isFocusable('#inputTabindex10', 'input, tabindex 10');
|
isFocusable("#inputTabindex10", "input, tabindex 10");
|
||||||
isFocusable('#inputTabindex-1', 'input, tabindex -1');
|
isFocusable("#inputTabindex-1", "input, tabindex -1");
|
||||||
isFocusable('#inputTabindex-50', 'input, tabindex -50');
|
isFocusable("#inputTabindex-50", "input, tabindex -50");
|
||||||
});
|
});
|
||||||
|
|
||||||
test("focusable - not natively focusable with various tabindex", function() {
|
test("focusable - not natively focusable with various tabindex", function() {
|
||||||
expect(4);
|
expect(4);
|
||||||
|
|
||||||
isFocusable('#spanTabindex0', 'span, tabindex 0');
|
isFocusable("#spanTabindex0", "span, tabindex 0");
|
||||||
isFocusable('#spanTabindex10', 'span, tabindex 10');
|
isFocusable("#spanTabindex10", "span, tabindex 10");
|
||||||
isFocusable('#spanTabindex-1', 'span, tabindex -1');
|
isFocusable("#spanTabindex-1", "span, tabindex -1");
|
||||||
isFocusable('#spanTabindex-50', 'span, tabindex -50');
|
isFocusable("#spanTabindex-50", "span, tabindex -50");
|
||||||
});
|
});
|
||||||
|
|
||||||
test("focusable - area elements", function() {
|
test("focusable - area elements", function() {
|
||||||
expect( 3 );
|
expect( 3 );
|
||||||
|
|
||||||
isFocusable('#areaCoordsHref', 'coords and href');
|
isFocusable("#areaCoordsHref", "coords and href");
|
||||||
isFocusable('#areaNoCoordsHref', 'href but no coords');
|
isFocusable("#areaNoCoordsHref", "href but no coords");
|
||||||
isNotFocusable('#areaNoImg', 'not associated with an image');
|
isNotFocusable("#areaNoImg", "not associated with an image");
|
||||||
});
|
});
|
||||||
|
|
||||||
test( "focusable - dimensionless parent with overflow", function() {
|
test( "focusable - dimensionless parent with overflow", function() {
|
||||||
@ -166,80 +166,80 @@ test( "focusable - dimensionless parent with overflow", function() {
|
|||||||
test("tabbable - visible, enabled elements", function() {
|
test("tabbable - visible, enabled elements", function() {
|
||||||
expect(18);
|
expect(18);
|
||||||
|
|
||||||
isNotTabbable('#formNoTabindex', 'form');
|
isNotTabbable("#formNoTabindex", "form");
|
||||||
isTabbable('#formTabindex', 'form with tabindex');
|
isTabbable("#formTabindex", "form with tabindex");
|
||||||
isTabbable('#visibleAncestor-inputTypeNone', 'input, no type');
|
isTabbable("#visibleAncestor-inputTypeNone", "input, no type");
|
||||||
isTabbable('#visibleAncestor-inputTypeText', 'input, type text');
|
isTabbable("#visibleAncestor-inputTypeText", "input, type text");
|
||||||
isTabbable('#visibleAncestor-inputTypeCheckbox', 'input, type checkbox');
|
isTabbable("#visibleAncestor-inputTypeCheckbox", "input, type checkbox");
|
||||||
isTabbable('#visibleAncestor-inputTypeRadio', 'input, type radio');
|
isTabbable("#visibleAncestor-inputTypeRadio", "input, type radio");
|
||||||
isTabbable('#visibleAncestor-inputTypeButton', 'input, type button');
|
isTabbable("#visibleAncestor-inputTypeButton", "input, type button");
|
||||||
isNotTabbable('#visibleAncestor-inputTypeHidden', 'input, type hidden');
|
isNotTabbable("#visibleAncestor-inputTypeHidden", "input, type hidden");
|
||||||
isTabbable('#visibleAncestor-button', 'button');
|
isTabbable("#visibleAncestor-button", "button");
|
||||||
isTabbable('#visibleAncestor-select', 'select');
|
isTabbable("#visibleAncestor-select", "select");
|
||||||
isTabbable('#visibleAncestor-textarea', 'textarea');
|
isTabbable("#visibleAncestor-textarea", "textarea");
|
||||||
isTabbable('#visibleAncestor-object', 'object');
|
isTabbable("#visibleAncestor-object", "object");
|
||||||
isTabbable('#visibleAncestor-anchorWithHref', 'anchor with href');
|
isTabbable("#visibleAncestor-anchorWithHref", "anchor with href");
|
||||||
isNotTabbable('#visibleAncestor-anchorWithoutHref', 'anchor without href');
|
isNotTabbable("#visibleAncestor-anchorWithoutHref", "anchor without href");
|
||||||
isNotTabbable('#visibleAncestor-span', 'span');
|
isNotTabbable("#visibleAncestor-span", "span");
|
||||||
isNotTabbable('#visibleAncestor-div', 'div');
|
isNotTabbable("#visibleAncestor-div", "div");
|
||||||
isTabbable("#visibleAncestor-spanWithTabindex", 'span with tabindex');
|
isTabbable("#visibleAncestor-spanWithTabindex", "span with tabindex");
|
||||||
isNotTabbable("#visibleAncestor-divWithNegativeTabindex", 'div with tabindex');
|
isNotTabbable("#visibleAncestor-divWithNegativeTabindex", "div with tabindex");
|
||||||
});
|
});
|
||||||
|
|
||||||
test("tabbable - disabled elements", function() {
|
test("tabbable - disabled elements", function() {
|
||||||
expect(9);
|
expect(9);
|
||||||
|
|
||||||
isNotTabbable('#disabledElement-inputTypeNone', 'input, no type');
|
isNotTabbable("#disabledElement-inputTypeNone", "input, no type");
|
||||||
isNotTabbable('#disabledElement-inputTypeText', 'input, type text');
|
isNotTabbable("#disabledElement-inputTypeText", "input, type text");
|
||||||
isNotTabbable('#disabledElement-inputTypeCheckbox', 'input, type checkbox');
|
isNotTabbable("#disabledElement-inputTypeCheckbox", "input, type checkbox");
|
||||||
isNotTabbable('#disabledElement-inputTypeRadio', 'input, type radio');
|
isNotTabbable("#disabledElement-inputTypeRadio", "input, type radio");
|
||||||
isNotTabbable('#disabledElement-inputTypeButton', 'input, type button');
|
isNotTabbable("#disabledElement-inputTypeButton", "input, type button");
|
||||||
isNotTabbable('#disabledElement-inputTypeHidden', 'input, type hidden');
|
isNotTabbable("#disabledElement-inputTypeHidden", "input, type hidden");
|
||||||
isNotTabbable('#disabledElement-button', 'button');
|
isNotTabbable("#disabledElement-button", "button");
|
||||||
isNotTabbable('#disabledElement-select', 'select');
|
isNotTabbable("#disabledElement-select", "select");
|
||||||
isNotTabbable('#disabledElement-textarea', 'textarea');
|
isNotTabbable("#disabledElement-textarea", "textarea");
|
||||||
});
|
});
|
||||||
|
|
||||||
test("tabbable - hidden styles", function() {
|
test("tabbable - hidden styles", function() {
|
||||||
expect(8);
|
expect(8);
|
||||||
|
|
||||||
isNotTabbable('#displayNoneAncestor-input', 'input, display: none parent');
|
isNotTabbable("#displayNoneAncestor-input", "input, display: none parent");
|
||||||
isNotTabbable('#displayNoneAncestor-span', 'span with tabindex, display: none parent');
|
isNotTabbable("#displayNoneAncestor-span", "span with tabindex, display: none parent");
|
||||||
|
|
||||||
isNotTabbable('#visibilityHiddenAncestor-input', 'input, visibility: hidden parent');
|
isNotTabbable("#visibilityHiddenAncestor-input", "input, visibility: hidden parent");
|
||||||
isNotTabbable('#visibilityHiddenAncestor-span', 'span with tabindex, visibility: hidden parent');
|
isNotTabbable("#visibilityHiddenAncestor-span", "span with tabindex, visibility: hidden parent");
|
||||||
|
|
||||||
isNotTabbable('#displayNone-input', 'input, display: none');
|
isNotTabbable("#displayNone-input", "input, display: none");
|
||||||
isNotTabbable('#visibilityHidden-input', 'input, visibility: hidden');
|
isNotTabbable("#visibilityHidden-input", "input, visibility: hidden");
|
||||||
|
|
||||||
isNotTabbable('#displayNone-span', 'span with tabindex, display: none');
|
isNotTabbable("#displayNone-span", "span with tabindex, display: none");
|
||||||
isNotTabbable('#visibilityHidden-span', 'span with tabindex, visibility: hidden');
|
isNotTabbable("#visibilityHidden-span", "span with tabindex, visibility: hidden");
|
||||||
});
|
});
|
||||||
|
|
||||||
test("tabbable - natively tabbable with various tabindex", function() {
|
test("tabbable - natively tabbable with various tabindex", function() {
|
||||||
expect(4);
|
expect(4);
|
||||||
|
|
||||||
isTabbable('#inputTabindex0', 'input, tabindex 0');
|
isTabbable("#inputTabindex0", "input, tabindex 0");
|
||||||
isTabbable('#inputTabindex10', 'input, tabindex 10');
|
isTabbable("#inputTabindex10", "input, tabindex 10");
|
||||||
isNotTabbable('#inputTabindex-1', 'input, tabindex -1');
|
isNotTabbable("#inputTabindex-1", "input, tabindex -1");
|
||||||
isNotTabbable('#inputTabindex-50', 'input, tabindex -50');
|
isNotTabbable("#inputTabindex-50", "input, tabindex -50");
|
||||||
});
|
});
|
||||||
|
|
||||||
test("tabbable - not natively tabbable with various tabindex", function() {
|
test("tabbable - not natively tabbable with various tabindex", function() {
|
||||||
expect(4);
|
expect(4);
|
||||||
|
|
||||||
isTabbable('#spanTabindex0', 'span, tabindex 0');
|
isTabbable("#spanTabindex0", "span, tabindex 0");
|
||||||
isTabbable('#spanTabindex10', 'span, tabindex 10');
|
isTabbable("#spanTabindex10", "span, tabindex 10");
|
||||||
isNotTabbable('#spanTabindex-1', 'span, tabindex -1');
|
isNotTabbable("#spanTabindex-1", "span, tabindex -1");
|
||||||
isNotTabbable('#spanTabindex-50', 'span, tabindex -50');
|
isNotTabbable("#spanTabindex-50", "span, tabindex -50");
|
||||||
});
|
});
|
||||||
|
|
||||||
test("tabbable - area elements", function() {
|
test("tabbable - area elements", function() {
|
||||||
expect( 3 );
|
expect( 3 );
|
||||||
|
|
||||||
isTabbable('#areaCoordsHref', 'coords and href');
|
isTabbable("#areaCoordsHref", "coords and href");
|
||||||
isTabbable('#areaNoCoordsHref', 'href but no coords');
|
isTabbable("#areaNoCoordsHref", "href but no coords");
|
||||||
isNotTabbable('#areaNoImg', 'not associated with an image');
|
isNotTabbable("#areaNoImg", "not associated with an image");
|
||||||
});
|
});
|
||||||
|
|
||||||
test( "tabbable - dimensionless parent with overflow", function() {
|
test( "tabbable - dimensionless parent with overflow", function() {
|
||||||
|
@ -10,12 +10,12 @@ TestHelpers.testJshint( "datepicker" );
|
|||||||
|
|
||||||
test("initialization - Reinitialization after body had been emptied.", function() {
|
test("initialization - Reinitialization after body had been emptied.", function() {
|
||||||
expect( 1 );
|
expect( 1 );
|
||||||
var bodyContent = $('body').children(), inp = $("#inp");
|
var bodyContent = $("body").children(), inp = $("#inp");
|
||||||
$("#inp").datepicker();
|
$("#inp").datepicker();
|
||||||
$('body').empty().append(inp);
|
$("body").empty().append(inp);
|
||||||
$("#inp").datepicker();
|
$("#inp").datepicker();
|
||||||
ok( $("#"+$.datepicker._mainDivId).length===1, "Datepicker container added" );
|
ok( $("#"+$.datepicker._mainDivId).length===1, "Datepicker container added" );
|
||||||
$('body').empty().append(bodyContent); // Returning to initial state for later tests
|
$("body").empty().append(bodyContent); // Returning to initial state for later tests
|
||||||
});
|
});
|
||||||
|
|
||||||
test( "widget method - empty collection", function() {
|
test( "widget method - empty collection", function() {
|
||||||
@ -30,46 +30,46 @@ test("widget method", function() {
|
|||||||
deepEqual($("body > #ui-datepicker-div:last-child")[0], actual);
|
deepEqual($("body > #ui-datepicker-div:last-child")[0], actual);
|
||||||
});
|
});
|
||||||
|
|
||||||
asyncTest('baseStructure', function() {
|
asyncTest("baseStructure", function() {
|
||||||
expect( 58 );
|
expect( 58 );
|
||||||
var header, title, table, thead, week, panel, inl, child,
|
var header, title, table, thead, week, panel, inl, child,
|
||||||
inp = TestHelpers.datepicker.init('#inp'),
|
inp = TestHelpers.datepicker.init("#inp"),
|
||||||
dp = $('#ui-datepicker-div');
|
dp = $("#ui-datepicker-div");
|
||||||
|
|
||||||
function step1() {
|
function step1() {
|
||||||
inp[0].focus();
|
inp[0].focus();
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
ok(dp.is(':visible'), 'Structure - datepicker visible');
|
ok(dp.is(":visible"), "Structure - datepicker visible");
|
||||||
ok(!dp.is('.ui-datepicker-rtl'), 'Structure - not right-to-left');
|
ok(!dp.is(".ui-datepicker-rtl"), "Structure - not right-to-left");
|
||||||
ok(!dp.is('.ui-datepicker-multi'), 'Structure - not multi-month');
|
ok(!dp.is(".ui-datepicker-multi"), "Structure - not multi-month");
|
||||||
equal(dp.children().length, 2, 'Structure - child count');
|
equal(dp.children().length, 2, "Structure - child count");
|
||||||
|
|
||||||
header = dp.children(':first');
|
header = dp.children(":first");
|
||||||
ok(header.is('div.ui-datepicker-header'), 'Structure - header division');
|
ok(header.is("div.ui-datepicker-header"), "Structure - header division");
|
||||||
equal(header.children().length, 3, 'Structure - header child count');
|
equal(header.children().length, 3, "Structure - header child count");
|
||||||
ok(header.children(':first').is('a.ui-datepicker-prev') && header.children(':first').html() !== '', 'Structure - prev link');
|
ok(header.children(":first").is("a.ui-datepicker-prev") && header.children(":first").html() !== "", "Structure - prev link");
|
||||||
ok(header.children(':eq(1)').is('a.ui-datepicker-next') && header.children(':eq(1)').html() !== '', 'Structure - next link');
|
ok(header.children(":eq(1)").is("a.ui-datepicker-next") && header.children(":eq(1)").html() !== "", "Structure - next link");
|
||||||
|
|
||||||
title = header.children(':last');
|
title = header.children(":last");
|
||||||
ok(title.is('div.ui-datepicker-title') && title.html() !== '','Structure - title division');
|
ok(title.is("div.ui-datepicker-title") && title.html() !== "","Structure - title division");
|
||||||
equal(title.children().length, 2, 'Structure - title child count');
|
equal(title.children().length, 2, "Structure - title child count");
|
||||||
ok(title.children(':first').is('span.ui-datepicker-month') && title.children(':first').text() !== '', 'Structure - month text');
|
ok(title.children(":first").is("span.ui-datepicker-month") && title.children(":first").text() !== "", "Structure - month text");
|
||||||
ok(title.children(':last').is('span.ui-datepicker-year') && title.children(':last').text() !== '', 'Structure - year text');
|
ok(title.children(":last").is("span.ui-datepicker-year") && title.children(":last").text() !== "", "Structure - year text");
|
||||||
|
|
||||||
table = dp.children(':eq(1)');
|
table = dp.children(":eq(1)");
|
||||||
ok(table.is('table.ui-datepicker-calendar'), 'Structure - month table');
|
ok(table.is("table.ui-datepicker-calendar"), "Structure - month table");
|
||||||
ok(table.children(':first').is('thead'), 'Structure - month table thead');
|
ok(table.children(":first").is("thead"), "Structure - month table thead");
|
||||||
thead = table.children(':first').children(':first');
|
thead = table.children(":first").children(":first");
|
||||||
ok(thead.is('tr'), 'Structure - month table title row');
|
ok(thead.is("tr"), "Structure - month table title row");
|
||||||
equal(thead.find('th').length, 7, 'Structure - month table title cells');
|
equal(thead.find("th").length, 7, "Structure - month table title cells");
|
||||||
ok(table.children(':eq(1)').is('tbody'), 'Structure - month table body');
|
ok(table.children(":eq(1)").is("tbody"), "Structure - month table body");
|
||||||
ok(table.children(':eq(1)').children('tr').length >= 4, 'Structure - month table week count');
|
ok(table.children(":eq(1)").children("tr").length >= 4, "Structure - month table week count");
|
||||||
week = table.children(':eq(1)').children(':first');
|
week = table.children(":eq(1)").children(":first");
|
||||||
ok(week.is('tr'), 'Structure - month table week row');
|
ok(week.is("tr"), "Structure - month table week row");
|
||||||
equal(week.children().length, 7, 'Structure - week child count');
|
equal(week.children().length, 7, "Structure - week child count");
|
||||||
ok(week.children(':first').is('td.ui-datepicker-week-end'), 'Structure - month table first day cell');
|
ok(week.children(":first").is("td.ui-datepicker-week-end"), "Structure - month table first day cell");
|
||||||
ok(week.children(':last').is('td.ui-datepicker-week-end'), 'Structure - month table second day cell');
|
ok(week.children(":last").is("td.ui-datepicker-week-end"), "Structure - month table second day cell");
|
||||||
inp.datepicker('hide').datepicker('destroy');
|
inp.datepicker("hide").datepicker("destroy");
|
||||||
|
|
||||||
step2();
|
step2();
|
||||||
});
|
});
|
||||||
@ -77,19 +77,19 @@ asyncTest('baseStructure', function() {
|
|||||||
|
|
||||||
function step2() {
|
function step2() {
|
||||||
// Editable month/year and button panel
|
// Editable month/year and button panel
|
||||||
inp = TestHelpers.datepicker.init('#inp', {changeMonth: true, changeYear: true, showButtonPanel: true});
|
inp = TestHelpers.datepicker.init("#inp", {changeMonth: true, changeYear: true, showButtonPanel: true});
|
||||||
inp.focus();
|
inp.focus();
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
title = dp.find('div.ui-datepicker-title');
|
title = dp.find("div.ui-datepicker-title");
|
||||||
ok(title.children(':first').is('select.ui-datepicker-month'), 'Structure - month selector');
|
ok(title.children(":first").is("select.ui-datepicker-month"), "Structure - month selector");
|
||||||
ok(title.children(':last').is('select.ui-datepicker-year'), 'Structure - year selector');
|
ok(title.children(":last").is("select.ui-datepicker-year"), "Structure - year selector");
|
||||||
|
|
||||||
panel = dp.children(':last');
|
panel = dp.children(":last");
|
||||||
ok(panel.is('div.ui-datepicker-buttonpane'), 'Structure - button panel division');
|
ok(panel.is("div.ui-datepicker-buttonpane"), "Structure - button panel division");
|
||||||
equal(panel.children().length, 2, 'Structure - button panel child count');
|
equal(panel.children().length, 2, "Structure - button panel child count");
|
||||||
ok(panel.children(':first').is('button.ui-datepicker-current'), 'Structure - today button');
|
ok(panel.children(":first").is("button.ui-datepicker-current"), "Structure - today button");
|
||||||
ok(panel.children(':last').is('button.ui-datepicker-close'), 'Structure - close button');
|
ok(panel.children(":last").is("button.ui-datepicker-close"), "Structure - close button");
|
||||||
inp.datepicker('hide').datepicker('destroy');
|
inp.datepicker("hide").datepicker("destroy");
|
||||||
|
|
||||||
step3();
|
step3();
|
||||||
});
|
});
|
||||||
@ -97,19 +97,19 @@ asyncTest('baseStructure', function() {
|
|||||||
|
|
||||||
function step3() {
|
function step3() {
|
||||||
// Multi-month 2
|
// Multi-month 2
|
||||||
inp = TestHelpers.datepicker.init('#inp', {numberOfMonths: 2});
|
inp = TestHelpers.datepicker.init("#inp", {numberOfMonths: 2});
|
||||||
inp.focus();
|
inp.focus();
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
ok(dp.is('.ui-datepicker-multi'), 'Structure multi [2] - multi-month');
|
ok(dp.is(".ui-datepicker-multi"), "Structure multi [2] - multi-month");
|
||||||
equal(dp.children().length, 3, 'Structure multi [2] - child count');
|
equal(dp.children().length, 3, "Structure multi [2] - child count");
|
||||||
child = dp.children(':first');
|
child = dp.children(":first");
|
||||||
ok(child.is('div.ui-datepicker-group') && child.is('div.ui-datepicker-group-first'), 'Structure multi [2] - first month division');
|
ok(child.is("div.ui-datepicker-group") && child.is("div.ui-datepicker-group-first"), "Structure multi [2] - first month division");
|
||||||
child = dp.children(':eq(1)');
|
child = dp.children(":eq(1)");
|
||||||
ok(child.is('div.ui-datepicker-group') && child.is('div.ui-datepicker-group-last'), 'Structure multi [2] - second month division');
|
ok(child.is("div.ui-datepicker-group") && child.is("div.ui-datepicker-group-last"), "Structure multi [2] - second month division");
|
||||||
child = dp.children(':eq(2)');
|
child = dp.children(":eq(2)");
|
||||||
ok(child.is('div.ui-datepicker-row-break'), 'Structure multi [2] - row break');
|
ok(child.is("div.ui-datepicker-row-break"), "Structure multi [2] - row break");
|
||||||
ok(dp.is('.ui-datepicker-multi-2'), 'Structure multi [2] - multi-2');
|
ok(dp.is(".ui-datepicker-multi-2"), "Structure multi [2] - multi-2");
|
||||||
inp.datepicker('hide').datepicker('destroy');
|
inp.datepicker("hide").datepicker("destroy");
|
||||||
|
|
||||||
step4();
|
step4();
|
||||||
});
|
});
|
||||||
@ -117,12 +117,12 @@ asyncTest('baseStructure', function() {
|
|||||||
|
|
||||||
function step4() {
|
function step4() {
|
||||||
// Multi-month 3
|
// Multi-month 3
|
||||||
inp = TestHelpers.datepicker.init('#inp', {numberOfMonths: 3});
|
inp = TestHelpers.datepicker.init("#inp", {numberOfMonths: 3});
|
||||||
inp.focus();
|
inp.focus();
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
ok(dp.is('.ui-datepicker-multi-3'), 'Structure multi [3] - multi-3');
|
ok(dp.is(".ui-datepicker-multi-3"), "Structure multi [3] - multi-3");
|
||||||
ok(! dp.is('.ui-datepicker-multi-2'), 'Structure multi [3] - Trac #6704');
|
ok(! dp.is(".ui-datepicker-multi-2"), "Structure multi [3] - Trac #6704");
|
||||||
inp.datepicker('hide').datepicker('destroy');
|
inp.datepicker("hide").datepicker("destroy");
|
||||||
|
|
||||||
step5();
|
step5();
|
||||||
});
|
});
|
||||||
@ -130,53 +130,53 @@ asyncTest('baseStructure', function() {
|
|||||||
|
|
||||||
function step5() {
|
function step5() {
|
||||||
// Multi-month [2, 2]
|
// Multi-month [2, 2]
|
||||||
inp = TestHelpers.datepicker.init('#inp', {numberOfMonths: [2, 2]});
|
inp = TestHelpers.datepicker.init("#inp", {numberOfMonths: [2, 2]});
|
||||||
inp.focus();
|
inp.focus();
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
ok(dp.is('.ui-datepicker-multi'), 'Structure multi - multi-month');
|
ok(dp.is(".ui-datepicker-multi"), "Structure multi - multi-month");
|
||||||
equal(dp.children().length, 6, 'Structure multi [2,2] - child count');
|
equal(dp.children().length, 6, "Structure multi [2,2] - child count");
|
||||||
child = dp.children(':first');
|
child = dp.children(":first");
|
||||||
ok(child.is('div.ui-datepicker-group') && child.is('div.ui-datepicker-group-first'), 'Structure multi [2,2] - first month division');
|
ok(child.is("div.ui-datepicker-group") && child.is("div.ui-datepicker-group-first"), "Structure multi [2,2] - first month division");
|
||||||
child = dp.children(':eq(1)');
|
child = dp.children(":eq(1)");
|
||||||
ok(child.is('div.ui-datepicker-group') && child.is('div.ui-datepicker-group-last'), 'Structure multi [2,2] - second month division');
|
ok(child.is("div.ui-datepicker-group") && child.is("div.ui-datepicker-group-last"), "Structure multi [2,2] - second month division");
|
||||||
child = dp.children(':eq(2)');
|
child = dp.children(":eq(2)");
|
||||||
ok(child.is('div.ui-datepicker-row-break'), 'Structure multi [2,2] - row break');
|
ok(child.is("div.ui-datepicker-row-break"), "Structure multi [2,2] - row break");
|
||||||
child = dp.children(':eq(3)');
|
child = dp.children(":eq(3)");
|
||||||
ok(child.is('div.ui-datepicker-group') && child.is('div.ui-datepicker-group-first'), 'Structure multi [2,2] - third month division');
|
ok(child.is("div.ui-datepicker-group") && child.is("div.ui-datepicker-group-first"), "Structure multi [2,2] - third month division");
|
||||||
child = dp.children(':eq(4)');
|
child = dp.children(":eq(4)");
|
||||||
ok(child.is('div.ui-datepicker-group') && child.is('div.ui-datepicker-group-last'), 'Structure multi [2,2] - fourth month division');
|
ok(child.is("div.ui-datepicker-group") && child.is("div.ui-datepicker-group-last"), "Structure multi [2,2] - fourth month division");
|
||||||
child = dp.children(':eq(5)');
|
child = dp.children(":eq(5)");
|
||||||
ok(child.is('div.ui-datepicker-row-break'), 'Structure multi [2,2] - row break');
|
ok(child.is("div.ui-datepicker-row-break"), "Structure multi [2,2] - row break");
|
||||||
inp.datepicker('hide').datepicker('destroy');
|
inp.datepicker("hide").datepicker("destroy");
|
||||||
|
|
||||||
// Inline
|
// Inline
|
||||||
inl = TestHelpers.datepicker.init('#inl');
|
inl = TestHelpers.datepicker.init("#inl");
|
||||||
dp = inl.children();
|
dp = inl.children();
|
||||||
ok(dp.is('.ui-datepicker-inline'), 'Structure inline - main div');
|
ok(dp.is(".ui-datepicker-inline"), "Structure inline - main div");
|
||||||
ok(!dp.is('.ui-datepicker-rtl'), 'Structure inline - not right-to-left');
|
ok(!dp.is(".ui-datepicker-rtl"), "Structure inline - not right-to-left");
|
||||||
ok(!dp.is('.ui-datepicker-multi'), 'Structure inline - not multi-month');
|
ok(!dp.is(".ui-datepicker-multi"), "Structure inline - not multi-month");
|
||||||
equal(dp.children().length, 2, 'Structure inline - child count');
|
equal(dp.children().length, 2, "Structure inline - child count");
|
||||||
header = dp.children(':first');
|
header = dp.children(":first");
|
||||||
ok(header.is('div.ui-datepicker-header'), 'Structure inline - header division');
|
ok(header.is("div.ui-datepicker-header"), "Structure inline - header division");
|
||||||
equal(header.children().length, 3, 'Structure inline - header child count');
|
equal(header.children().length, 3, "Structure inline - header child count");
|
||||||
table = dp.children(':eq(1)');
|
table = dp.children(":eq(1)");
|
||||||
ok(table.is('table.ui-datepicker-calendar'), 'Structure inline - month table');
|
ok(table.is("table.ui-datepicker-calendar"), "Structure inline - month table");
|
||||||
ok(table.children(':first').is('thead'), 'Structure inline - month table thead');
|
ok(table.children(":first").is("thead"), "Structure inline - month table thead");
|
||||||
ok(table.children(':eq(1)').is('tbody'), 'Structure inline - month table body');
|
ok(table.children(":eq(1)").is("tbody"), "Structure inline - month table body");
|
||||||
inl.datepicker('destroy');
|
inl.datepicker("destroy");
|
||||||
|
|
||||||
// Inline multi-month
|
// Inline multi-month
|
||||||
inl = TestHelpers.datepicker.init('#inl', {numberOfMonths: 2});
|
inl = TestHelpers.datepicker.init("#inl", {numberOfMonths: 2});
|
||||||
dp = inl.children();
|
dp = inl.children();
|
||||||
ok(dp.is('.ui-datepicker-inline') && dp.is('.ui-datepicker-multi'), 'Structure inline multi - main div');
|
ok(dp.is(".ui-datepicker-inline") && dp.is(".ui-datepicker-multi"), "Structure inline multi - main div");
|
||||||
equal(dp.children().length, 3, 'Structure inline multi - child count');
|
equal(dp.children().length, 3, "Structure inline multi - child count");
|
||||||
child = dp.children(':first');
|
child = dp.children(":first");
|
||||||
ok(child.is('div.ui-datepicker-group') && child.is('div.ui-datepicker-group-first'), 'Structure inline multi - first month division');
|
ok(child.is("div.ui-datepicker-group") && child.is("div.ui-datepicker-group-first"), "Structure inline multi - first month division");
|
||||||
child = dp.children(':eq(1)');
|
child = dp.children(":eq(1)");
|
||||||
ok(child.is('div.ui-datepicker-group') && child.is('div.ui-datepicker-group-last'), 'Structure inline multi - second month division');
|
ok(child.is("div.ui-datepicker-group") && child.is("div.ui-datepicker-group-last"), "Structure inline multi - second month division");
|
||||||
child = dp.children(':eq(2)');
|
child = dp.children(":eq(2)");
|
||||||
ok(child.is('div.ui-datepicker-row-break'), 'Structure inline multi - row break');
|
ok(child.is("div.ui-datepicker-row-break"), "Structure inline multi - row break");
|
||||||
inl.datepicker('destroy');
|
inl.datepicker("destroy");
|
||||||
|
|
||||||
start();
|
start();
|
||||||
});
|
});
|
||||||
@ -185,279 +185,279 @@ asyncTest('baseStructure', function() {
|
|||||||
step1();
|
step1();
|
||||||
});
|
});
|
||||||
|
|
||||||
test('customStructure', function() {
|
test("customStructure", function() {
|
||||||
expect( 20 );
|
expect( 20 );
|
||||||
var header, panel, title, thead,
|
var header, panel, title, thead,
|
||||||
dp = $('#ui-datepicker-div'),
|
dp = $("#ui-datepicker-div"),
|
||||||
// Check right-to-left localisation
|
// Check right-to-left localisation
|
||||||
inp = TestHelpers.datepicker.init('#inp', $.datepicker.regional.he);
|
inp = TestHelpers.datepicker.init("#inp", $.datepicker.regional.he);
|
||||||
inp.datepicker( 'option', 'showButtonPanel', true);
|
inp.datepicker( "option", "showButtonPanel", true);
|
||||||
inp.focus();
|
inp.focus();
|
||||||
ok(dp.is('.ui-datepicker-rtl'), 'Structure RTL - right-to-left');
|
ok(dp.is(".ui-datepicker-rtl"), "Structure RTL - right-to-left");
|
||||||
header = dp.children(':first');
|
header = dp.children(":first");
|
||||||
ok(header.is('div.ui-datepicker-header'), 'Structure RTL - header division');
|
ok(header.is("div.ui-datepicker-header"), "Structure RTL - header division");
|
||||||
equal(header.children().length, 3, 'Structure RTL - header child count');
|
equal(header.children().length, 3, "Structure RTL - header child count");
|
||||||
ok(header.children(':first').is('a.ui-datepicker-next'), 'Structure RTL - prev link');
|
ok(header.children(":first").is("a.ui-datepicker-next"), "Structure RTL - prev link");
|
||||||
ok(header.children(':eq(1)').is('a.ui-datepicker-prev'), 'Structure RTL - next link');
|
ok(header.children(":eq(1)").is("a.ui-datepicker-prev"), "Structure RTL - next link");
|
||||||
panel = dp.children(':last');
|
panel = dp.children(":last");
|
||||||
ok(panel.is('div.ui-datepicker-buttonpane'), 'Structure RTL - button division');
|
ok(panel.is("div.ui-datepicker-buttonpane"), "Structure RTL - button division");
|
||||||
equal(panel.children().length, 2, 'Structure RTL - button panel child count');
|
equal(panel.children().length, 2, "Structure RTL - button panel child count");
|
||||||
ok(panel.children(':first').is('button.ui-datepicker-close'), 'Structure RTL - close button');
|
ok(panel.children(":first").is("button.ui-datepicker-close"), "Structure RTL - close button");
|
||||||
ok(panel.children(':last').is('button.ui-datepicker-current'), 'Structure RTL - today button');
|
ok(panel.children(":last").is("button.ui-datepicker-current"), "Structure RTL - today button");
|
||||||
inp.datepicker('hide').datepicker('destroy');
|
inp.datepicker("hide").datepicker("destroy");
|
||||||
|
|
||||||
// Hide prev/next
|
// Hide prev/next
|
||||||
inp = TestHelpers.datepicker.init('#inp', {hideIfNoPrevNext: true, minDate: new Date(2008, 2 - 1, 4), maxDate: new Date(2008, 2 - 1, 14)});
|
inp = TestHelpers.datepicker.init("#inp", {hideIfNoPrevNext: true, minDate: new Date(2008, 2 - 1, 4), maxDate: new Date(2008, 2 - 1, 14)});
|
||||||
inp.val('02/10/2008').focus();
|
inp.val("02/10/2008").focus();
|
||||||
header = dp.children(':first');
|
header = dp.children(":first");
|
||||||
ok(header.is('div.ui-datepicker-header'), 'Structure hide prev/next - header division');
|
ok(header.is("div.ui-datepicker-header"), "Structure hide prev/next - header division");
|
||||||
equal(header.children().length, 1, 'Structure hide prev/next - links child count');
|
equal(header.children().length, 1, "Structure hide prev/next - links child count");
|
||||||
ok(header.children(':first').is('div.ui-datepicker-title'), 'Structure hide prev/next - title division');
|
ok(header.children(":first").is("div.ui-datepicker-title"), "Structure hide prev/next - title division");
|
||||||
inp.datepicker('hide').datepicker('destroy');
|
inp.datepicker("hide").datepicker("destroy");
|
||||||
|
|
||||||
// Changeable Month with read-only year
|
// Changeable Month with read-only year
|
||||||
inp = TestHelpers.datepicker.init('#inp', {changeMonth: true});
|
inp = TestHelpers.datepicker.init("#inp", {changeMonth: true});
|
||||||
inp.focus();
|
inp.focus();
|
||||||
title = dp.children(':first').children(':last');
|
title = dp.children(":first").children(":last");
|
||||||
equal(title.children().length, 2, 'Structure changeable month - title child count');
|
equal(title.children().length, 2, "Structure changeable month - title child count");
|
||||||
ok(title.children(':first').is('select.ui-datepicker-month'), 'Structure changeable month - month selector');
|
ok(title.children(":first").is("select.ui-datepicker-month"), "Structure changeable month - month selector");
|
||||||
ok(title.children(':last').is('span.ui-datepicker-year'), 'Structure changeable month - read-only year');
|
ok(title.children(":last").is("span.ui-datepicker-year"), "Structure changeable month - read-only year");
|
||||||
inp.datepicker('hide').datepicker('destroy');
|
inp.datepicker("hide").datepicker("destroy");
|
||||||
|
|
||||||
// Changeable year with read-only month
|
// Changeable year with read-only month
|
||||||
inp = TestHelpers.datepicker.init('#inp', {changeYear: true});
|
inp = TestHelpers.datepicker.init("#inp", {changeYear: true});
|
||||||
inp.focus();
|
inp.focus();
|
||||||
title = dp.children(':first').children(':last');
|
title = dp.children(":first").children(":last");
|
||||||
equal(title.children().length, 2, 'Structure changeable year - title child count');
|
equal(title.children().length, 2, "Structure changeable year - title child count");
|
||||||
ok(title.children(':first').is('span.ui-datepicker-month'), 'Structure changeable year - read-only month');
|
ok(title.children(":first").is("span.ui-datepicker-month"), "Structure changeable year - read-only month");
|
||||||
ok(title.children(':last').is('select.ui-datepicker-year'), 'Structure changeable year - year selector');
|
ok(title.children(":last").is("select.ui-datepicker-year"), "Structure changeable year - year selector");
|
||||||
inp.datepicker('hide').datepicker('destroy');
|
inp.datepicker("hide").datepicker("destroy");
|
||||||
|
|
||||||
// Read-only first day of week
|
// Read-only first day of week
|
||||||
inp = TestHelpers.datepicker.init('#inp', {changeFirstDay: false});
|
inp = TestHelpers.datepicker.init("#inp", {changeFirstDay: false});
|
||||||
inp.focus();
|
inp.focus();
|
||||||
thead = dp.find('.ui-datepicker-calendar thead tr');
|
thead = dp.find(".ui-datepicker-calendar thead tr");
|
||||||
equal(thead.children().length, 7, 'Structure read-only first day - thead child count');
|
equal(thead.children().length, 7, "Structure read-only first day - thead child count");
|
||||||
equal(thead.find('a').length, 0, 'Structure read-only first day - thead links count');
|
equal(thead.find("a").length, 0, "Structure read-only first day - thead links count");
|
||||||
inp.datepicker('hide').datepicker('destroy');
|
inp.datepicker("hide").datepicker("destroy");
|
||||||
});
|
});
|
||||||
|
|
||||||
test('keystrokes', function() {
|
test("keystrokes", function() {
|
||||||
expect( 26 );
|
expect( 26 );
|
||||||
var inp = TestHelpers.datepicker.init('#inp'),
|
var inp = TestHelpers.datepicker.init("#inp"),
|
||||||
date = new Date();
|
date = new Date();
|
||||||
inp.val('').datepicker('show').
|
inp.val("").datepicker("show").
|
||||||
simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
|
simulate("keydown", {keyCode: $.ui.keyCode.ENTER});
|
||||||
TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), date, 'Keystroke enter');
|
TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), date, "Keystroke enter");
|
||||||
inp.val('02/04/2008').datepicker('show').
|
inp.val("02/04/2008").datepicker("show").
|
||||||
simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
|
simulate("keydown", {keyCode: $.ui.keyCode.ENTER});
|
||||||
TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), new Date(2008, 2 - 1, 4),
|
TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), new Date(2008, 2 - 1, 4),
|
||||||
'Keystroke enter - preset');
|
"Keystroke enter - preset");
|
||||||
inp.val('02/04/2008').datepicker('show').
|
inp.val("02/04/2008").datepicker("show").
|
||||||
simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.HOME}).
|
simulate("keydown", {ctrlKey: true, keyCode: $.ui.keyCode.HOME}).
|
||||||
simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
|
simulate("keydown", {keyCode: $.ui.keyCode.ENTER});
|
||||||
TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), date, 'Keystroke ctrl+home');
|
TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), date, "Keystroke ctrl+home");
|
||||||
inp.val('02/04/2008').datepicker('show').
|
inp.val("02/04/2008").datepicker("show").
|
||||||
simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.END});
|
simulate("keydown", {ctrlKey: true, keyCode: $.ui.keyCode.END});
|
||||||
ok(inp.datepicker('getDate') == null, 'Keystroke ctrl+end');
|
ok(inp.datepicker("getDate") == null, "Keystroke ctrl+end");
|
||||||
inp.val('').datepicker('show').
|
inp.val("").datepicker("show").
|
||||||
simulate('keydown', {keyCode: $.ui.keyCode.ESCAPE});
|
simulate("keydown", {keyCode: $.ui.keyCode.ESCAPE});
|
||||||
ok(inp.datepicker('getDate') == null, 'Keystroke esc');
|
ok(inp.datepicker("getDate") == null, "Keystroke esc");
|
||||||
inp.val('02/04/2008').datepicker('show').
|
inp.val("02/04/2008").datepicker("show").
|
||||||
simulate('keydown', {keyCode: $.ui.keyCode.ESCAPE});
|
simulate("keydown", {keyCode: $.ui.keyCode.ESCAPE});
|
||||||
TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), new Date(2008, 2 - 1, 4),
|
TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), new Date(2008, 2 - 1, 4),
|
||||||
'Keystroke esc - preset');
|
"Keystroke esc - preset");
|
||||||
inp.val('02/04/2008').datepicker('show').
|
inp.val("02/04/2008").datepicker("show").
|
||||||
simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_UP}).
|
simulate("keydown", {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_UP}).
|
||||||
simulate('keydown', {keyCode: $.ui.keyCode.ESCAPE});
|
simulate("keydown", {keyCode: $.ui.keyCode.ESCAPE});
|
||||||
TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), new Date(2008, 2 - 1, 4),
|
TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), new Date(2008, 2 - 1, 4),
|
||||||
'Keystroke esc - abandoned');
|
"Keystroke esc - abandoned");
|
||||||
// Moving by day or week
|
// Moving by day or week
|
||||||
inp.val('').datepicker('show').
|
inp.val("").datepicker("show").
|
||||||
simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.LEFT}).
|
simulate("keydown", {ctrlKey: true, keyCode: $.ui.keyCode.LEFT}).
|
||||||
simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
|
simulate("keydown", {keyCode: $.ui.keyCode.ENTER});
|
||||||
date.setDate(date.getDate() - 1);
|
date.setDate(date.getDate() - 1);
|
||||||
TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), date, 'Keystroke ctrl+left');
|
TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), date, "Keystroke ctrl+left");
|
||||||
inp.val('').datepicker('show').
|
inp.val("").datepicker("show").
|
||||||
simulate('keydown', {keyCode: $.ui.keyCode.LEFT}).
|
simulate("keydown", {keyCode: $.ui.keyCode.LEFT}).
|
||||||
simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
|
simulate("keydown", {keyCode: $.ui.keyCode.ENTER});
|
||||||
date.setDate(date.getDate() + 1);
|
date.setDate(date.getDate() + 1);
|
||||||
TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), date, 'Keystroke left');
|
TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), date, "Keystroke left");
|
||||||
inp.val('').datepicker('show').
|
inp.val("").datepicker("show").
|
||||||
simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.RIGHT}).
|
simulate("keydown", {ctrlKey: true, keyCode: $.ui.keyCode.RIGHT}).
|
||||||
simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
|
simulate("keydown", {keyCode: $.ui.keyCode.ENTER});
|
||||||
date.setDate(date.getDate() + 1);
|
date.setDate(date.getDate() + 1);
|
||||||
TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), date, 'Keystroke ctrl+right');
|
TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), date, "Keystroke ctrl+right");
|
||||||
inp.val('').datepicker('show').
|
inp.val("").datepicker("show").
|
||||||
simulate('keydown', {keyCode: $.ui.keyCode.RIGHT}).
|
simulate("keydown", {keyCode: $.ui.keyCode.RIGHT}).
|
||||||
simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
|
simulate("keydown", {keyCode: $.ui.keyCode.ENTER});
|
||||||
date.setDate(date.getDate() - 1);
|
date.setDate(date.getDate() - 1);
|
||||||
TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), date, 'Keystroke right');
|
TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), date, "Keystroke right");
|
||||||
inp.val('').datepicker('show').
|
inp.val("").datepicker("show").
|
||||||
simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.UP}).
|
simulate("keydown", {ctrlKey: true, keyCode: $.ui.keyCode.UP}).
|
||||||
simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
|
simulate("keydown", {keyCode: $.ui.keyCode.ENTER});
|
||||||
date.setDate(date.getDate() - 7);
|
date.setDate(date.getDate() - 7);
|
||||||
TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), date, 'Keystroke ctrl+up');
|
TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), date, "Keystroke ctrl+up");
|
||||||
inp.val('').datepicker('show').
|
inp.val("").datepicker("show").
|
||||||
simulate('keydown', {keyCode: $.ui.keyCode.UP}).
|
simulate("keydown", {keyCode: $.ui.keyCode.UP}).
|
||||||
simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
|
simulate("keydown", {keyCode: $.ui.keyCode.ENTER});
|
||||||
date.setDate(date.getDate() + 7);
|
date.setDate(date.getDate() + 7);
|
||||||
TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), date, 'Keystroke up');
|
TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), date, "Keystroke up");
|
||||||
inp.val('').datepicker('show').
|
inp.val("").datepicker("show").
|
||||||
simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.DOWN}).
|
simulate("keydown", {ctrlKey: true, keyCode: $.ui.keyCode.DOWN}).
|
||||||
simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
|
simulate("keydown", {keyCode: $.ui.keyCode.ENTER});
|
||||||
date.setDate(date.getDate() + 7);
|
date.setDate(date.getDate() + 7);
|
||||||
TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), date, 'Keystroke ctrl+down');
|
TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), date, "Keystroke ctrl+down");
|
||||||
inp.val('').datepicker('show').
|
inp.val("").datepicker("show").
|
||||||
simulate('keydown', {keyCode: $.ui.keyCode.DOWN}).
|
simulate("keydown", {keyCode: $.ui.keyCode.DOWN}).
|
||||||
simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
|
simulate("keydown", {keyCode: $.ui.keyCode.ENTER});
|
||||||
date.setDate(date.getDate() - 7);
|
date.setDate(date.getDate() - 7);
|
||||||
TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), date, 'Keystroke down');
|
TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), date, "Keystroke down");
|
||||||
// Moving by month or year
|
// Moving by month or year
|
||||||
inp.val('02/04/2008').datepicker('show').
|
inp.val("02/04/2008").datepicker("show").
|
||||||
simulate('keydown', {keyCode: $.ui.keyCode.PAGE_UP}).
|
simulate("keydown", {keyCode: $.ui.keyCode.PAGE_UP}).
|
||||||
simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
|
simulate("keydown", {keyCode: $.ui.keyCode.ENTER});
|
||||||
TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), new Date(2008, 1 - 1, 4),
|
TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), new Date(2008, 1 - 1, 4),
|
||||||
'Keystroke pgup');
|
"Keystroke pgup");
|
||||||
inp.val('02/04/2008').datepicker('show').
|
inp.val("02/04/2008").datepicker("show").
|
||||||
simulate('keydown', {keyCode: $.ui.keyCode.PAGE_DOWN}).
|
simulate("keydown", {keyCode: $.ui.keyCode.PAGE_DOWN}).
|
||||||
simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
|
simulate("keydown", {keyCode: $.ui.keyCode.ENTER});
|
||||||
TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), new Date(2008, 3 - 1, 4),
|
TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), new Date(2008, 3 - 1, 4),
|
||||||
'Keystroke pgdn');
|
"Keystroke pgdn");
|
||||||
inp.val('02/04/2008').datepicker('show').
|
inp.val("02/04/2008").datepicker("show").
|
||||||
simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_UP}).
|
simulate("keydown", {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_UP}).
|
||||||
simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
|
simulate("keydown", {keyCode: $.ui.keyCode.ENTER});
|
||||||
TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), new Date(2007, 2 - 1, 4),
|
TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), new Date(2007, 2 - 1, 4),
|
||||||
'Keystroke ctrl+pgup');
|
"Keystroke ctrl+pgup");
|
||||||
inp.val('02/04/2008').datepicker('show').
|
inp.val("02/04/2008").datepicker("show").
|
||||||
simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_DOWN}).
|
simulate("keydown", {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_DOWN}).
|
||||||
simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
|
simulate("keydown", {keyCode: $.ui.keyCode.ENTER});
|
||||||
TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), new Date(2009, 2 - 1, 4),
|
TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), new Date(2009, 2 - 1, 4),
|
||||||
'Keystroke ctrl+pgdn');
|
"Keystroke ctrl+pgdn");
|
||||||
// Check for moving to short months
|
// Check for moving to short months
|
||||||
inp.val('03/31/2008').datepicker('show').
|
inp.val("03/31/2008").datepicker("show").
|
||||||
simulate('keydown', {keyCode: $.ui.keyCode.PAGE_UP}).
|
simulate("keydown", {keyCode: $.ui.keyCode.PAGE_UP}).
|
||||||
simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
|
simulate("keydown", {keyCode: $.ui.keyCode.ENTER});
|
||||||
TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), new Date(2008, 2 - 1, 29),
|
TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), new Date(2008, 2 - 1, 29),
|
||||||
'Keystroke pgup - Feb');
|
"Keystroke pgup - Feb");
|
||||||
inp.val('01/30/2008').datepicker('show').
|
inp.val("01/30/2008").datepicker("show").
|
||||||
simulate('keydown', {keyCode: $.ui.keyCode.PAGE_DOWN}).
|
simulate("keydown", {keyCode: $.ui.keyCode.PAGE_DOWN}).
|
||||||
simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
|
simulate("keydown", {keyCode: $.ui.keyCode.ENTER});
|
||||||
TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), new Date(2008, 2 - 1, 29),
|
TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), new Date(2008, 2 - 1, 29),
|
||||||
'Keystroke pgdn - Feb');
|
"Keystroke pgdn - Feb");
|
||||||
inp.val('02/29/2008').datepicker('show').
|
inp.val("02/29/2008").datepicker("show").
|
||||||
simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_UP}).
|
simulate("keydown", {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_UP}).
|
||||||
simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
|
simulate("keydown", {keyCode: $.ui.keyCode.ENTER});
|
||||||
TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), new Date(2007, 2 - 1, 28),
|
TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), new Date(2007, 2 - 1, 28),
|
||||||
'Keystroke ctrl+pgup - Feb');
|
"Keystroke ctrl+pgup - Feb");
|
||||||
inp.val('02/29/2008').datepicker('show').
|
inp.val("02/29/2008").datepicker("show").
|
||||||
simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_DOWN}).
|
simulate("keydown", {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_DOWN}).
|
||||||
simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
|
simulate("keydown", {keyCode: $.ui.keyCode.ENTER});
|
||||||
TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), new Date(2009, 2 - 1, 28),
|
TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), new Date(2009, 2 - 1, 28),
|
||||||
'Keystroke ctrl+pgdn - Feb');
|
"Keystroke ctrl+pgdn - Feb");
|
||||||
// Goto current
|
// Goto current
|
||||||
inp.datepicker('option', {gotoCurrent: true}).
|
inp.datepicker("option", {gotoCurrent: true}).
|
||||||
datepicker('hide').val('02/04/2008').datepicker('show').
|
datepicker("hide").val("02/04/2008").datepicker("show").
|
||||||
simulate('keydown', {keyCode: $.ui.keyCode.PAGE_DOWN}).
|
simulate("keydown", {keyCode: $.ui.keyCode.PAGE_DOWN}).
|
||||||
simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.HOME}).
|
simulate("keydown", {ctrlKey: true, keyCode: $.ui.keyCode.HOME}).
|
||||||
simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
|
simulate("keydown", {keyCode: $.ui.keyCode.ENTER});
|
||||||
TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), new Date(2008, 2 - 1, 4),
|
TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), new Date(2008, 2 - 1, 4),
|
||||||
'Keystroke ctrl+home');
|
"Keystroke ctrl+home");
|
||||||
// Change steps
|
// Change steps
|
||||||
inp.datepicker('option', {stepMonths: 2, gotoCurrent: false}).
|
inp.datepicker("option", {stepMonths: 2, gotoCurrent: false}).
|
||||||
datepicker('hide').val('02/04/2008').datepicker('show').
|
datepicker("hide").val("02/04/2008").datepicker("show").
|
||||||
simulate('keydown', {keyCode: $.ui.keyCode.PAGE_UP}).
|
simulate("keydown", {keyCode: $.ui.keyCode.PAGE_UP}).
|
||||||
simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
|
simulate("keydown", {keyCode: $.ui.keyCode.ENTER});
|
||||||
TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), new Date(2007, 12 - 1, 4),
|
TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), new Date(2007, 12 - 1, 4),
|
||||||
'Keystroke pgup step 2');
|
"Keystroke pgup step 2");
|
||||||
inp.val('02/04/2008').datepicker('show').
|
inp.val("02/04/2008").datepicker("show").
|
||||||
simulate('keydown', {keyCode: $.ui.keyCode.PAGE_DOWN}).
|
simulate("keydown", {keyCode: $.ui.keyCode.PAGE_DOWN}).
|
||||||
simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
|
simulate("keydown", {keyCode: $.ui.keyCode.ENTER});
|
||||||
TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), new Date(2008, 4 - 1, 4),
|
TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), new Date(2008, 4 - 1, 4),
|
||||||
'Keystroke pgdn step 2');
|
"Keystroke pgdn step 2");
|
||||||
});
|
});
|
||||||
|
|
||||||
test('mouse', function() {
|
test("mouse", function() {
|
||||||
expect( 15 );
|
expect( 15 );
|
||||||
var inl,
|
var inl,
|
||||||
inp = TestHelpers.datepicker.init('#inp'),
|
inp = TestHelpers.datepicker.init("#inp"),
|
||||||
dp = $('#ui-datepicker-div'),
|
dp = $("#ui-datepicker-div"),
|
||||||
date = new Date();
|
date = new Date();
|
||||||
inp.val('').datepicker('show');
|
inp.val("").datepicker("show");
|
||||||
$('.ui-datepicker-calendar tbody a:contains(10)', dp).simulate('click', {});
|
$(".ui-datepicker-calendar tbody a:contains(10)", dp).simulate("click", {});
|
||||||
date.setDate(10);
|
date.setDate(10);
|
||||||
TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), date, 'Mouse click');
|
TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), date, "Mouse click");
|
||||||
inp.val('02/04/2008').datepicker('show');
|
inp.val("02/04/2008").datepicker("show");
|
||||||
$('.ui-datepicker-calendar tbody a:contains(12)', dp).simulate('click', {});
|
$(".ui-datepicker-calendar tbody a:contains(12)", dp).simulate("click", {});
|
||||||
TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), new Date(2008, 2 - 1, 12),
|
TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), new Date(2008, 2 - 1, 12),
|
||||||
'Mouse click - preset');
|
"Mouse click - preset");
|
||||||
inp.val('02/04/2008').datepicker('show');
|
inp.val("02/04/2008").datepicker("show");
|
||||||
inp.val('').datepicker('show');
|
inp.val("").datepicker("show");
|
||||||
$('button.ui-datepicker-close', dp).simulate('click', {});
|
$("button.ui-datepicker-close", dp).simulate("click", {});
|
||||||
ok(inp.datepicker('getDate') == null, 'Mouse click - close');
|
ok(inp.datepicker("getDate") == null, "Mouse click - close");
|
||||||
inp.val('02/04/2008').datepicker('show');
|
inp.val("02/04/2008").datepicker("show");
|
||||||
$('button.ui-datepicker-close', dp).simulate('click', {});
|
$("button.ui-datepicker-close", dp).simulate("click", {});
|
||||||
TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), new Date(2008, 2 - 1, 4),
|
TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), new Date(2008, 2 - 1, 4),
|
||||||
'Mouse click - close + preset');
|
"Mouse click - close + preset");
|
||||||
inp.val('02/04/2008').datepicker('show');
|
inp.val("02/04/2008").datepicker("show");
|
||||||
$('a.ui-datepicker-prev', dp).simulate('click', {});
|
$("a.ui-datepicker-prev", dp).simulate("click", {});
|
||||||
$('button.ui-datepicker-close', dp).simulate('click', {});
|
$("button.ui-datepicker-close", dp).simulate("click", {});
|
||||||
TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), new Date(2008, 2 - 1, 4),
|
TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), new Date(2008, 2 - 1, 4),
|
||||||
'Mouse click - abandoned');
|
"Mouse click - abandoned");
|
||||||
// Current/previous/next
|
// Current/previous/next
|
||||||
inp.val('02/04/2008').datepicker('option', {showButtonPanel: true}).datepicker('show');
|
inp.val("02/04/2008").datepicker("option", {showButtonPanel: true}).datepicker("show");
|
||||||
$('.ui-datepicker-current', dp).simulate('click', {});
|
$(".ui-datepicker-current", dp).simulate("click", {});
|
||||||
$('.ui-datepicker-calendar tbody a:contains(14)', dp).simulate('click', {});
|
$(".ui-datepicker-calendar tbody a:contains(14)", dp).simulate("click", {});
|
||||||
date.setDate(14);
|
date.setDate(14);
|
||||||
TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), date, 'Mouse click - current');
|
TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), date, "Mouse click - current");
|
||||||
inp.val('02/04/2008').datepicker('show');
|
inp.val("02/04/2008").datepicker("show");
|
||||||
$('.ui-datepicker-prev', dp).simulate('click');
|
$(".ui-datepicker-prev", dp).simulate("click");
|
||||||
$('.ui-datepicker-calendar tbody a:contains(16)', dp).simulate('click');
|
$(".ui-datepicker-calendar tbody a:contains(16)", dp).simulate("click");
|
||||||
TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), new Date(2008, 1 - 1, 16),
|
TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), new Date(2008, 1 - 1, 16),
|
||||||
'Mouse click - previous');
|
"Mouse click - previous");
|
||||||
inp.val('02/04/2008').datepicker('show');
|
inp.val("02/04/2008").datepicker("show");
|
||||||
$('.ui-datepicker-next', dp).simulate('click');
|
$(".ui-datepicker-next", dp).simulate("click");
|
||||||
$('.ui-datepicker-calendar tbody a:contains(18)', dp).simulate('click');
|
$(".ui-datepicker-calendar tbody a:contains(18)", dp).simulate("click");
|
||||||
TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), new Date(2008, 3 - 1, 18),
|
TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), new Date(2008, 3 - 1, 18),
|
||||||
'Mouse click - next');
|
"Mouse click - next");
|
||||||
// Previous/next with minimum/maximum
|
// Previous/next with minimum/maximum
|
||||||
inp.datepicker('option', {minDate: new Date(2008, 2 - 1, 2),
|
inp.datepicker("option", {minDate: new Date(2008, 2 - 1, 2),
|
||||||
maxDate: new Date(2008, 2 - 1, 26)}).val('02/04/2008').datepicker('show');
|
maxDate: new Date(2008, 2 - 1, 26)}).val("02/04/2008").datepicker("show");
|
||||||
$('.ui-datepicker-prev', dp).simulate('click');
|
$(".ui-datepicker-prev", dp).simulate("click");
|
||||||
$('.ui-datepicker-calendar tbody a:contains(16)', dp).simulate('click');
|
$(".ui-datepicker-calendar tbody a:contains(16)", dp).simulate("click");
|
||||||
TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), new Date(2008, 2 - 1, 16),
|
TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), new Date(2008, 2 - 1, 16),
|
||||||
'Mouse click - previous + min/max');
|
"Mouse click - previous + min/max");
|
||||||
inp.val('02/04/2008').datepicker('show');
|
inp.val("02/04/2008").datepicker("show");
|
||||||
$('.ui-datepicker-next', dp).simulate('click');
|
$(".ui-datepicker-next", dp).simulate("click");
|
||||||
$('.ui-datepicker-calendar tbody a:contains(18)', dp).simulate('click');
|
$(".ui-datepicker-calendar tbody a:contains(18)", dp).simulate("click");
|
||||||
TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), new Date(2008, 2 - 1, 18),
|
TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), new Date(2008, 2 - 1, 18),
|
||||||
'Mouse click - next + min/max');
|
"Mouse click - next + min/max");
|
||||||
// Inline
|
// Inline
|
||||||
inl = TestHelpers.datepicker.init('#inl');
|
inl = TestHelpers.datepicker.init("#inl");
|
||||||
dp = $('.ui-datepicker-inline', inl);
|
dp = $(".ui-datepicker-inline", inl);
|
||||||
date = new Date();
|
date = new Date();
|
||||||
inl.datepicker('setDate', date);
|
inl.datepicker("setDate", date);
|
||||||
$('.ui-datepicker-calendar tbody a:contains(10)', dp).simulate('click', {});
|
$(".ui-datepicker-calendar tbody a:contains(10)", dp).simulate("click", {});
|
||||||
date.setDate(10);
|
date.setDate(10);
|
||||||
TestHelpers.datepicker.equalsDate(inl.datepicker('getDate'), date, 'Mouse click inline');
|
TestHelpers.datepicker.equalsDate(inl.datepicker("getDate"), date, "Mouse click inline");
|
||||||
inl.datepicker('option', {showButtonPanel: true}).datepicker('setDate', new Date(2008, 2 - 1, 4));
|
inl.datepicker("option", {showButtonPanel: true}).datepicker("setDate", new Date(2008, 2 - 1, 4));
|
||||||
$('.ui-datepicker-calendar tbody a:contains(12)', dp).simulate('click', {});
|
$(".ui-datepicker-calendar tbody a:contains(12)", dp).simulate("click", {});
|
||||||
TestHelpers.datepicker.equalsDate(inl.datepicker('getDate'), new Date(2008, 2 - 1, 12), 'Mouse click inline - preset');
|
TestHelpers.datepicker.equalsDate(inl.datepicker("getDate"), new Date(2008, 2 - 1, 12), "Mouse click inline - preset");
|
||||||
inl.datepicker('option', {showButtonPanel: true});
|
inl.datepicker("option", {showButtonPanel: true});
|
||||||
$('.ui-datepicker-current', dp).simulate('click', {});
|
$(".ui-datepicker-current", dp).simulate("click", {});
|
||||||
$('.ui-datepicker-calendar tbody a:contains(14)', dp).simulate('click', {});
|
$(".ui-datepicker-calendar tbody a:contains(14)", dp).simulate("click", {});
|
||||||
date.setDate(14);
|
date.setDate(14);
|
||||||
TestHelpers.datepicker.equalsDate(inl.datepicker('getDate'), date, 'Mouse click inline - current');
|
TestHelpers.datepicker.equalsDate(inl.datepicker("getDate"), date, "Mouse click inline - current");
|
||||||
inl.datepicker('setDate', new Date(2008, 2 - 1, 4));
|
inl.datepicker("setDate", new Date(2008, 2 - 1, 4));
|
||||||
$('.ui-datepicker-prev', dp).simulate('click');
|
$(".ui-datepicker-prev", dp).simulate("click");
|
||||||
$('.ui-datepicker-calendar tbody a:contains(16)', dp).simulate('click');
|
$(".ui-datepicker-calendar tbody a:contains(16)", dp).simulate("click");
|
||||||
TestHelpers.datepicker.equalsDate(inl.datepicker('getDate'), new Date(2008, 1 - 1, 16),
|
TestHelpers.datepicker.equalsDate(inl.datepicker("getDate"), new Date(2008, 1 - 1, 16),
|
||||||
'Mouse click inline - previous');
|
"Mouse click inline - previous");
|
||||||
inl.datepicker('setDate', new Date(2008, 2 - 1, 4));
|
inl.datepicker("setDate", new Date(2008, 2 - 1, 4));
|
||||||
$('.ui-datepicker-next', dp).simulate('click');
|
$(".ui-datepicker-next", dp).simulate("click");
|
||||||
$('.ui-datepicker-calendar tbody a:contains(18)', dp).simulate('click');
|
$(".ui-datepicker-calendar tbody a:contains(18)", dp).simulate("click");
|
||||||
TestHelpers.datepicker.equalsDate(inl.datepicker('getDate'), new Date(2008, 3 - 1, 18),
|
TestHelpers.datepicker.equalsDate(inl.datepicker("getDate"), new Date(2008, 3 - 1, 18),
|
||||||
'Mouse click inline - next');
|
"Mouse click inline - next");
|
||||||
});
|
});
|
||||||
|
|
||||||
})(jQuery);
|
})(jQuery);
|
||||||
|
@ -17,137 +17,137 @@ function callback(date, inst) {
|
|||||||
|
|
||||||
function callback2(year, month, inst) {
|
function callback2(year, month, inst) {
|
||||||
selectedThis = this;
|
selectedThis = this;
|
||||||
selectedDate = year + '/' + month;
|
selectedDate = year + "/" + month;
|
||||||
selectedInst = inst;
|
selectedInst = inst;
|
||||||
}
|
}
|
||||||
|
|
||||||
test('events', function() {
|
test("events", function() {
|
||||||
expect( 26 );
|
expect( 26 );
|
||||||
var dateStr, newMonthYear, inp2,
|
var dateStr, newMonthYear, inp2,
|
||||||
inp = TestHelpers.datepicker.init('#inp', {onSelect: callback}),
|
inp = TestHelpers.datepicker.init("#inp", {onSelect: callback}),
|
||||||
date = new Date();
|
date = new Date();
|
||||||
// onSelect
|
// onSelect
|
||||||
inp.val('').datepicker('show').
|
inp.val("").datepicker("show").
|
||||||
simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
|
simulate("keydown", {keyCode: $.ui.keyCode.ENTER});
|
||||||
equal(selectedThis, inp[0], 'Callback selected this');
|
equal(selectedThis, inp[0], "Callback selected this");
|
||||||
equal(selectedInst, $.data(inp[0], TestHelpers.datepicker.PROP_NAME), 'Callback selected inst');
|
equal(selectedInst, $.data(inp[0], TestHelpers.datepicker.PROP_NAME), "Callback selected inst");
|
||||||
equal(selectedDate, $.datepicker.formatDate('mm/dd/yy', date),
|
equal(selectedDate, $.datepicker.formatDate("mm/dd/yy", date),
|
||||||
'Callback selected date');
|
"Callback selected date");
|
||||||
inp.val('').datepicker('show').
|
inp.val("").datepicker("show").
|
||||||
simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.DOWN}).
|
simulate("keydown", {ctrlKey: true, keyCode: $.ui.keyCode.DOWN}).
|
||||||
simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
|
simulate("keydown", {keyCode: $.ui.keyCode.ENTER});
|
||||||
date.setDate(date.getDate() + 7);
|
date.setDate(date.getDate() + 7);
|
||||||
equal(selectedDate, $.datepicker.formatDate('mm/dd/yy', date),
|
equal(selectedDate, $.datepicker.formatDate("mm/dd/yy", date),
|
||||||
'Callback selected date - ctrl+down');
|
"Callback selected date - ctrl+down");
|
||||||
inp.val('').datepicker('show').
|
inp.val("").datepicker("show").
|
||||||
simulate('keydown', {keyCode: $.ui.keyCode.ESCAPE});
|
simulate("keydown", {keyCode: $.ui.keyCode.ESCAPE});
|
||||||
equal(selectedDate, $.datepicker.formatDate('mm/dd/yy', date),
|
equal(selectedDate, $.datepicker.formatDate("mm/dd/yy", date),
|
||||||
'Callback selected date - esc');
|
"Callback selected date - esc");
|
||||||
dateStr = '02/04/2008';
|
dateStr = "02/04/2008";
|
||||||
inp.val(dateStr).datepicker('show').
|
inp.val(dateStr).datepicker("show").
|
||||||
simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
|
simulate("keydown", {keyCode: $.ui.keyCode.ENTER});
|
||||||
equal(dateStr, selectedDate,
|
equal(dateStr, selectedDate,
|
||||||
'onSelect is called after enter keydown');
|
"onSelect is called after enter keydown");
|
||||||
// onChangeMonthYear
|
// onChangeMonthYear
|
||||||
inp.datepicker('option', {onChangeMonthYear: callback2, onSelect: null}).
|
inp.datepicker("option", {onChangeMonthYear: callback2, onSelect: null}).
|
||||||
val('').datepicker('show');
|
val("").datepicker("show");
|
||||||
newMonthYear = function(date) {
|
newMonthYear = function(date) {
|
||||||
return date.getFullYear() + '/' + (date.getMonth() + 1);
|
return date.getFullYear() + "/" + (date.getMonth() + 1);
|
||||||
};
|
};
|
||||||
date = new Date();
|
date = new Date();
|
||||||
date.setDate(1);
|
date.setDate(1);
|
||||||
inp.simulate('keydown', {keyCode: $.ui.keyCode.PAGE_UP});
|
inp.simulate("keydown", {keyCode: $.ui.keyCode.PAGE_UP});
|
||||||
date.setMonth(date.getMonth() - 1);
|
date.setMonth(date.getMonth() - 1);
|
||||||
equal(selectedThis, inp[0], 'Callback change month/year this');
|
equal(selectedThis, inp[0], "Callback change month/year this");
|
||||||
equal(selectedInst, $.data(inp[0], TestHelpers.datepicker.PROP_NAME), 'Callback change month/year inst');
|
equal(selectedInst, $.data(inp[0], TestHelpers.datepicker.PROP_NAME), "Callback change month/year inst");
|
||||||
equal(selectedDate, newMonthYear(date),
|
equal(selectedDate, newMonthYear(date),
|
||||||
'Callback change month/year date - pgup');
|
"Callback change month/year date - pgup");
|
||||||
inp.simulate('keydown', {keyCode: $.ui.keyCode.PAGE_DOWN});
|
inp.simulate("keydown", {keyCode: $.ui.keyCode.PAGE_DOWN});
|
||||||
date.setMonth(date.getMonth() + 1);
|
date.setMonth(date.getMonth() + 1);
|
||||||
equal(selectedDate, newMonthYear(date),
|
equal(selectedDate, newMonthYear(date),
|
||||||
'Callback change month/year date - pgdn');
|
"Callback change month/year date - pgdn");
|
||||||
inp.simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_UP});
|
inp.simulate("keydown", {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_UP});
|
||||||
date.setFullYear(date.getFullYear() - 1);
|
date.setFullYear(date.getFullYear() - 1);
|
||||||
equal(selectedDate, newMonthYear(date),
|
equal(selectedDate, newMonthYear(date),
|
||||||
'Callback change month/year date - ctrl+pgup');
|
"Callback change month/year date - ctrl+pgup");
|
||||||
inp.simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.HOME});
|
inp.simulate("keydown", {ctrlKey: true, keyCode: $.ui.keyCode.HOME});
|
||||||
date.setFullYear(date.getFullYear() + 1);
|
date.setFullYear(date.getFullYear() + 1);
|
||||||
equal(selectedDate, newMonthYear(date),
|
equal(selectedDate, newMonthYear(date),
|
||||||
'Callback change month/year date - ctrl+home');
|
"Callback change month/year date - ctrl+home");
|
||||||
inp.simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_DOWN});
|
inp.simulate("keydown", {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_DOWN});
|
||||||
date.setFullYear(date.getFullYear() + 1);
|
date.setFullYear(date.getFullYear() + 1);
|
||||||
equal(selectedDate, newMonthYear(date),
|
equal(selectedDate, newMonthYear(date),
|
||||||
'Callback change month/year date - ctrl+pgdn');
|
"Callback change month/year date - ctrl+pgdn");
|
||||||
inp.datepicker('setDate', new Date(2007, 1 - 1, 26));
|
inp.datepicker("setDate", new Date(2007, 1 - 1, 26));
|
||||||
equal(selectedDate, '2007/1', 'Callback change month/year date - setDate');
|
equal(selectedDate, "2007/1", "Callback change month/year date - setDate");
|
||||||
selectedDate = null;
|
selectedDate = null;
|
||||||
inp.datepicker('setDate', new Date(2007, 1 - 1, 12));
|
inp.datepicker("setDate", new Date(2007, 1 - 1, 12));
|
||||||
ok(selectedDate == null, 'Callback change month/year date - setDate no change');
|
ok(selectedDate == null, "Callback change month/year date - setDate no change");
|
||||||
// onChangeMonthYear step by 2
|
// onChangeMonthYear step by 2
|
||||||
inp.datepicker('option', {stepMonths: 2}).
|
inp.datepicker("option", {stepMonths: 2}).
|
||||||
datepicker('hide').val('').datepicker('show').
|
datepicker("hide").val("").datepicker("show").
|
||||||
simulate('keydown', {keyCode: $.ui.keyCode.PAGE_UP});
|
simulate("keydown", {keyCode: $.ui.keyCode.PAGE_UP});
|
||||||
date.setMonth(date.getMonth() - 14);
|
date.setMonth(date.getMonth() - 14);
|
||||||
equal(selectedDate, newMonthYear(date),
|
equal(selectedDate, newMonthYear(date),
|
||||||
'Callback change month/year by 2 date - pgup');
|
"Callback change month/year by 2 date - pgup");
|
||||||
inp.simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_UP});
|
inp.simulate("keydown", {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_UP});
|
||||||
date.setMonth(date.getMonth() - 12);
|
date.setMonth(date.getMonth() - 12);
|
||||||
equal(selectedDate, newMonthYear(date),
|
equal(selectedDate, newMonthYear(date),
|
||||||
'Callback change month/year by 2 date - ctrl+pgup');
|
"Callback change month/year by 2 date - ctrl+pgup");
|
||||||
inp.simulate('keydown', {keyCode: $.ui.keyCode.PAGE_DOWN});
|
inp.simulate("keydown", {keyCode: $.ui.keyCode.PAGE_DOWN});
|
||||||
date.setMonth(date.getMonth() + 2);
|
date.setMonth(date.getMonth() + 2);
|
||||||
equal(selectedDate, newMonthYear(date),
|
equal(selectedDate, newMonthYear(date),
|
||||||
'Callback change month/year by 2 date - pgdn');
|
"Callback change month/year by 2 date - pgdn");
|
||||||
inp.simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_DOWN});
|
inp.simulate("keydown", {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_DOWN});
|
||||||
date.setMonth(date.getMonth() + 12);
|
date.setMonth(date.getMonth() + 12);
|
||||||
equal(selectedDate, newMonthYear(date),
|
equal(selectedDate, newMonthYear(date),
|
||||||
'Callback change month/year by 2 date - ctrl+pgdn');
|
"Callback change month/year by 2 date - ctrl+pgdn");
|
||||||
// onClose
|
// onClose
|
||||||
inp.datepicker('option', {onClose: callback, onChangeMonthYear: null, stepMonths: 1}).
|
inp.datepicker("option", {onClose: callback, onChangeMonthYear: null, stepMonths: 1}).
|
||||||
val('').datepicker('show').
|
val("").datepicker("show").
|
||||||
simulate('keydown', {keyCode: $.ui.keyCode.ESCAPE});
|
simulate("keydown", {keyCode: $.ui.keyCode.ESCAPE});
|
||||||
equal(selectedThis, inp[0], 'Callback close this');
|
equal(selectedThis, inp[0], "Callback close this");
|
||||||
equal(selectedInst, $.data(inp[0], TestHelpers.datepicker.PROP_NAME), 'Callback close inst');
|
equal(selectedInst, $.data(inp[0], TestHelpers.datepicker.PROP_NAME), "Callback close inst");
|
||||||
equal(selectedDate, '', 'Callback close date - esc');
|
equal(selectedDate, "", "Callback close date - esc");
|
||||||
inp.val('').datepicker('show').
|
inp.val("").datepicker("show").
|
||||||
simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
|
simulate("keydown", {keyCode: $.ui.keyCode.ENTER});
|
||||||
equal(selectedDate, $.datepicker.formatDate('mm/dd/yy', new Date()),
|
equal(selectedDate, $.datepicker.formatDate("mm/dd/yy", new Date()),
|
||||||
'Callback close date - enter');
|
"Callback close date - enter");
|
||||||
inp.val('02/04/2008').datepicker('show').
|
inp.val("02/04/2008").datepicker("show").
|
||||||
simulate('keydown', {keyCode: $.ui.keyCode.ESCAPE});
|
simulate("keydown", {keyCode: $.ui.keyCode.ESCAPE});
|
||||||
equal(selectedDate, '02/04/2008', 'Callback close date - preset');
|
equal(selectedDate, "02/04/2008", "Callback close date - preset");
|
||||||
inp.val('02/04/2008').datepicker('show').
|
inp.val("02/04/2008").datepicker("show").
|
||||||
simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.END});
|
simulate("keydown", {ctrlKey: true, keyCode: $.ui.keyCode.END});
|
||||||
equal(selectedDate, '', 'Callback close date - ctrl+end');
|
equal(selectedDate, "", "Callback close date - ctrl+end");
|
||||||
|
|
||||||
inp2 = TestHelpers.datepicker.init('#inp2');
|
inp2 = TestHelpers.datepicker.init("#inp2");
|
||||||
inp2.datepicker().datepicker('option', {onClose: callback}).datepicker('show');
|
inp2.datepicker().datepicker("option", {onClose: callback}).datepicker("show");
|
||||||
inp.datepicker('show');
|
inp.datepicker("show");
|
||||||
equal(selectedThis, inp2[0], 'Callback close this');
|
equal(selectedThis, inp2[0], "Callback close this");
|
||||||
});
|
});
|
||||||
|
|
||||||
test('beforeShowDay-getDate', function() {
|
test("beforeShowDay-getDate", function() {
|
||||||
expect( 3 );
|
expect( 3 );
|
||||||
var inp = TestHelpers.datepicker.init('#inp', {beforeShowDay: function() { inp.datepicker('getDate'); return [true, '']; }}),
|
var inp = TestHelpers.datepicker.init("#inp", {beforeShowDay: function() { inp.datepicker("getDate"); return [true, ""]; }}),
|
||||||
dp = $('#ui-datepicker-div');
|
dp = $("#ui-datepicker-div");
|
||||||
inp.val('01/01/2010').datepicker('show');
|
inp.val("01/01/2010").datepicker("show");
|
||||||
// contains non-breaking space
|
// contains non-breaking space
|
||||||
equal($('div.ui-datepicker-title').text(),
|
equal($("div.ui-datepicker-title").text(),
|
||||||
// support: IE <9, jQuery <1.8
|
// support: IE <9, jQuery <1.8
|
||||||
// In IE7/8 with jQuery <1.8, encoded spaces behave in strange ways
|
// In IE7/8 with jQuery <1.8, encoded spaces behave in strange ways
|
||||||
$( "<span>January 2010</span>" ).text(), 'Initial month');
|
$( "<span>January 2010</span>" ).text(), "Initial month");
|
||||||
$('a.ui-datepicker-next', dp).click();
|
$("a.ui-datepicker-next", dp).click();
|
||||||
$('a.ui-datepicker-next', dp).click();
|
$("a.ui-datepicker-next", dp).click();
|
||||||
// contains non-breaking space
|
// contains non-breaking space
|
||||||
equal($('div.ui-datepicker-title').text(),
|
equal($("div.ui-datepicker-title").text(),
|
||||||
$( "<span>March 2010</span>" ).text(), 'After next clicks');
|
$( "<span>March 2010</span>" ).text(), "After next clicks");
|
||||||
inp.datepicker('hide').datepicker('show');
|
inp.datepicker("hide").datepicker("show");
|
||||||
$('a.ui-datepicker-prev', dp).click();
|
$("a.ui-datepicker-prev", dp).click();
|
||||||
$('a.ui-datepicker-prev', dp).click();
|
$("a.ui-datepicker-prev", dp).click();
|
||||||
// contains non-breaking space
|
// contains non-breaking space
|
||||||
equal($('div.ui-datepicker-title').text(),
|
equal($("div.ui-datepicker-title").text(),
|
||||||
$( "<span>November 2009</span>" ).text(), 'After prev clicks');
|
$( "<span>November 2009</span>" ).text(), "After prev clicks");
|
||||||
inp.datepicker('hide');
|
inp.datepicker("hide");
|
||||||
});
|
});
|
||||||
|
|
||||||
})(jQuery);
|
})(jQuery);
|
||||||
|
@ -5,121 +5,121 @@
|
|||||||
|
|
||||||
module("datepicker: methods");
|
module("datepicker: methods");
|
||||||
|
|
||||||
test('destroy', function() {
|
test("destroy", function() {
|
||||||
expect( 33 );
|
expect( 33 );
|
||||||
var inl,
|
var inl,
|
||||||
inp = TestHelpers.datepicker.init('#inp');
|
inp = TestHelpers.datepicker.init("#inp");
|
||||||
ok(inp.is('.hasDatepicker'), 'Default - marker class set');
|
ok(inp.is(".hasDatepicker"), "Default - marker class set");
|
||||||
ok($.data(inp[0], TestHelpers.datepicker.PROP_NAME), 'Default - instance present');
|
ok($.data(inp[0], TestHelpers.datepicker.PROP_NAME), "Default - instance present");
|
||||||
ok(inp.next().is('#alt'), 'Default - button absent');
|
ok(inp.next().is("#alt"), "Default - button absent");
|
||||||
inp.datepicker('destroy');
|
inp.datepicker("destroy");
|
||||||
inp = $('#inp');
|
inp = $("#inp");
|
||||||
ok(!inp.is('.hasDatepicker'), 'Default - marker class cleared');
|
ok(!inp.is(".hasDatepicker"), "Default - marker class cleared");
|
||||||
ok(!$.data(inp[0], TestHelpers.datepicker.PROP_NAME), 'Default - instance absent');
|
ok(!$.data(inp[0], TestHelpers.datepicker.PROP_NAME), "Default - instance absent");
|
||||||
ok(inp.next().is('#alt'), 'Default - button absent');
|
ok(inp.next().is("#alt"), "Default - button absent");
|
||||||
// With button
|
// With button
|
||||||
inp= TestHelpers.datepicker.init('#inp', {showOn: 'both'});
|
inp= TestHelpers.datepicker.init("#inp", {showOn: "both"});
|
||||||
ok(inp.is('.hasDatepicker'), 'Button - marker class set');
|
ok(inp.is(".hasDatepicker"), "Button - marker class set");
|
||||||
ok($.data(inp[0], TestHelpers.datepicker.PROP_NAME), 'Button - instance present');
|
ok($.data(inp[0], TestHelpers.datepicker.PROP_NAME), "Button - instance present");
|
||||||
ok(inp.next().text() === '...', 'Button - button added');
|
ok(inp.next().text() === "...", "Button - button added");
|
||||||
inp.datepicker('destroy');
|
inp.datepicker("destroy");
|
||||||
inp = $('#inp');
|
inp = $("#inp");
|
||||||
ok(!inp.is('.hasDatepicker'), 'Button - marker class cleared');
|
ok(!inp.is(".hasDatepicker"), "Button - marker class cleared");
|
||||||
ok(!$.data(inp[0], TestHelpers.datepicker.PROP_NAME), 'Button - instance absent');
|
ok(!$.data(inp[0], TestHelpers.datepicker.PROP_NAME), "Button - instance absent");
|
||||||
ok(inp.next().is('#alt'), 'Button - button removed');
|
ok(inp.next().is("#alt"), "Button - button removed");
|
||||||
// With append text
|
// With append text
|
||||||
inp = TestHelpers.datepicker.init('#inp', {appendText: 'Testing'});
|
inp = TestHelpers.datepicker.init("#inp", {appendText: "Testing"});
|
||||||
ok(inp.is('.hasDatepicker'), 'Append - marker class set');
|
ok(inp.is(".hasDatepicker"), "Append - marker class set");
|
||||||
ok($.data(inp[0], TestHelpers.datepicker.PROP_NAME), 'Append - instance present');
|
ok($.data(inp[0], TestHelpers.datepicker.PROP_NAME), "Append - instance present");
|
||||||
ok(inp.next().text() === 'Testing', 'Append - append text added');
|
ok(inp.next().text() === "Testing", "Append - append text added");
|
||||||
inp.datepicker('destroy');
|
inp.datepicker("destroy");
|
||||||
inp = $('#inp');
|
inp = $("#inp");
|
||||||
ok(!inp.is('.hasDatepicker'), 'Append - marker class cleared');
|
ok(!inp.is(".hasDatepicker"), "Append - marker class cleared");
|
||||||
ok(!$.data(inp[0], TestHelpers.datepicker.PROP_NAME), 'Append - instance absent');
|
ok(!$.data(inp[0], TestHelpers.datepicker.PROP_NAME), "Append - instance absent");
|
||||||
ok(inp.next().is('#alt'), 'Append - append text removed');
|
ok(inp.next().is("#alt"), "Append - append text removed");
|
||||||
// With both
|
// With both
|
||||||
inp= TestHelpers.datepicker.init('#inp', {showOn: 'both', buttonImageOnly: true,
|
inp= TestHelpers.datepicker.init("#inp", {showOn: "both", buttonImageOnly: true,
|
||||||
buttonImage: 'img/calendar.gif', appendText: 'Testing'});
|
buttonImage: "img/calendar.gif", appendText: "Testing"});
|
||||||
ok(inp.is('.hasDatepicker'), 'Both - marker class set');
|
ok(inp.is(".hasDatepicker"), "Both - marker class set");
|
||||||
ok($.data(inp[0], TestHelpers.datepicker.PROP_NAME), 'Both - instance present');
|
ok($.data(inp[0], TestHelpers.datepicker.PROP_NAME), "Both - instance present");
|
||||||
ok(inp.next()[0].nodeName.toLowerCase() === 'img', 'Both - button added');
|
ok(inp.next()[0].nodeName.toLowerCase() === "img", "Both - button added");
|
||||||
ok(inp.next().next().text() === 'Testing', 'Both - append text added');
|
ok(inp.next().next().text() === "Testing", "Both - append text added");
|
||||||
inp.datepicker('destroy');
|
inp.datepicker("destroy");
|
||||||
inp = $('#inp');
|
inp = $("#inp");
|
||||||
ok(!inp.is('.hasDatepicker'), 'Both - marker class cleared');
|
ok(!inp.is(".hasDatepicker"), "Both - marker class cleared");
|
||||||
ok(!$.data(inp[0], TestHelpers.datepicker.PROP_NAME), 'Both - instance absent');
|
ok(!$.data(inp[0], TestHelpers.datepicker.PROP_NAME), "Both - instance absent");
|
||||||
ok(inp.next().is('#alt'), 'Both - button and append text absent');
|
ok(inp.next().is("#alt"), "Both - button and append text absent");
|
||||||
// Inline
|
// Inline
|
||||||
inl = TestHelpers.datepicker.init('#inl');
|
inl = TestHelpers.datepicker.init("#inl");
|
||||||
ok(inl.is('.hasDatepicker'), 'Inline - marker class set');
|
ok(inl.is(".hasDatepicker"), "Inline - marker class set");
|
||||||
ok(inl.html() !== '', 'Inline - datepicker present');
|
ok(inl.html() !== "", "Inline - datepicker present");
|
||||||
ok($.data(inl[0], TestHelpers.datepicker.PROP_NAME), 'Inline - instance present');
|
ok($.data(inl[0], TestHelpers.datepicker.PROP_NAME), "Inline - instance present");
|
||||||
ok(inl.next().length === 0 || inl.next().is('p'), 'Inline - button absent');
|
ok(inl.next().length === 0 || inl.next().is("p"), "Inline - button absent");
|
||||||
inl.datepicker('destroy');
|
inl.datepicker("destroy");
|
||||||
inl = $('#inl');
|
inl = $("#inl");
|
||||||
ok(!inl.is('.hasDatepicker'), 'Inline - marker class cleared');
|
ok(!inl.is(".hasDatepicker"), "Inline - marker class cleared");
|
||||||
ok(inl.html() === '', 'Inline - datepicker absent');
|
ok(inl.html() === "", "Inline - datepicker absent");
|
||||||
ok(!$.data(inl[0], TestHelpers.datepicker.PROP_NAME), 'Inline - instance absent');
|
ok(!$.data(inl[0], TestHelpers.datepicker.PROP_NAME), "Inline - instance absent");
|
||||||
ok(inl.next().length === 0 || inl.next().is('p'), 'Inline - button absent');
|
ok(inl.next().length === 0 || inl.next().is("p"), "Inline - button absent");
|
||||||
});
|
});
|
||||||
|
|
||||||
test('enableDisable', function() {
|
test("enableDisable", function() {
|
||||||
expect( 33 );
|
expect( 33 );
|
||||||
var inl, dp,
|
var inl, dp,
|
||||||
inp = TestHelpers.datepicker.init('#inp');
|
inp = TestHelpers.datepicker.init("#inp");
|
||||||
ok(!inp.datepicker('isDisabled'), 'Enable/disable - initially marked as enabled');
|
ok(!inp.datepicker("isDisabled"), "Enable/disable - initially marked as enabled");
|
||||||
ok(!inp[0].disabled, 'Enable/disable - field initially enabled');
|
ok(!inp[0].disabled, "Enable/disable - field initially enabled");
|
||||||
inp.datepicker('disable');
|
inp.datepicker("disable");
|
||||||
ok(inp.datepicker('isDisabled'), 'Enable/disable - now marked as disabled');
|
ok(inp.datepicker("isDisabled"), "Enable/disable - now marked as disabled");
|
||||||
ok(inp[0].disabled, 'Enable/disable - field now disabled');
|
ok(inp[0].disabled, "Enable/disable - field now disabled");
|
||||||
inp.datepicker('enable');
|
inp.datepicker("enable");
|
||||||
ok(!inp.datepicker('isDisabled'), 'Enable/disable - now marked as enabled');
|
ok(!inp.datepicker("isDisabled"), "Enable/disable - now marked as enabled");
|
||||||
ok(!inp[0].disabled, 'Enable/disable - field now enabled');
|
ok(!inp[0].disabled, "Enable/disable - field now enabled");
|
||||||
inp.datepicker('destroy');
|
inp.datepicker("destroy");
|
||||||
// With a button
|
// With a button
|
||||||
inp = TestHelpers.datepicker.init('#inp', {showOn: 'button'});
|
inp = TestHelpers.datepicker.init("#inp", {showOn: "button"});
|
||||||
ok(!inp.datepicker('isDisabled'), 'Enable/disable button - initially marked as enabled');
|
ok(!inp.datepicker("isDisabled"), "Enable/disable button - initially marked as enabled");
|
||||||
ok(!inp[0].disabled, 'Enable/disable button - field initially enabled');
|
ok(!inp[0].disabled, "Enable/disable button - field initially enabled");
|
||||||
ok(!inp.next('button')[0].disabled, 'Enable/disable button - button initially enabled');
|
ok(!inp.next("button")[0].disabled, "Enable/disable button - button initially enabled");
|
||||||
inp.datepicker('disable');
|
inp.datepicker("disable");
|
||||||
ok(inp.datepicker('isDisabled'), 'Enable/disable button - now marked as disabled');
|
ok(inp.datepicker("isDisabled"), "Enable/disable button - now marked as disabled");
|
||||||
ok(inp[0].disabled, 'Enable/disable button - field now disabled');
|
ok(inp[0].disabled, "Enable/disable button - field now disabled");
|
||||||
ok(inp.next('button')[0].disabled, 'Enable/disable button - button now disabled');
|
ok(inp.next("button")[0].disabled, "Enable/disable button - button now disabled");
|
||||||
inp.datepicker('enable');
|
inp.datepicker("enable");
|
||||||
ok(!inp.datepicker('isDisabled'), 'Enable/disable button - now marked as enabled');
|
ok(!inp.datepicker("isDisabled"), "Enable/disable button - now marked as enabled");
|
||||||
ok(!inp[0].disabled, 'Enable/disable button - field now enabled');
|
ok(!inp[0].disabled, "Enable/disable button - field now enabled");
|
||||||
ok(!inp.next('button')[0].disabled, 'Enable/disable button - button now enabled');
|
ok(!inp.next("button")[0].disabled, "Enable/disable button - button now enabled");
|
||||||
inp.datepicker('destroy');
|
inp.datepicker("destroy");
|
||||||
// With an image button
|
// With an image button
|
||||||
inp = TestHelpers.datepicker.init('#inp', {showOn: 'button', buttonImageOnly: true,
|
inp = TestHelpers.datepicker.init("#inp", {showOn: "button", buttonImageOnly: true,
|
||||||
buttonImage: 'img/calendar.gif'});
|
buttonImage: "img/calendar.gif"});
|
||||||
ok(!inp.datepicker('isDisabled'), 'Enable/disable image - initially marked as enabled');
|
ok(!inp.datepicker("isDisabled"), "Enable/disable image - initially marked as enabled");
|
||||||
ok(!inp[0].disabled, 'Enable/disable image - field initially enabled');
|
ok(!inp[0].disabled, "Enable/disable image - field initially enabled");
|
||||||
ok(parseFloat(inp.next('img').css('opacity')) === 1, 'Enable/disable image - image initially enabled');
|
ok(parseFloat(inp.next("img").css("opacity")) === 1, "Enable/disable image - image initially enabled");
|
||||||
inp.datepicker('disable');
|
inp.datepicker("disable");
|
||||||
ok(inp.datepicker('isDisabled'), 'Enable/disable image - now marked as disabled');
|
ok(inp.datepicker("isDisabled"), "Enable/disable image - now marked as disabled");
|
||||||
ok(inp[0].disabled, 'Enable/disable image - field now disabled');
|
ok(inp[0].disabled, "Enable/disable image - field now disabled");
|
||||||
ok(parseFloat(inp.next('img').css('opacity')) !== 1, 'Enable/disable image - image now disabled');
|
ok(parseFloat(inp.next("img").css("opacity")) !== 1, "Enable/disable image - image now disabled");
|
||||||
inp.datepicker('enable');
|
inp.datepicker("enable");
|
||||||
ok(!inp.datepicker('isDisabled'), 'Enable/disable image - now marked as enabled');
|
ok(!inp.datepicker("isDisabled"), "Enable/disable image - now marked as enabled");
|
||||||
ok(!inp[0].disabled, 'Enable/disable image - field now enabled');
|
ok(!inp[0].disabled, "Enable/disable image - field now enabled");
|
||||||
ok(parseFloat(inp.next('img').css('opacity')) === 1, 'Enable/disable image - image now enabled');
|
ok(parseFloat(inp.next("img").css("opacity")) === 1, "Enable/disable image - image now enabled");
|
||||||
inp.datepicker('destroy');
|
inp.datepicker("destroy");
|
||||||
// Inline
|
// Inline
|
||||||
inl = TestHelpers.datepicker.init('#inl', {changeYear: true});
|
inl = TestHelpers.datepicker.init("#inl", {changeYear: true});
|
||||||
dp = $('.ui-datepicker-inline', inl);
|
dp = $(".ui-datepicker-inline", inl);
|
||||||
ok(!inl.datepicker('isDisabled'), 'Enable/disable inline - initially marked as enabled');
|
ok(!inl.datepicker("isDisabled"), "Enable/disable inline - initially marked as enabled");
|
||||||
ok(!dp.children().is('.ui-state-disabled'), 'Enable/disable inline - not visually disabled initially');
|
ok(!dp.children().is(".ui-state-disabled"), "Enable/disable inline - not visually disabled initially");
|
||||||
ok(!dp.find('select').prop('disabled'), 'Enable/disable inline - form element enabled initially');
|
ok(!dp.find("select").prop("disabled"), "Enable/disable inline - form element enabled initially");
|
||||||
inl.datepicker('disable');
|
inl.datepicker("disable");
|
||||||
ok(inl.datepicker('isDisabled'), 'Enable/disable inline - now marked as disabled');
|
ok(inl.datepicker("isDisabled"), "Enable/disable inline - now marked as disabled");
|
||||||
ok(dp.children().is('.ui-state-disabled'), 'Enable/disable inline - visually disabled');
|
ok(dp.children().is(".ui-state-disabled"), "Enable/disable inline - visually disabled");
|
||||||
ok(dp.find('select').prop('disabled'), 'Enable/disable inline - form element disabled');
|
ok(dp.find("select").prop("disabled"), "Enable/disable inline - form element disabled");
|
||||||
inl.datepicker('enable');
|
inl.datepicker("enable");
|
||||||
ok(!inl.datepicker('isDisabled'), 'Enable/disable inline - now marked as enabled');
|
ok(!inl.datepicker("isDisabled"), "Enable/disable inline - now marked as enabled");
|
||||||
ok(!dp.children().is('.ui-state-disabled'), 'Enable/disable inline - not visiually disabled');
|
ok(!dp.children().is(".ui-state-disabled"), "Enable/disable inline - not visiually disabled");
|
||||||
ok(!dp.find('select').prop('disabled'), 'Enable/disable inline - form element enabled');
|
ok(!dp.find("select").prop("disabled"), "Enable/disable inline - form element enabled");
|
||||||
inl.datepicker('destroy');
|
inl.datepicker("destroy");
|
||||||
});
|
});
|
||||||
|
|
||||||
})(jQuery);
|
})(jQuery);
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -7,7 +7,7 @@ TestHelpers.datepicker = {
|
|||||||
},
|
},
|
||||||
equalsDate: function(d1, d2, message) {
|
equalsDate: function(d1, d2, message) {
|
||||||
if (!d1 || !d2) {
|
if (!d1 || !d2) {
|
||||||
ok(false, message + ' - missing date');
|
ok(false, message + " - missing date");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
d1 = new Date(d1.getFullYear(), d1.getMonth(), d1.getDate());
|
d1 = new Date(d1.getFullYear(), d1.getMonth(), d1.getDate());
|
||||||
@ -15,8 +15,8 @@ TestHelpers.datepicker = {
|
|||||||
equal(d1.toString(), d2.toString(), message);
|
equal(d1.toString(), d2.toString(), message);
|
||||||
},
|
},
|
||||||
init: function(id, options) {
|
init: function(id, options) {
|
||||||
$.datepicker.setDefaults($.datepicker.regional['']);
|
$.datepicker.setDefaults($.datepicker.regional[""]);
|
||||||
return $(id).datepicker($.extend({showAnim: ''}, options || {}));
|
return $(id).datepicker($.extend({showAnim: ""}, options || {}));
|
||||||
},
|
},
|
||||||
PROP_NAME: 'datepicker'
|
PROP_NAME: "datepicker"
|
||||||
};
|
};
|
@ -4,11 +4,11 @@ TestHelpers.commonWidgetTests( "dialog", {
|
|||||||
autoOpen: true,
|
autoOpen: true,
|
||||||
buttons: [],
|
buttons: [],
|
||||||
closeOnEscape: true,
|
closeOnEscape: true,
|
||||||
closeText: 'close',
|
closeText: "close",
|
||||||
disabled: false,
|
disabled: false,
|
||||||
dialogClass: '',
|
dialogClass: "",
|
||||||
draggable: true,
|
draggable: true,
|
||||||
height: 'auto',
|
height: "auto",
|
||||||
hide: null,
|
hide: null,
|
||||||
maxHeight: null,
|
maxHeight: null,
|
||||||
maxWidth: null,
|
maxWidth: null,
|
||||||
@ -16,10 +16,10 @@ TestHelpers.commonWidgetTests( "dialog", {
|
|||||||
minWidth: 150,
|
minWidth: 150,
|
||||||
modal: false,
|
modal: false,
|
||||||
position: {
|
position: {
|
||||||
my: 'center',
|
my: "center",
|
||||||
at: 'center',
|
at: "center",
|
||||||
of: window,
|
of: window,
|
||||||
collision: 'fit',
|
collision: "fit",
|
||||||
using: $.ui.dialog.prototype.options.position.using
|
using: $.ui.dialog.prototype.options.position.using
|
||||||
},
|
},
|
||||||
resizable: true,
|
resizable: true,
|
||||||
|
@ -10,10 +10,10 @@ test("title id", function() {
|
|||||||
expect(1);
|
expect(1);
|
||||||
|
|
||||||
var titleId,
|
var titleId,
|
||||||
el = $('<div></div>').dialog();
|
el = $("<div></div>").dialog();
|
||||||
|
|
||||||
titleId = el.dialog('widget').find('.ui-dialog-title').attr('id');
|
titleId = el.dialog("widget").find(".ui-dialog-title").attr("id");
|
||||||
ok( /ui-id-\d+$/.test( titleId ), 'auto-numbered title id');
|
ok( /ui-id-\d+$/.test( titleId ), "auto-numbered title id");
|
||||||
el.remove();
|
el.remove();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -27,7 +27,7 @@ test( "ARIA", function() {
|
|||||||
equal( wrapper.attr( "aria-describedby" ), el.attr( "id" ), "aria-describedby added" );
|
equal( wrapper.attr( "aria-describedby" ), el.attr( "id" ), "aria-describedby added" );
|
||||||
el.remove();
|
el.remove();
|
||||||
|
|
||||||
el = $( '<div><div aria-describedby="section2"><p id="section2">descriotion</p></div></div>' ).dialog();
|
el = $("<div><div aria-describedby='section2'><p id='section2'>descriotion</p></div></div>").dialog();
|
||||||
strictEqual( el.dialog( "widget" ).attr( "aria-describedby" ), undefined, "no aria-describedby added, as already present in markup" );
|
strictEqual( el.dialog( "widget" ).attr( "aria-describedby" ), undefined, "no aria-describedby added, as already present in markup" );
|
||||||
el.remove();
|
el.remove();
|
||||||
});
|
});
|
||||||
|
@ -34,8 +34,8 @@ test( "position, right bottom on window", function() {
|
|||||||
|
|
||||||
test("position, offset from top left w/array", function() {
|
test("position, offset from top left w/array", function() {
|
||||||
expect( 2 );
|
expect( 2 );
|
||||||
var el = $('<div></div>').dialog({ position: [10, 10] }),
|
var el = $("<div></div>").dialog({ position: [10, 10] }),
|
||||||
dialog = el.dialog('widget'),
|
dialog = el.dialog("widget"),
|
||||||
offset = dialog.offset();
|
offset = dialog.offset();
|
||||||
closeEnough(offset.left, 10 + $(window).scrollLeft(), 1);
|
closeEnough(offset.left, 10 + $(window).scrollLeft(), 1);
|
||||||
closeEnough(offset.top, 10 + $(window).scrollTop(), 1);
|
closeEnough(offset.top, 10 + $(window).scrollTop(), 1);
|
||||||
@ -44,8 +44,8 @@ test("position, offset from top left w/array", function() {
|
|||||||
|
|
||||||
test("position, top on window", function() {
|
test("position, top on window", function() {
|
||||||
expect( 2 );
|
expect( 2 );
|
||||||
var el = $('<div></div>').dialog({ position: "top" }),
|
var el = $("<div></div>").dialog({ position: "top" }),
|
||||||
dialog = el.dialog('widget'),
|
dialog = el.dialog("widget"),
|
||||||
offset = dialog.offset();
|
offset = dialog.offset();
|
||||||
closeEnough(offset.left, Math.round($(window).width() / 2 - dialog.outerWidth() / 2) + $(window).scrollLeft(), 1);
|
closeEnough(offset.left, Math.round($(window).width() / 2 - dialog.outerWidth() / 2) + $(window).scrollLeft(), 1);
|
||||||
closeEnough(offset.top, $(window).scrollTop(), 1);
|
closeEnough(offset.top, $(window).scrollTop(), 1);
|
||||||
@ -54,8 +54,8 @@ test("position, top on window", function() {
|
|||||||
|
|
||||||
test("position, left on window", function() {
|
test("position, left on window", function() {
|
||||||
expect( 2 );
|
expect( 2 );
|
||||||
var el = $('<div></div>').dialog({ position: "left" }),
|
var el = $("<div></div>").dialog({ position: "left" }),
|
||||||
dialog = el.dialog('widget'),
|
dialog = el.dialog("widget"),
|
||||||
offset = dialog.offset();
|
offset = dialog.offset();
|
||||||
closeEnough(offset.left, 0, 1);
|
closeEnough(offset.left, 0, 1);
|
||||||
closeEnough(offset.top, Math.round($(window).height() / 2 - dialog.outerHeight() / 2) + $(window).scrollTop(), 1);
|
closeEnough(offset.top, Math.round($(window).height() / 2 - dialog.outerHeight() / 2) + $(window).scrollTop(), 1);
|
||||||
|
@ -12,10 +12,10 @@ test("open", function() {
|
|||||||
el.dialog({
|
el.dialog({
|
||||||
open: function(ev, ui) {
|
open: function(ev, ui) {
|
||||||
ok(el.data("ui-dialog")._isOpen, "interal _isOpen flag is set");
|
ok(el.data("ui-dialog")._isOpen, "interal _isOpen flag is set");
|
||||||
ok(true, 'autoOpen: true fires open callback');
|
ok(true, "autoOpen: true fires open callback");
|
||||||
equal(this, el[0], "context of callback");
|
equal(this, el[0], "context of callback");
|
||||||
equal(ev.type, 'dialogopen', 'event type in callback');
|
equal(ev.type, "dialogopen", "event type in callback");
|
||||||
deepEqual(ui, {}, 'ui hash in callback');
|
deepEqual(ui, {}, "ui hash in callback");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
el.remove();
|
el.remove();
|
||||||
@ -24,16 +24,16 @@ test("open", function() {
|
|||||||
el.dialog({
|
el.dialog({
|
||||||
autoOpen: false,
|
autoOpen: false,
|
||||||
open: function(ev, ui) {
|
open: function(ev, ui) {
|
||||||
ok(true, '.dialog("open") fires open callback');
|
ok(true, ".dialog('open') fires open callback");
|
||||||
equal(this, el[0], "context of callback");
|
equal(this, el[0], "context of callback");
|
||||||
equal(ev.type, 'dialogopen', 'event type in callback');
|
equal(ev.type, "dialogopen", "event type in callback");
|
||||||
deepEqual(ui, {}, 'ui hash in callback');
|
deepEqual(ui, {}, "ui hash in callback");
|
||||||
}
|
}
|
||||||
}).bind('dialogopen', function(ev, ui) {
|
}).bind("dialogopen", function(ev, ui) {
|
||||||
ok(el.data("ui-dialog")._isOpen, "interal _isOpen flag is set");
|
ok(el.data("ui-dialog")._isOpen, "interal _isOpen flag is set");
|
||||||
ok(true, 'dialog("open") fires open event');
|
ok(true, "dialog('open') fires open event");
|
||||||
equal(this, el[0], 'context of event');
|
equal(this, el[0], "context of event");
|
||||||
deepEqual(ui, {}, 'ui hash in event');
|
deepEqual(ui, {}, "ui hash in event");
|
||||||
});
|
});
|
||||||
el.dialog("open");
|
el.dialog("open");
|
||||||
el.remove();
|
el.remove();
|
||||||
@ -88,22 +88,22 @@ test("dragStart", function() {
|
|||||||
expect(9);
|
expect(9);
|
||||||
|
|
||||||
var handle,
|
var handle,
|
||||||
el = $('<div></div>').dialog({
|
el = $("<div></div>").dialog({
|
||||||
dragStart: function(ev, ui) {
|
dragStart: function(ev, ui) {
|
||||||
ok(true, 'dragging fires dragStart callback');
|
ok(true, "dragging fires dragStart callback");
|
||||||
equal(this, el[0], "context of callback");
|
equal(this, el[0], "context of callback");
|
||||||
equal(ev.type, 'dialogdragstart', 'event type in callback');
|
equal(ev.type, "dialogdragstart", "event type in callback");
|
||||||
ok(ui.position !== undefined, "ui.position in callback");
|
ok(ui.position !== undefined, "ui.position in callback");
|
||||||
ok(ui.offset !== undefined, "ui.offset in callback");
|
ok(ui.offset !== undefined, "ui.offset in callback");
|
||||||
}
|
}
|
||||||
}).bind('dialogdragstart', function(ev, ui) {
|
}).bind("dialogdragstart", function(ev, ui) {
|
||||||
ok(true, 'dragging fires dialogdragstart event');
|
ok(true, "dragging fires dialogdragstart event");
|
||||||
equal(this, el[0], 'context of event');
|
equal(this, el[0], "context of event");
|
||||||
ok(ui.position !== undefined, "ui.position in callback");
|
ok(ui.position !== undefined, "ui.position in callback");
|
||||||
ok(ui.offset !== undefined, "ui.offset in callback");
|
ok(ui.offset !== undefined, "ui.offset in callback");
|
||||||
});
|
});
|
||||||
|
|
||||||
handle = $(".ui-dialog-titlebar", el.dialog('widget'));
|
handle = $(".ui-dialog-titlebar", el.dialog("widget"));
|
||||||
TestHelpers.dialog.drag(el, handle, 50, 50);
|
TestHelpers.dialog.drag(el, handle, 50, 50);
|
||||||
el.remove();
|
el.remove();
|
||||||
});
|
});
|
||||||
@ -112,26 +112,26 @@ test("drag", function() {
|
|||||||
expect(9);
|
expect(9);
|
||||||
var handle,
|
var handle,
|
||||||
hasDragged = false,
|
hasDragged = false,
|
||||||
el = $('<div></div>').dialog({
|
el = $("<div></div>").dialog({
|
||||||
drag: function(ev, ui) {
|
drag: function(ev, ui) {
|
||||||
if (!hasDragged) {
|
if (!hasDragged) {
|
||||||
ok(true, 'dragging fires drag callback');
|
ok(true, "dragging fires drag callback");
|
||||||
equal(this, el[0], "context of callback");
|
equal(this, el[0], "context of callback");
|
||||||
equal(ev.type, 'dialogdrag', 'event type in callback');
|
equal(ev.type, "dialogdrag", "event type in callback");
|
||||||
ok(ui.position !== undefined, "ui.position in callback");
|
ok(ui.position !== undefined, "ui.position in callback");
|
||||||
ok(ui.offset !== undefined, "ui.offset in callback");
|
ok(ui.offset !== undefined, "ui.offset in callback");
|
||||||
|
|
||||||
hasDragged = true;
|
hasDragged = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).one('dialogdrag', function(ev, ui) {
|
}).one("dialogdrag", function(ev, ui) {
|
||||||
ok(true, 'dragging fires dialogdrag event');
|
ok(true, "dragging fires dialogdrag event");
|
||||||
equal(this, el[0], 'context of event');
|
equal(this, el[0], "context of event");
|
||||||
ok(ui.position !== undefined, "ui.position in callback");
|
ok(ui.position !== undefined, "ui.position in callback");
|
||||||
ok(ui.offset !== undefined, "ui.offset in callback");
|
ok(ui.offset !== undefined, "ui.offset in callback");
|
||||||
});
|
});
|
||||||
|
|
||||||
handle = $(".ui-dialog-titlebar", el.dialog('widget'));
|
handle = $(".ui-dialog-titlebar", el.dialog("widget"));
|
||||||
TestHelpers.dialog.drag(el, handle, 50, 50);
|
TestHelpers.dialog.drag(el, handle, 50, 50);
|
||||||
el.remove();
|
el.remove();
|
||||||
});
|
});
|
||||||
@ -140,22 +140,22 @@ test("dragStop", function() {
|
|||||||
expect(9);
|
expect(9);
|
||||||
|
|
||||||
var handle,
|
var handle,
|
||||||
el = $('<div></div>').dialog({
|
el = $("<div></div>").dialog({
|
||||||
dragStop: function(ev, ui) {
|
dragStop: function(ev, ui) {
|
||||||
ok(true, 'dragging fires dragStop callback');
|
ok(true, "dragging fires dragStop callback");
|
||||||
equal(this, el[0], "context of callback");
|
equal(this, el[0], "context of callback");
|
||||||
equal(ev.type, 'dialogdragstop', 'event type in callback');
|
equal(ev.type, "dialogdragstop", "event type in callback");
|
||||||
ok(ui.position !== undefined, "ui.position in callback");
|
ok(ui.position !== undefined, "ui.position in callback");
|
||||||
ok(ui.offset !== undefined, "ui.offset in callback");
|
ok(ui.offset !== undefined, "ui.offset in callback");
|
||||||
}
|
}
|
||||||
}).bind('dialogdragstop', function(ev, ui) {
|
}).bind("dialogdragstop", function(ev, ui) {
|
||||||
ok(true, 'dragging fires dialogdragstop event');
|
ok(true, "dragging fires dialogdragstop event");
|
||||||
equal(this, el[0], 'context of event');
|
equal(this, el[0], "context of event");
|
||||||
ok(ui.position !== undefined, "ui.position in callback");
|
ok(ui.position !== undefined, "ui.position in callback");
|
||||||
ok(ui.offset !== undefined, "ui.offset in callback");
|
ok(ui.offset !== undefined, "ui.offset in callback");
|
||||||
});
|
});
|
||||||
|
|
||||||
handle = $(".ui-dialog-titlebar", el.dialog('widget'));
|
handle = $(".ui-dialog-titlebar", el.dialog("widget"));
|
||||||
TestHelpers.dialog.drag(el, handle, 50, 50);
|
TestHelpers.dialog.drag(el, handle, 50, 50);
|
||||||
el.remove();
|
el.remove();
|
||||||
});
|
});
|
||||||
@ -164,26 +164,26 @@ test("resizeStart", function() {
|
|||||||
expect(13);
|
expect(13);
|
||||||
|
|
||||||
var handle,
|
var handle,
|
||||||
el = $('<div></div>').dialog({
|
el = $("<div></div>").dialog({
|
||||||
resizeStart: function(ev, ui) {
|
resizeStart: function(ev, ui) {
|
||||||
ok(true, 'resizing fires resizeStart callback');
|
ok(true, "resizing fires resizeStart callback");
|
||||||
equal(this, el[0], "context of callback");
|
equal(this, el[0], "context of callback");
|
||||||
equal(ev.type, 'dialogresizestart', 'event type in callback');
|
equal(ev.type, "dialogresizestart", "event type in callback");
|
||||||
ok(ui.originalPosition !== undefined, "ui.originalPosition in callback");
|
ok(ui.originalPosition !== undefined, "ui.originalPosition in callback");
|
||||||
ok(ui.originalSize !== undefined, "ui.originalSize in callback");
|
ok(ui.originalSize !== undefined, "ui.originalSize in callback");
|
||||||
ok(ui.position !== undefined, "ui.position in callback");
|
ok(ui.position !== undefined, "ui.position in callback");
|
||||||
ok(ui.size !== undefined, "ui.size in callback");
|
ok(ui.size !== undefined, "ui.size in callback");
|
||||||
}
|
}
|
||||||
}).bind('dialogresizestart', function(ev, ui) {
|
}).bind("dialogresizestart", function(ev, ui) {
|
||||||
ok(true, 'resizing fires dialogresizestart event');
|
ok(true, "resizing fires dialogresizestart event");
|
||||||
equal(this, el[0], 'context of event');
|
equal(this, el[0], "context of event");
|
||||||
ok(ui.originalPosition !== undefined, "ui.originalPosition in callback");
|
ok(ui.originalPosition !== undefined, "ui.originalPosition in callback");
|
||||||
ok(ui.originalSize !== undefined, "ui.originalSize in callback");
|
ok(ui.originalSize !== undefined, "ui.originalSize in callback");
|
||||||
ok(ui.position !== undefined, "ui.position in callback");
|
ok(ui.position !== undefined, "ui.position in callback");
|
||||||
ok(ui.size !== undefined, "ui.size in callback");
|
ok(ui.size !== undefined, "ui.size in callback");
|
||||||
});
|
});
|
||||||
|
|
||||||
handle = $(".ui-resizable-se", el.dialog('widget'));
|
handle = $(".ui-resizable-se", el.dialog("widget"));
|
||||||
TestHelpers.dialog.drag(el, handle, 50, 50);
|
TestHelpers.dialog.drag(el, handle, 50, 50);
|
||||||
el.remove();
|
el.remove();
|
||||||
});
|
});
|
||||||
@ -192,12 +192,12 @@ test("resize", function() {
|
|||||||
expect(13);
|
expect(13);
|
||||||
var handle,
|
var handle,
|
||||||
hasResized = false,
|
hasResized = false,
|
||||||
el = $('<div></div>').dialog({
|
el = $("<div></div>").dialog({
|
||||||
resize: function(ev, ui) {
|
resize: function(ev, ui) {
|
||||||
if (!hasResized) {
|
if (!hasResized) {
|
||||||
ok(true, 'resizing fires resize callback');
|
ok(true, "resizing fires resize callback");
|
||||||
equal(this, el[0], "context of callback");
|
equal(this, el[0], "context of callback");
|
||||||
equal(ev.type, 'dialogresize', 'event type in callback');
|
equal(ev.type, "dialogresize", "event type in callback");
|
||||||
ok(ui.originalPosition !== undefined, "ui.originalPosition in callback");
|
ok(ui.originalPosition !== undefined, "ui.originalPosition in callback");
|
||||||
ok(ui.originalSize !== undefined, "ui.originalSize in callback");
|
ok(ui.originalSize !== undefined, "ui.originalSize in callback");
|
||||||
ok(ui.position !== undefined, "ui.position in callback");
|
ok(ui.position !== undefined, "ui.position in callback");
|
||||||
@ -206,16 +206,16 @@ test("resize", function() {
|
|||||||
hasResized = true;
|
hasResized = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).one('dialogresize', function(ev, ui) {
|
}).one("dialogresize", function(ev, ui) {
|
||||||
ok(true, 'resizing fires dialogresize event');
|
ok(true, "resizing fires dialogresize event");
|
||||||
equal(this, el[0], 'context of event');
|
equal(this, el[0], "context of event");
|
||||||
ok(ui.originalPosition !== undefined, "ui.originalPosition in callback");
|
ok(ui.originalPosition !== undefined, "ui.originalPosition in callback");
|
||||||
ok(ui.originalSize !== undefined, "ui.originalSize in callback");
|
ok(ui.originalSize !== undefined, "ui.originalSize in callback");
|
||||||
ok(ui.position !== undefined, "ui.position in callback");
|
ok(ui.position !== undefined, "ui.position in callback");
|
||||||
ok(ui.size !== undefined, "ui.size in callback");
|
ok(ui.size !== undefined, "ui.size in callback");
|
||||||
});
|
});
|
||||||
|
|
||||||
handle = $(".ui-resizable-se", el.dialog('widget'));
|
handle = $(".ui-resizable-se", el.dialog("widget"));
|
||||||
TestHelpers.dialog.drag(el, handle, 50, 50);
|
TestHelpers.dialog.drag(el, handle, 50, 50);
|
||||||
el.remove();
|
el.remove();
|
||||||
});
|
});
|
||||||
@ -224,26 +224,26 @@ test("resizeStop", function() {
|
|||||||
expect(13);
|
expect(13);
|
||||||
|
|
||||||
var handle,
|
var handle,
|
||||||
el = $('<div></div>').dialog({
|
el = $("<div></div>").dialog({
|
||||||
resizeStop: function(ev, ui) {
|
resizeStop: function(ev, ui) {
|
||||||
ok(true, 'resizing fires resizeStop callback');
|
ok(true, "resizing fires resizeStop callback");
|
||||||
equal(this, el[0], "context of callback");
|
equal(this, el[0], "context of callback");
|
||||||
equal(ev.type, 'dialogresizestop', 'event type in callback');
|
equal(ev.type, "dialogresizestop", "event type in callback");
|
||||||
ok(ui.originalPosition !== undefined, "ui.originalPosition in callback");
|
ok(ui.originalPosition !== undefined, "ui.originalPosition in callback");
|
||||||
ok(ui.originalSize !== undefined, "ui.originalSize in callback");
|
ok(ui.originalSize !== undefined, "ui.originalSize in callback");
|
||||||
ok(ui.position !== undefined, "ui.position in callback");
|
ok(ui.position !== undefined, "ui.position in callback");
|
||||||
ok(ui.size !== undefined, "ui.size in callback");
|
ok(ui.size !== undefined, "ui.size in callback");
|
||||||
}
|
}
|
||||||
}).bind('dialogresizestop', function(ev, ui) {
|
}).bind("dialogresizestop", function(ev, ui) {
|
||||||
ok(true, 'resizing fires dialogresizestop event');
|
ok(true, "resizing fires dialogresizestop event");
|
||||||
equal(this, el[0], 'context of event');
|
equal(this, el[0], "context of event");
|
||||||
ok(ui.originalPosition !== undefined, "ui.originalPosition in callback");
|
ok(ui.originalPosition !== undefined, "ui.originalPosition in callback");
|
||||||
ok(ui.originalSize !== undefined, "ui.originalSize in callback");
|
ok(ui.originalSize !== undefined, "ui.originalSize in callback");
|
||||||
ok(ui.position !== undefined, "ui.position in callback");
|
ok(ui.position !== undefined, "ui.position in callback");
|
||||||
ok(ui.size !== undefined, "ui.size in callback");
|
ok(ui.size !== undefined, "ui.size in callback");
|
||||||
});
|
});
|
||||||
|
|
||||||
handle = $(".ui-resizable-se", el.dialog('widget'));
|
handle = $(".ui-resizable-se", el.dialog("widget"));
|
||||||
TestHelpers.dialog.drag(el, handle, 50, 50);
|
TestHelpers.dialog.drag(el, handle, 50, 50);
|
||||||
el.remove();
|
el.remove();
|
||||||
});
|
});
|
||||||
@ -251,77 +251,77 @@ test("resizeStop", function() {
|
|||||||
asyncTest("close", function() {
|
asyncTest("close", function() {
|
||||||
expect(14);
|
expect(14);
|
||||||
|
|
||||||
var el = $('<div></div>').dialog({
|
var el = $("<div></div>").dialog({
|
||||||
close: function(ev, ui) {
|
close: function(ev, ui) {
|
||||||
ok(true, '.dialog("close") fires close callback');
|
ok(true, ".dialog('close') fires close callback");
|
||||||
equal(this, el[0], "context of callback");
|
equal(this, el[0], "context of callback");
|
||||||
equal(ev.type, 'dialogclose', 'event type in callback');
|
equal(ev.type, "dialogclose", "event type in callback");
|
||||||
deepEqual(ui, {}, 'ui hash in callback');
|
deepEqual(ui, {}, "ui hash in callback");
|
||||||
}
|
}
|
||||||
}).bind('dialogclose', function(ev, ui) {
|
}).bind("dialogclose", function(ev, ui) {
|
||||||
ok(true, '.dialog("close") fires dialogclose event');
|
ok(true, ".dialog('close') fires dialogclose event");
|
||||||
equal(this, el[0], 'context of event');
|
equal(this, el[0], "context of event");
|
||||||
deepEqual(ui, {}, 'ui hash in event');
|
deepEqual(ui, {}, "ui hash in event");
|
||||||
});
|
});
|
||||||
el.dialog('close');
|
el.dialog("close");
|
||||||
el.remove();
|
el.remove();
|
||||||
|
|
||||||
// Close event with an effect
|
// Close event with an effect
|
||||||
el = $('<div></div>').dialog({
|
el = $("<div></div>").dialog({
|
||||||
hide: 10,
|
hide: 10,
|
||||||
close: function(ev, ui) {
|
close: function(ev, ui) {
|
||||||
ok(true, '.dialog("close") fires close callback');
|
ok(true, ".dialog('close') fires close callback");
|
||||||
equal(this, el[0], "context of callback");
|
equal(this, el[0], "context of callback");
|
||||||
equal(ev.type, 'dialogclose', 'event type in callback');
|
equal(ev.type, "dialogclose", "event type in callback");
|
||||||
deepEqual(ui, {}, 'ui hash in callback');
|
deepEqual(ui, {}, "ui hash in callback");
|
||||||
start();
|
start();
|
||||||
}
|
}
|
||||||
}).bind('dialogclose', function(ev, ui) {
|
}).bind("dialogclose", function(ev, ui) {
|
||||||
ok(true, '.dialog("close") fires dialogclose event');
|
ok(true, ".dialog('close') fires dialogclose event");
|
||||||
equal(this, el[0], 'context of event');
|
equal(this, el[0], "context of event");
|
||||||
deepEqual(ui, {}, 'ui hash in event');
|
deepEqual(ui, {}, "ui hash in event");
|
||||||
});
|
});
|
||||||
el.dialog('close');
|
el.dialog("close");
|
||||||
});
|
});
|
||||||
|
|
||||||
test("beforeClose", function() {
|
test("beforeClose", function() {
|
||||||
expect(14);
|
expect(14);
|
||||||
|
|
||||||
var el = $('<div></div>').dialog({
|
var el = $("<div></div>").dialog({
|
||||||
beforeClose: function(ev, ui) {
|
beforeClose: function(ev, ui) {
|
||||||
ok(true, '.dialog("close") fires beforeClose callback');
|
ok(true, ".dialog('close') fires beforeClose callback");
|
||||||
equal(this, el[0], "context of callback");
|
equal(this, el[0], "context of callback");
|
||||||
equal(ev.type, 'dialogbeforeclose', 'event type in callback');
|
equal(ev.type, "dialogbeforeclose", "event type in callback");
|
||||||
deepEqual(ui, {}, 'ui hash in callback');
|
deepEqual(ui, {}, "ui hash in callback");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
el.dialog('close');
|
el.dialog("close");
|
||||||
ok( el.dialog("widget").is(":visible"), 'beforeClose callback should prevent dialog from closing');
|
ok( el.dialog("widget").is(":visible"), "beforeClose callback should prevent dialog from closing");
|
||||||
el.remove();
|
el.remove();
|
||||||
|
|
||||||
el = $('<div></div>').dialog();
|
el = $("<div></div>").dialog();
|
||||||
el.dialog('option', 'beforeClose', function(ev, ui) {
|
el.dialog("option", "beforeClose", function(ev, ui) {
|
||||||
ok(true, '.dialog("close") fires beforeClose callback');
|
ok(true, ".dialog('close') fires beforeClose callback");
|
||||||
equal(this, el[0], "context of callback");
|
equal(this, el[0], "context of callback");
|
||||||
equal(ev.type, 'dialogbeforeclose', 'event type in callback');
|
equal(ev.type, "dialogbeforeclose", "event type in callback");
|
||||||
deepEqual(ui, {}, 'ui hash in callback');
|
deepEqual(ui, {}, "ui hash in callback");
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
el.dialog('close');
|
el.dialog("close");
|
||||||
|
|
||||||
ok( el.dialog("widget").is(":visible"), 'beforeClose callback should prevent dialog from closing');
|
ok( el.dialog("widget").is(":visible"), "beforeClose callback should prevent dialog from closing");
|
||||||
el.remove();
|
el.remove();
|
||||||
|
|
||||||
el = $('<div></div>').dialog().bind('dialogbeforeclose', function(ev, ui) {
|
el = $("<div></div>").dialog().bind("dialogbeforeclose", function(ev, ui) {
|
||||||
ok(true, '.dialog("close") triggers dialogbeforeclose event');
|
ok(true, ".dialog('close') triggers dialogbeforeclose event");
|
||||||
equal(this, el[0], "context of event");
|
equal(this, el[0], "context of event");
|
||||||
deepEqual(ui, {}, 'ui hash in event');
|
deepEqual(ui, {}, "ui hash in event");
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
el.dialog('close');
|
el.dialog("close");
|
||||||
ok( el.dialog("widget").is(":visible"), 'dialogbeforeclose event should prevent dialog from closing');
|
ok( el.dialog("widget").is(":visible"), "dialogbeforeclose event should prevent dialog from closing");
|
||||||
el.remove();
|
el.remove();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -329,14 +329,14 @@ test("beforeClose", function() {
|
|||||||
asyncTest("ensure dialog's container doesn't scroll on resize and focus", function() {
|
asyncTest("ensure dialog's container doesn't scroll on resize and focus", function() {
|
||||||
expect(2);
|
expect(2);
|
||||||
|
|
||||||
var el = $('#dialog1').dialog(),
|
var el = $("#dialog1").dialog(),
|
||||||
initialScroll = $(window).scrollTop();
|
initialScroll = $(window).scrollTop();
|
||||||
el.dialog('option', 'height', 600);
|
el.dialog("option", "height", 600);
|
||||||
equal($(window).scrollTop(), initialScroll, "scroll hasn't moved after height change");
|
equal($(window).scrollTop(), initialScroll, "scroll hasn't moved after height change");
|
||||||
setTimeout( function(){
|
setTimeout( function(){
|
||||||
$(".ui-dialog-titlebar-close").simulate('mousedown');
|
$(".ui-dialog-titlebar-close").simulate("mousedown");
|
||||||
equal($(window).scrollTop(), initialScroll, "scroll hasn't moved after focus moved to dialog");
|
equal($(window).scrollTop(), initialScroll, "scroll hasn't moved after focus moved to dialog");
|
||||||
el.dialog('destroy');
|
el.dialog("destroy");
|
||||||
start();
|
start();
|
||||||
}, 500);
|
}, 500);
|
||||||
});
|
});
|
||||||
|
@ -12,25 +12,25 @@ module("dialog: methods", {
|
|||||||
test("init", function() {
|
test("init", function() {
|
||||||
expect(6);
|
expect(6);
|
||||||
|
|
||||||
$("<div></div>").appendTo('body').dialog().remove();
|
$("<div></div>").appendTo("body").dialog().remove();
|
||||||
ok(true, '.dialog() called on element');
|
ok(true, ".dialog() called on element");
|
||||||
|
|
||||||
$([]).dialog().remove();
|
$([]).dialog().remove();
|
||||||
ok(true, '.dialog() called on empty collection');
|
ok(true, ".dialog() called on empty collection");
|
||||||
|
|
||||||
$('<div></div>').dialog().remove();
|
$("<div></div>").dialog().remove();
|
||||||
ok(true, '.dialog() called on disconnected DOMElement - never connected');
|
ok(true, ".dialog() called on disconnected DOMElement - never connected");
|
||||||
|
|
||||||
$('<div></div>').appendTo('body').remove().dialog().remove();
|
$("<div></div>").appendTo("body").remove().dialog().remove();
|
||||||
ok(true, '.dialog() called on disconnected DOMElement - removed');
|
ok(true, ".dialog() called on disconnected DOMElement - removed");
|
||||||
|
|
||||||
var el = $('<div></div>').dialog();
|
var el = $("<div></div>").dialog();
|
||||||
el.dialog("option", "foo");
|
el.dialog("option", "foo");
|
||||||
el.remove();
|
el.remove();
|
||||||
ok(true, 'arbitrary option getter after init');
|
ok(true, "arbitrary option getter after init");
|
||||||
|
|
||||||
$('<div></div>').dialog().dialog("option", "foo", "bar").remove();
|
$("<div></div>").dialog().dialog("option", "foo", "bar").remove();
|
||||||
ok(true, 'arbitrary option setter after init');
|
ok(true, "arbitrary option setter after init");
|
||||||
});
|
});
|
||||||
|
|
||||||
test("destroy", function() {
|
test("destroy", function() {
|
||||||
@ -61,12 +61,12 @@ test("destroy", function() {
|
|||||||
|
|
||||||
test("#4980: Destroy should place element back in original DOM position", function(){
|
test("#4980: Destroy should place element back in original DOM position", function(){
|
||||||
expect( 2 );
|
expect( 2 );
|
||||||
var container = $('<div id="container"><div id="modal">Content</div></div>'),
|
var container = $("<div id='container'><div id='modal'>Content</div></div>"),
|
||||||
modal = container.find('#modal');
|
modal = container.find("#modal");
|
||||||
modal.dialog();
|
modal.dialog();
|
||||||
ok(!$.contains(container[0], modal[0]), 'dialog should move modal element to outside container element');
|
ok(!$.contains(container[0], modal[0]), "dialog should move modal element to outside container element");
|
||||||
modal.dialog('destroy');
|
modal.dialog("destroy");
|
||||||
ok($.contains(container[0], modal[0]), 'dialog(destroy) should place element back in original DOM position');
|
ok($.contains(container[0], modal[0]), "dialog(destroy) should place element back in original DOM position");
|
||||||
});
|
});
|
||||||
|
|
||||||
test( "enable/disable disabled", function() {
|
test( "enable/disable disabled", function() {
|
||||||
@ -81,29 +81,29 @@ test("close", function() {
|
|||||||
expect( 3 );
|
expect( 3 );
|
||||||
|
|
||||||
var el,
|
var el,
|
||||||
expected = $('<div></div>').dialog(),
|
expected = $("<div></div>").dialog(),
|
||||||
actual = expected.dialog('close');
|
actual = expected.dialog("close");
|
||||||
equal(actual, expected, 'close is chainable');
|
equal(actual, expected, "close is chainable");
|
||||||
|
|
||||||
el = $('<div></div>').dialog();
|
el = $("<div></div>").dialog();
|
||||||
ok(el.dialog('widget').is(':visible') && !el.dialog('widget').is(':hidden'), 'dialog visible before close method called');
|
ok(el.dialog("widget").is(":visible") && !el.dialog("widget").is(":hidden"), "dialog visible before close method called");
|
||||||
el.dialog('close');
|
el.dialog("close");
|
||||||
ok(el.dialog('widget').is(':hidden') && !el.dialog('widget').is(':visible'), 'dialog hidden after close method called');
|
ok(el.dialog("widget").is(":hidden") && !el.dialog("widget").is(":visible"), "dialog hidden after close method called");
|
||||||
});
|
});
|
||||||
|
|
||||||
test("isOpen", function() {
|
test("isOpen", function() {
|
||||||
expect(4);
|
expect(4);
|
||||||
|
|
||||||
var el = $('<div></div>').dialog();
|
var el = $("<div></div>").dialog();
|
||||||
equal(el.dialog('isOpen'), true, "dialog is open after init");
|
equal(el.dialog("isOpen"), true, "dialog is open after init");
|
||||||
el.dialog('close');
|
el.dialog("close");
|
||||||
equal(el.dialog('isOpen'), false, "dialog is closed");
|
equal(el.dialog("isOpen"), false, "dialog is closed");
|
||||||
el.remove();
|
el.remove();
|
||||||
|
|
||||||
el = $('<div></div>').dialog({autoOpen: false});
|
el = $("<div></div>").dialog({autoOpen: false});
|
||||||
equal(el.dialog('isOpen'), false, "dialog is closed after init");
|
equal(el.dialog("isOpen"), false, "dialog is closed after init");
|
||||||
el.dialog('open');
|
el.dialog("open");
|
||||||
equal(el.dialog('isOpen'), true, "dialog is open");
|
equal(el.dialog("isOpen"), true, "dialog is open");
|
||||||
el.remove();
|
el.remove();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -137,49 +137,49 @@ test("moveToTop", function() {
|
|||||||
test("open", function() {
|
test("open", function() {
|
||||||
expect( 3 );
|
expect( 3 );
|
||||||
var el,
|
var el,
|
||||||
expected = $('<div></div>').dialog(),
|
expected = $("<div></div>").dialog(),
|
||||||
actual = expected.dialog('open');
|
actual = expected.dialog("open");
|
||||||
equal(actual, expected, 'open is chainable');
|
equal(actual, expected, "open is chainable");
|
||||||
|
|
||||||
el = $('<div></div>').dialog({ autoOpen: false });
|
el = $("<div></div>").dialog({ autoOpen: false });
|
||||||
ok(el.dialog('widget').is(':hidden') && !el.dialog('widget').is(':visible'), 'dialog hidden before open method called');
|
ok(el.dialog("widget").is(":hidden") && !el.dialog("widget").is(":visible"), "dialog hidden before open method called");
|
||||||
el.dialog('open');
|
el.dialog("open");
|
||||||
ok(el.dialog('widget').is(':visible') && !el.dialog('widget').is(':hidden'), 'dialog visible after open method called');
|
ok(el.dialog("widget").is(":visible") && !el.dialog("widget").is(":hidden"), "dialog visible after open method called");
|
||||||
});
|
});
|
||||||
|
|
||||||
test("#6137: dialog('open') causes form elements to reset on IE7", function() {
|
test("#6137: dialog('open') causes form elements to reset on IE7", function() {
|
||||||
expect(2);
|
expect(2);
|
||||||
|
|
||||||
var d1 = $('<form><input type="radio" name="radio" id="a" value="a" checked="checked"></input>' +
|
var d1 = $("<form><input type='radio' name='radio' id='a' value='a' checked='checked'></input>" +
|
||||||
'<input type="radio" name="radio" id="b" value="b">b</input></form>').appendTo( "body" ).dialog({autoOpen: false});
|
"<input type='radio' name='radio' id='b' value='b'>b</input></form>").appendTo( "body" ).dialog({autoOpen: false});
|
||||||
|
|
||||||
d1.find('#b').prop( "checked", true );
|
d1.find("#b").prop( "checked", true );
|
||||||
equal(d1.find('input:checked').val(), 'b', "checkbox b is checked");
|
equal(d1.find("input:checked").val(), "b", "checkbox b is checked");
|
||||||
|
|
||||||
d1.dialog('open');
|
d1.dialog("open");
|
||||||
equal(d1.find('input:checked').val(), 'b', "checkbox b is checked");
|
equal(d1.find("input:checked").val(), "b", "checkbox b is checked");
|
||||||
|
|
||||||
d1.remove();
|
d1.remove();
|
||||||
});
|
});
|
||||||
|
|
||||||
test("#5531: dialog width should be at least minWidth on creation", function () {
|
test("#5531: dialog width should be at least minWidth on creation", function () {
|
||||||
expect( 4 );
|
expect( 4 );
|
||||||
var el = $('<div></div>').dialog({
|
var el = $("<div></div>").dialog({
|
||||||
width: 200,
|
width: 200,
|
||||||
minWidth: 300
|
minWidth: 300
|
||||||
});
|
});
|
||||||
|
|
||||||
equal(el.dialog('option', 'width'), 300, "width is minWidth");
|
equal(el.dialog("option", "width"), 300, "width is minWidth");
|
||||||
el.dialog('option', 'width', 200);
|
el.dialog("option", "width", 200);
|
||||||
equal(el.dialog('option', 'width'), 300, "width unchanged when set to < minWidth");
|
equal(el.dialog("option", "width"), 300, "width unchanged when set to < minWidth");
|
||||||
el.dialog('option', 'width', 320);
|
el.dialog("option", "width", 320);
|
||||||
equal(el.dialog('option', 'width'), 320, "width changed if set to > minWidth");
|
equal(el.dialog("option", "width"), 320, "width changed if set to > minWidth");
|
||||||
el.remove();
|
el.remove();
|
||||||
|
|
||||||
el = $('<div></div>').dialog({
|
el = $("<div></div>").dialog({
|
||||||
minWidth: 300
|
minWidth: 300
|
||||||
});
|
});
|
||||||
ok(el.dialog('option', 'width') >= 300, "width is at least 300");
|
ok(el.dialog("option", "width") >= 300, "width is at least 300");
|
||||||
el.remove();
|
el.remove();
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@ -49,12 +49,12 @@ test( "appendTo", function() {
|
|||||||
test("autoOpen", function() {
|
test("autoOpen", function() {
|
||||||
expect(2);
|
expect(2);
|
||||||
|
|
||||||
var el = $('<div></div>').dialog({ autoOpen: false });
|
var el = $("<div></div>").dialog({ autoOpen: false });
|
||||||
ok( !el.dialog("widget").is(":visible"), '.dialog({ autoOpen: false })');
|
ok( !el.dialog("widget").is(":visible"), ".dialog({ autoOpen: false })");
|
||||||
el.remove();
|
el.remove();
|
||||||
|
|
||||||
el = $('<div></div>').dialog({ autoOpen: true });
|
el = $("<div></div>").dialog({ autoOpen: true });
|
||||||
ok( el.dialog("widget").is(":visible"), '.dialog({ autoOpen: true })');
|
ok( el.dialog("widget").is(":visible"), ".dialog({ autoOpen: true })");
|
||||||
el.remove();
|
el.remove();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -74,7 +74,7 @@ test("buttons", function() {
|
|||||||
equal(ev.target, btn[1], "event target");
|
equal(ev.target, btn[1], "event target");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
el = $('<div></div>').dialog({ buttons: buttons });
|
el = $("<div></div>").dialog({ buttons: buttons });
|
||||||
|
|
||||||
btn = el.dialog( "widget" ).find( ".ui-dialog-buttonpane button" );
|
btn = el.dialog( "widget" ).find( ".ui-dialog-buttonpane button" );
|
||||||
equal(btn.length, 2, "number of buttons");
|
equal(btn.length, 2, "number of buttons");
|
||||||
@ -85,8 +85,8 @@ test("buttons", function() {
|
|||||||
i++;
|
i++;
|
||||||
});
|
});
|
||||||
|
|
||||||
ok(btn.parent().hasClass('ui-dialog-buttonset'), "buttons in container");
|
ok(btn.parent().hasClass("ui-dialog-buttonset"), "buttons in container");
|
||||||
ok(el.parent().hasClass('ui-dialog-buttons'), "dialog wrapper adds class about having buttons");
|
ok(el.parent().hasClass("ui-dialog-buttons"), "dialog wrapper adds class about having buttons");
|
||||||
|
|
||||||
btn.trigger("click");
|
btn.trigger("click");
|
||||||
|
|
||||||
@ -98,13 +98,13 @@ test("buttons", function() {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
deepEqual(el.dialog("option", "buttons"), buttons, '.dialog("option", "buttons") getter');
|
deepEqual(el.dialog("option", "buttons"), buttons, ".dialog('option', 'buttons') getter");
|
||||||
el.dialog("option", "buttons", newButtons);
|
el.dialog("option", "buttons", newButtons);
|
||||||
deepEqual(el.dialog("option", "buttons"), newButtons, '.dialog("option", "buttons", ...) setter');
|
deepEqual(el.dialog("option", "buttons"), newButtons, ".dialog('option', 'buttons', ...) setter");
|
||||||
|
|
||||||
btn = el.dialog( "widget" ).find( ".ui-dialog-buttonpane button" );
|
btn = el.dialog( "widget" ).find( ".ui-dialog-buttonpane button" );
|
||||||
equal(btn.length, 1, "number of buttons after setter");
|
equal(btn.length, 1, "number of buttons after setter");
|
||||||
btn.trigger('click');
|
btn.trigger("click");
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
$.each(newButtons, function( key ) {
|
$.each(newButtons, function( key ) {
|
||||||
@ -116,7 +116,7 @@ test("buttons", function() {
|
|||||||
btn = el.dialog( "widget" ).find( ".ui-dialog-buttonpane button" );
|
btn = el.dialog( "widget" ).find( ".ui-dialog-buttonpane button" );
|
||||||
equal(btn.length, 0, "all buttons have been removed");
|
equal(btn.length, 0, "all buttons have been removed");
|
||||||
equal(el.find(".ui-dialog-buttonset").length, 0, "buttonset has been removed");
|
equal(el.find(".ui-dialog-buttonset").length, 0, "buttonset has been removed");
|
||||||
equal(el.parent().hasClass('ui-dialog-buttons'), false, "dialog wrapper removes class about having buttons");
|
equal(el.parent().hasClass("ui-dialog-buttons"), false, "dialog wrapper removes class about having buttons");
|
||||||
|
|
||||||
el.remove();
|
el.remove();
|
||||||
});
|
});
|
||||||
@ -156,77 +156,77 @@ test("buttons - advanced", function() {
|
|||||||
|
|
||||||
test("closeOnEscape", function() {
|
test("closeOnEscape", function() {
|
||||||
expect( 6 );
|
expect( 6 );
|
||||||
var el = $('<div></div>').dialog({ closeOnEscape: false });
|
var el = $("<div></div>").dialog({ closeOnEscape: false });
|
||||||
ok(true, 'closeOnEscape: false');
|
ok(true, "closeOnEscape: false");
|
||||||
ok(el.dialog('widget').is(':visible') && !el.dialog('widget').is(':hidden'), 'dialog is open before ESC');
|
ok(el.dialog("widget").is(":visible") && !el.dialog("widget").is(":hidden"), "dialog is open before ESC");
|
||||||
el.simulate('keydown', { keyCode: $.ui.keyCode.ESCAPE })
|
el.simulate("keydown", { keyCode: $.ui.keyCode.ESCAPE })
|
||||||
.simulate('keypress', { keyCode: $.ui.keyCode.ESCAPE })
|
.simulate("keypress", { keyCode: $.ui.keyCode.ESCAPE })
|
||||||
.simulate('keyup', { keyCode: $.ui.keyCode.ESCAPE });
|
.simulate("keyup", { keyCode: $.ui.keyCode.ESCAPE });
|
||||||
ok(el.dialog('widget').is(':visible') && !el.dialog('widget').is(':hidden'), 'dialog is open after ESC');
|
ok(el.dialog("widget").is(":visible") && !el.dialog("widget").is(":hidden"), "dialog is open after ESC");
|
||||||
|
|
||||||
el.remove();
|
el.remove();
|
||||||
|
|
||||||
el = $('<div></div>').dialog({ closeOnEscape: true });
|
el = $("<div></div>").dialog({ closeOnEscape: true });
|
||||||
ok(true, 'closeOnEscape: true');
|
ok(true, "closeOnEscape: true");
|
||||||
ok(el.dialog('widget').is(':visible') && !el.dialog('widget').is(':hidden'), 'dialog is open before ESC');
|
ok(el.dialog("widget").is(":visible") && !el.dialog("widget").is(":hidden"), "dialog is open before ESC");
|
||||||
el.simulate('keydown', { keyCode: $.ui.keyCode.ESCAPE })
|
el.simulate("keydown", { keyCode: $.ui.keyCode.ESCAPE })
|
||||||
.simulate('keypress', { keyCode: $.ui.keyCode.ESCAPE })
|
.simulate("keypress", { keyCode: $.ui.keyCode.ESCAPE })
|
||||||
.simulate('keyup', { keyCode: $.ui.keyCode.ESCAPE });
|
.simulate("keyup", { keyCode: $.ui.keyCode.ESCAPE });
|
||||||
ok(el.dialog('widget').is(':hidden') && !el.dialog('widget').is(':visible'), 'dialog is closed after ESC');
|
ok(el.dialog("widget").is(":hidden") && !el.dialog("widget").is(":visible"), "dialog is closed after ESC");
|
||||||
});
|
});
|
||||||
|
|
||||||
test("closeText", function() {
|
test("closeText", function() {
|
||||||
expect(3);
|
expect(3);
|
||||||
|
|
||||||
var el = $('<div></div>').dialog();
|
var el = $("<div></div>").dialog();
|
||||||
equal(el.dialog('widget').find('.ui-dialog-titlebar-close span').text(), 'close',
|
equal(el.dialog("widget").find(".ui-dialog-titlebar-close span").text(), "close",
|
||||||
'default close text');
|
"default close text");
|
||||||
el.remove();
|
el.remove();
|
||||||
|
|
||||||
el = $('<div></div>').dialog({ closeText: "foo" });
|
el = $("<div></div>").dialog({ closeText: "foo" });
|
||||||
equal(el.dialog('widget').find('.ui-dialog-titlebar-close span').text(), 'foo',
|
equal(el.dialog("widget").find(".ui-dialog-titlebar-close span").text(), "foo",
|
||||||
'closeText on init');
|
"closeText on init");
|
||||||
el.remove();
|
el.remove();
|
||||||
|
|
||||||
el = $('<div></div>').dialog().dialog('option', 'closeText', 'bar');
|
el = $("<div></div>").dialog().dialog("option", "closeText", "bar");
|
||||||
equal(el.dialog('widget').find('.ui-dialog-titlebar-close span').text(), 'bar',
|
equal(el.dialog("widget").find(".ui-dialog-titlebar-close span").text(), "bar",
|
||||||
'closeText via option method');
|
"closeText via option method");
|
||||||
el.remove();
|
el.remove();
|
||||||
});
|
});
|
||||||
|
|
||||||
test("dialogClass", function() {
|
test("dialogClass", function() {
|
||||||
expect( 6 );
|
expect( 6 );
|
||||||
|
|
||||||
var el = $('<div></div>').dialog();
|
var el = $("<div></div>").dialog();
|
||||||
equal(el.dialog('widget').is(".foo"), false, 'dialogClass not specified. foo class added');
|
equal(el.dialog("widget").is(".foo"), false, "dialogClass not specified. foo class added");
|
||||||
el.remove();
|
el.remove();
|
||||||
|
|
||||||
el = $('<div></div>').dialog({ dialogClass: "foo" });
|
el = $("<div></div>").dialog({ dialogClass: "foo" });
|
||||||
equal(el.dialog('widget').is(".foo"), true, 'dialogClass in init. foo class added');
|
equal(el.dialog("widget").is(".foo"), true, "dialogClass in init. foo class added");
|
||||||
el.dialog( "option", "dialogClass", "foobar" );
|
el.dialog( "option", "dialogClass", "foobar" );
|
||||||
equal( el.dialog('widget').is(".foo"), false, "dialogClass changed, previous one was removed" );
|
equal( el.dialog("widget").is(".foo"), false, "dialogClass changed, previous one was removed" );
|
||||||
equal( el.dialog('widget').is(".foobar"), true, "dialogClass changed, new one was added" );
|
equal( el.dialog("widget").is(".foobar"), true, "dialogClass changed, new one was added" );
|
||||||
el.remove();
|
el.remove();
|
||||||
|
|
||||||
el = $('<div></div>').dialog({ dialogClass: "foo bar" });
|
el = $("<div></div>").dialog({ dialogClass: "foo bar" });
|
||||||
equal(el.dialog('widget').is(".foo"), true, 'dialogClass in init, two classes. foo class added');
|
equal(el.dialog("widget").is(".foo"), true, "dialogClass in init, two classes. foo class added");
|
||||||
equal(el.dialog('widget').is(".bar"), true, 'dialogClass in init, two classes. bar class added');
|
equal(el.dialog("widget").is(".bar"), true, "dialogClass in init, two classes. bar class added");
|
||||||
el.remove();
|
el.remove();
|
||||||
});
|
});
|
||||||
|
|
||||||
test("draggable", function() {
|
test("draggable", function() {
|
||||||
expect(4);
|
expect(4);
|
||||||
|
|
||||||
var el = $('<div></div>').dialog({ draggable: false });
|
var el = $("<div></div>").dialog({ draggable: false });
|
||||||
|
|
||||||
TestHelpers.dialog.testDrag(el, 50, -50, 0, 0);
|
TestHelpers.dialog.testDrag(el, 50, -50, 0, 0);
|
||||||
el.dialog('option', 'draggable', true);
|
el.dialog("option", "draggable", true);
|
||||||
TestHelpers.dialog.testDrag(el, 50, -50, 50, -50);
|
TestHelpers.dialog.testDrag(el, 50, -50, 50, -50);
|
||||||
el.remove();
|
el.remove();
|
||||||
|
|
||||||
el = $('<div></div>').dialog({ draggable: true });
|
el = $("<div></div>").dialog({ draggable: true });
|
||||||
TestHelpers.dialog.testDrag(el, 50, -50, 50, -50);
|
TestHelpers.dialog.testDrag(el, 50, -50, 50, -50);
|
||||||
el.dialog('option', 'draggable', false);
|
el.dialog("option", "draggable", false);
|
||||||
TestHelpers.dialog.testDrag(el, 50, -50, 0, 0);
|
TestHelpers.dialog.testDrag(el, 50, -50, 0, 0);
|
||||||
el.remove();
|
el.remove();
|
||||||
});
|
});
|
||||||
@ -234,22 +234,22 @@ test("draggable", function() {
|
|||||||
test("height", function() {
|
test("height", function() {
|
||||||
expect(4);
|
expect(4);
|
||||||
|
|
||||||
var el = $('<div></div>').dialog();
|
var el = $("<div></div>").dialog();
|
||||||
equal(el.dialog('widget').outerHeight(), 150, "default height");
|
equal(el.dialog("widget").outerHeight(), 150, "default height");
|
||||||
el.remove();
|
el.remove();
|
||||||
|
|
||||||
el = $('<div></div>').dialog({ height: 237 });
|
el = $("<div></div>").dialog({ height: 237 });
|
||||||
equal(el.dialog('widget').outerHeight(), 237, "explicit height");
|
equal(el.dialog("widget").outerHeight(), 237, "explicit height");
|
||||||
el.remove();
|
el.remove();
|
||||||
|
|
||||||
el = $('<div></div>').dialog();
|
el = $("<div></div>").dialog();
|
||||||
el.dialog('option', 'height', 238);
|
el.dialog("option", "height", 238);
|
||||||
equal(el.dialog('widget').outerHeight(), 238, "explicit height set after init");
|
equal(el.dialog("widget").outerHeight(), 238, "explicit height set after init");
|
||||||
el.remove();
|
el.remove();
|
||||||
|
|
||||||
el = $('<div></div>').css("padding", "20px")
|
el = $("<div></div>").css("padding", "20px")
|
||||||
.dialog({ height: 240 });
|
.dialog({ height: 240 });
|
||||||
equal(el.dialog('widget').outerHeight(), 240, "explicit height with padding");
|
equal(el.dialog("widget").outerHeight(), 240, "explicit height with padding");
|
||||||
el.remove();
|
el.remove();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -265,76 +265,76 @@ asyncTest( "hide, #5860 - don't leave effects wrapper behind", function() {
|
|||||||
test("maxHeight", function() {
|
test("maxHeight", function() {
|
||||||
expect(3);
|
expect(3);
|
||||||
|
|
||||||
var el = $('<div></div>').dialog({ maxHeight: 200 });
|
var el = $("<div></div>").dialog({ maxHeight: 200 });
|
||||||
TestHelpers.dialog.drag(el, '.ui-resizable-s', 1000, 1000);
|
TestHelpers.dialog.drag(el, ".ui-resizable-s", 1000, 1000);
|
||||||
closeEnough(el.dialog('widget').height(), 200, 1, "maxHeight");
|
closeEnough(el.dialog("widget").height(), 200, 1, "maxHeight");
|
||||||
el.remove();
|
el.remove();
|
||||||
|
|
||||||
el = $('<div></div>').dialog({ maxHeight: 200 });
|
el = $("<div></div>").dialog({ maxHeight: 200 });
|
||||||
TestHelpers.dialog.drag(el, '.ui-resizable-n', -1000, -1000);
|
TestHelpers.dialog.drag(el, ".ui-resizable-n", -1000, -1000);
|
||||||
closeEnough(el.dialog('widget').height(), 200, 1, "maxHeight");
|
closeEnough(el.dialog("widget").height(), 200, 1, "maxHeight");
|
||||||
el.remove();
|
el.remove();
|
||||||
|
|
||||||
el = $('<div></div>').dialog({ maxHeight: 200 }).dialog('option', 'maxHeight', 300);
|
el = $("<div></div>").dialog({ maxHeight: 200 }).dialog("option", "maxHeight", 300);
|
||||||
TestHelpers.dialog.drag(el, '.ui-resizable-s', 1000, 1000);
|
TestHelpers.dialog.drag(el, ".ui-resizable-s", 1000, 1000);
|
||||||
closeEnough(el.dialog('widget').height(), 300, 1, "maxHeight");
|
closeEnough(el.dialog("widget").height(), 300, 1, "maxHeight");
|
||||||
el.remove();
|
el.remove();
|
||||||
});
|
});
|
||||||
|
|
||||||
test("maxWidth", function() {
|
test("maxWidth", function() {
|
||||||
expect(3);
|
expect(3);
|
||||||
|
|
||||||
var el = $('<div></div>').dialog({ maxWidth: 200 });
|
var el = $("<div></div>").dialog({ maxWidth: 200 });
|
||||||
TestHelpers.dialog.drag(el, '.ui-resizable-e', 1000, 1000);
|
TestHelpers.dialog.drag(el, ".ui-resizable-e", 1000, 1000);
|
||||||
closeEnough(el.dialog('widget').width(), 200, 1, "maxWidth");
|
closeEnough(el.dialog("widget").width(), 200, 1, "maxWidth");
|
||||||
el.remove();
|
el.remove();
|
||||||
|
|
||||||
el = $('<div></div>').dialog({ maxWidth: 200 });
|
el = $("<div></div>").dialog({ maxWidth: 200 });
|
||||||
TestHelpers.dialog.drag(el, '.ui-resizable-w', -1000, -1000);
|
TestHelpers.dialog.drag(el, ".ui-resizable-w", -1000, -1000);
|
||||||
closeEnough(el.dialog('widget').width(), 200, 1, "maxWidth");
|
closeEnough(el.dialog("widget").width(), 200, 1, "maxWidth");
|
||||||
el.remove();
|
el.remove();
|
||||||
|
|
||||||
el = $('<div></div>').dialog({ maxWidth: 200 }).dialog('option', 'maxWidth', 300);
|
el = $("<div></div>").dialog({ maxWidth: 200 }).dialog("option", "maxWidth", 300);
|
||||||
TestHelpers.dialog.drag(el, '.ui-resizable-w', -1000, -1000);
|
TestHelpers.dialog.drag(el, ".ui-resizable-w", -1000, -1000);
|
||||||
closeEnough(el.dialog('widget').width(), 300, 1, "maxWidth");
|
closeEnough(el.dialog("widget").width(), 300, 1, "maxWidth");
|
||||||
el.remove();
|
el.remove();
|
||||||
});
|
});
|
||||||
|
|
||||||
test("minHeight", function() {
|
test("minHeight", function() {
|
||||||
expect(3);
|
expect(3);
|
||||||
|
|
||||||
var el = $('<div></div>').dialog({ minHeight: 10 });
|
var el = $("<div></div>").dialog({ minHeight: 10 });
|
||||||
TestHelpers.dialog.drag(el, '.ui-resizable-s', -1000, -1000);
|
TestHelpers.dialog.drag(el, ".ui-resizable-s", -1000, -1000);
|
||||||
closeEnough(el.dialog('widget').height(), 10, 1, "minHeight");
|
closeEnough(el.dialog("widget").height(), 10, 1, "minHeight");
|
||||||
el.remove();
|
el.remove();
|
||||||
|
|
||||||
el = $('<div></div>').dialog({ minHeight: 10 });
|
el = $("<div></div>").dialog({ minHeight: 10 });
|
||||||
TestHelpers.dialog.drag(el, '.ui-resizable-n', 1000, 1000);
|
TestHelpers.dialog.drag(el, ".ui-resizable-n", 1000, 1000);
|
||||||
closeEnough(el.dialog('widget').height(), 10, 1, "minHeight");
|
closeEnough(el.dialog("widget").height(), 10, 1, "minHeight");
|
||||||
el.remove();
|
el.remove();
|
||||||
|
|
||||||
el = $('<div></div>').dialog({ minHeight: 10 }).dialog('option', 'minHeight', 30);
|
el = $("<div></div>").dialog({ minHeight: 10 }).dialog("option", "minHeight", 30);
|
||||||
TestHelpers.dialog.drag(el, '.ui-resizable-n', 1000, 1000);
|
TestHelpers.dialog.drag(el, ".ui-resizable-n", 1000, 1000);
|
||||||
closeEnough(el.dialog('widget').height(), 30, 1, "minHeight");
|
closeEnough(el.dialog("widget").height(), 30, 1, "minHeight");
|
||||||
el.remove();
|
el.remove();
|
||||||
});
|
});
|
||||||
|
|
||||||
test("minWidth", function() {
|
test("minWidth", function() {
|
||||||
expect(3);
|
expect(3);
|
||||||
|
|
||||||
var el = $('<div></div>').dialog({ minWidth: 10 });
|
var el = $("<div></div>").dialog({ minWidth: 10 });
|
||||||
TestHelpers.dialog.drag(el, '.ui-resizable-e', -1000, -1000);
|
TestHelpers.dialog.drag(el, ".ui-resizable-e", -1000, -1000);
|
||||||
closeEnough(el.dialog('widget').width(), 10, 1, "minWidth");
|
closeEnough(el.dialog("widget").width(), 10, 1, "minWidth");
|
||||||
el.remove();
|
el.remove();
|
||||||
|
|
||||||
el = $('<div></div>').dialog({ minWidth: 10 });
|
el = $("<div></div>").dialog({ minWidth: 10 });
|
||||||
TestHelpers.dialog.drag(el, '.ui-resizable-w', 1000, 1000);
|
TestHelpers.dialog.drag(el, ".ui-resizable-w", 1000, 1000);
|
||||||
closeEnough(el.dialog('widget').width(), 10, 1, "minWidth");
|
closeEnough(el.dialog("widget").width(), 10, 1, "minWidth");
|
||||||
el.remove();
|
el.remove();
|
||||||
|
|
||||||
el = $('<div></div>').dialog({ minWidth: 30 }).dialog('option', 'minWidth', 30);
|
el = $("<div></div>").dialog({ minWidth: 30 }).dialog("option", "minWidth", 30);
|
||||||
TestHelpers.dialog.drag(el, '.ui-resizable-w', 1000, 1000);
|
TestHelpers.dialog.drag(el, ".ui-resizable-w", 1000, 1000);
|
||||||
closeEnough(el.dialog('widget').width(), 30, 1, "minWidth");
|
closeEnough(el.dialog("widget").width(), 30, 1, "minWidth");
|
||||||
el.remove();
|
el.remove();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -378,8 +378,8 @@ test( "position, right bottom at right bottom via ui.position args", function()
|
|||||||
|
|
||||||
test( "position, at another element", function() {
|
test( "position, at another element", function() {
|
||||||
expect( 4 );
|
expect( 4 );
|
||||||
var parent = $('<div></div>').css({
|
var parent = $("<div></div>").css({
|
||||||
position: 'absolute',
|
position: "absolute",
|
||||||
top: 400,
|
top: 400,
|
||||||
left: 600,
|
left: 600,
|
||||||
height: 10,
|
height: 10,
|
||||||
@ -420,16 +420,16 @@ test( "position, at another element", function() {
|
|||||||
test("resizable", function() {
|
test("resizable", function() {
|
||||||
expect(4);
|
expect(4);
|
||||||
|
|
||||||
var el = $('<div></div>').dialog();
|
var el = $("<div></div>").dialog();
|
||||||
TestHelpers.dialog.shouldResize(el, 50, 50, "[default]");
|
TestHelpers.dialog.shouldResize(el, 50, 50, "[default]");
|
||||||
el.dialog('option', 'resizable', false);
|
el.dialog("option", "resizable", false);
|
||||||
TestHelpers.dialog.shouldResize(el, 0, 0, 'disabled after init');
|
TestHelpers.dialog.shouldResize(el, 0, 0, "disabled after init");
|
||||||
el.remove();
|
el.remove();
|
||||||
|
|
||||||
el = $('<div></div>').dialog({ resizable: false });
|
el = $("<div></div>").dialog({ resizable: false });
|
||||||
TestHelpers.dialog.shouldResize(el, 0, 0, "disabled in init options");
|
TestHelpers.dialog.shouldResize(el, 0, 0, "disabled in init options");
|
||||||
el.dialog('option', 'resizable', true);
|
el.dialog("option", "resizable", true);
|
||||||
TestHelpers.dialog.shouldResize(el, 50, 50, 'enabled after init');
|
TestHelpers.dialog.shouldResize(el, 50, 50, "enabled after init");
|
||||||
el.remove();
|
el.remove();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -437,37 +437,37 @@ test( "title", function() {
|
|||||||
expect( 11 );
|
expect( 11 );
|
||||||
|
|
||||||
function titleText() {
|
function titleText() {
|
||||||
return el.dialog('widget').find( ".ui-dialog-title" ).html();
|
return el.dialog("widget").find( ".ui-dialog-title" ).html();
|
||||||
}
|
}
|
||||||
|
|
||||||
var el = $( '<div></div>' ).dialog();
|
var el = $( "<div></div>" ).dialog();
|
||||||
// some browsers return a non-breaking space and some return " "
|
// some browsers return a non-breaking space and some return " "
|
||||||
// so we generate a non-breaking space for comparison
|
// so we generate a non-breaking space for comparison
|
||||||
equal( titleText(), $( "<span> </span>" ).html(), "[default]" );
|
equal( titleText(), $( "<span> </span>" ).html(), "[default]" );
|
||||||
equal( el.dialog( "option", "title" ), null, "option not changed" );
|
equal( el.dialog( "option", "title" ), null, "option not changed" );
|
||||||
el.remove();
|
el.remove();
|
||||||
|
|
||||||
el = $( '<div title="foo">' ).dialog();
|
el = $( "<div title='foo'>" ).dialog();
|
||||||
equal( titleText(), "foo", "title in element attribute" );
|
equal( titleText(), "foo", "title in element attribute" );
|
||||||
equal( el.dialog( "option", "title"), "foo", "option updated from attribute" );
|
equal( el.dialog( "option", "title"), "foo", "option updated from attribute" );
|
||||||
el.remove();
|
el.remove();
|
||||||
|
|
||||||
el = $( '<div></div>' ).dialog({ title: 'foo' });
|
el = $( "<div></div>" ).dialog({ title: "foo" });
|
||||||
equal( titleText(), "foo", "title in init options" );
|
equal( titleText(), "foo", "title in init options" );
|
||||||
equal( el.dialog("option", "title"), "foo", "opiton set from options hash" );
|
equal( el.dialog("option", "title"), "foo", "opiton set from options hash" );
|
||||||
el.remove();
|
el.remove();
|
||||||
|
|
||||||
el = $( '<div title="foo">' ).dialog({ title: 'bar' });
|
el = $( "<div title='foo'>" ).dialog({ title: "bar" });
|
||||||
equal( titleText(), "bar", "title in init options should override title in element attribute" );
|
equal( titleText(), "bar", "title in init options should override title in element attribute" );
|
||||||
equal( el.dialog("option", "title"), "bar", "opiton set from options hash" );
|
equal( el.dialog("option", "title"), "bar", "opiton set from options hash" );
|
||||||
el.remove();
|
el.remove();
|
||||||
|
|
||||||
el = $( '<div></div>' ).dialog().dialog( 'option', 'title', 'foo' );
|
el = $( "<div></div>" ).dialog().dialog( "option", "title", "foo" );
|
||||||
equal( titleText(), 'foo', 'title after init' );
|
equal( titleText(), "foo", "title after init" );
|
||||||
el.remove();
|
el.remove();
|
||||||
|
|
||||||
// make sure attroperties are properly ignored - #5742 - .attr() might return a DOMElement
|
// make sure attroperties are properly ignored - #5742 - .attr() might return a DOMElement
|
||||||
el = $( '<form><input name="title"></form>' ).dialog();
|
el = $( "<form><input name='title'></form>" ).dialog();
|
||||||
// some browsers return a non-breaking space and some return " "
|
// some browsers return a non-breaking space and some return " "
|
||||||
// so we get the text to normalize to the actual non-breaking space
|
// so we get the text to normalize to the actual non-breaking space
|
||||||
equal( titleText(), $( "<span> </span>" ).html(), "[default]" );
|
equal( titleText(), $( "<span> </span>" ).html(), "[default]" );
|
||||||
@ -478,34 +478,34 @@ test( "title", function() {
|
|||||||
test("width", function() {
|
test("width", function() {
|
||||||
expect(3);
|
expect(3);
|
||||||
|
|
||||||
var el = $('<div></div>').dialog();
|
var el = $("<div></div>").dialog();
|
||||||
closeEnough(el.dialog('widget').width(), 300, 1, "default width");
|
closeEnough(el.dialog("widget").width(), 300, 1, "default width");
|
||||||
el.remove();
|
el.remove();
|
||||||
|
|
||||||
el = $('<div></div>').dialog({width: 437 });
|
el = $("<div></div>").dialog({width: 437 });
|
||||||
closeEnough(el.dialog('widget').width(), 437, 1, "explicit width");
|
closeEnough(el.dialog("widget").width(), 437, 1, "explicit width");
|
||||||
el.dialog('option', 'width', 438);
|
el.dialog("option", "width", 438);
|
||||||
closeEnough(el.dialog('widget').width(), 438, 1, 'explicit width after init');
|
closeEnough(el.dialog("widget").width(), 438, 1, "explicit width after init");
|
||||||
el.remove();
|
el.remove();
|
||||||
});
|
});
|
||||||
|
|
||||||
test("#4826: setting resizable false toggles resizable on dialog", function() {
|
test("#4826: setting resizable false toggles resizable on dialog", function() {
|
||||||
expect(6);
|
expect(6);
|
||||||
var i,
|
var i,
|
||||||
el = $('<div></div>').dialog({ resizable: false });
|
el = $("<div></div>").dialog({ resizable: false });
|
||||||
|
|
||||||
TestHelpers.dialog.shouldResize(el, 0, 0, "[default]");
|
TestHelpers.dialog.shouldResize(el, 0, 0, "[default]");
|
||||||
for (i=0; i<2; i++) {
|
for (i=0; i<2; i++) {
|
||||||
el.dialog('close').dialog('open');
|
el.dialog("close").dialog("open");
|
||||||
TestHelpers.dialog.shouldResize(el, 0, 0, 'initialized with resizable false toggle ('+ (i+1) +')');
|
TestHelpers.dialog.shouldResize(el, 0, 0, "initialized with resizable false toggle ("+ (i+1) +")");
|
||||||
}
|
}
|
||||||
el.remove();
|
el.remove();
|
||||||
|
|
||||||
el = $('<div></div>').dialog({ resizable: true });
|
el = $("<div></div>").dialog({ resizable: true });
|
||||||
TestHelpers.dialog.shouldResize(el, 50, 50, "[default]");
|
TestHelpers.dialog.shouldResize(el, 50, 50, "[default]");
|
||||||
for (i=0; i<2; i++) {
|
for (i=0; i<2; i++) {
|
||||||
el.dialog('close').dialog('option', 'resizable', false).dialog('open');
|
el.dialog("close").dialog("option", "resizable", false).dialog("open");
|
||||||
TestHelpers.dialog.shouldResize(el, 0, 0, 'set option resizable false toggle ('+ (i+1) +')');
|
TestHelpers.dialog.shouldResize(el, 0, 0, "set option resizable false toggle ("+ (i+1) +")");
|
||||||
}
|
}
|
||||||
el.remove();
|
el.remove();
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
TestHelpers.dialog = {
|
TestHelpers.dialog = {
|
||||||
drag: function(el, handle, dx, dy) {
|
drag: function(el, handle, dx, dy) {
|
||||||
var d = el.dialog('widget');
|
var d = el.dialog("widget");
|
||||||
//this mouseover is to work around a limitation in resizable
|
//this mouseover is to work around a limitation in resizable
|
||||||
//TODO: fix resizable so handle doesn't require mouseover in order to be used
|
//TODO: fix resizable so handle doesn't require mouseover in order to be used
|
||||||
$( handle, d ).simulate("mouseover").simulate( "drag", {
|
$( handle, d ).simulate("mouseover").simulate( "drag", {
|
||||||
@ -10,7 +10,7 @@ TestHelpers.dialog = {
|
|||||||
},
|
},
|
||||||
testDrag: function(el, dx, dy, expectedDX, expectedDY, msg) {
|
testDrag: function(el, dx, dy, expectedDX, expectedDY, msg) {
|
||||||
var actualDX, actualDY, offsetAfter,
|
var actualDX, actualDY, offsetAfter,
|
||||||
d = el.dialog('widget'),
|
d = el.dialog("widget"),
|
||||||
handle = $(".ui-dialog-titlebar", d),
|
handle = $(".ui-dialog-titlebar", d),
|
||||||
offsetBefore = d.offset();
|
offsetBefore = d.offset();
|
||||||
|
|
||||||
@ -22,11 +22,11 @@ TestHelpers.dialog = {
|
|||||||
|
|
||||||
actualDX = offsetAfter.left - offsetBefore.left;
|
actualDX = offsetAfter.left - offsetBefore.left;
|
||||||
actualDY = offsetAfter.top - offsetBefore.top;
|
actualDY = offsetAfter.top - offsetBefore.top;
|
||||||
ok( expectedDX - actualDX <= 1 && expectedDY - actualDY <= 1, 'dragged[' + expectedDX + ', ' + expectedDY + '] ' + msg);
|
ok( expectedDX - actualDX <= 1 && expectedDY - actualDY <= 1, "dragged[" + expectedDX + ", " + expectedDY + "] " + msg);
|
||||||
},
|
},
|
||||||
shouldResize: function(el, dw, dh, msg) {
|
shouldResize: function(el, dw, dh, msg) {
|
||||||
var heightAfter, widthAfter, actual, expected,
|
var heightAfter, widthAfter, actual, expected,
|
||||||
d = el.dialog('widget'),
|
d = el.dialog("widget"),
|
||||||
handle = $(".ui-resizable-se", d),
|
handle = $(".ui-resizable-se", d),
|
||||||
heightBefore = d.height(),
|
heightBefore = d.height(),
|
||||||
widthBefore = d.width();
|
widthBefore = d.width();
|
||||||
@ -39,6 +39,6 @@ TestHelpers.dialog = {
|
|||||||
msg = msg ? msg + "." : "";
|
msg = msg ? msg + "." : "";
|
||||||
actual = { width: widthAfter, height: heightAfter },
|
actual = { width: widthAfter, height: heightAfter },
|
||||||
expected = { width: widthBefore + dw, height: heightBefore + dh };
|
expected = { width: widthBefore + dw, height: heightBefore + dh };
|
||||||
deepEqual(actual, expected, 'resized[' + 50 + ', ' + 50 + '] ' + msg);
|
deepEqual(actual, expected, "resized[" + 50 + ", " + 50 + "] " + msg);
|
||||||
}
|
}
|
||||||
};
|
};
|
@ -7,20 +7,20 @@
|
|||||||
module("draggable: core");
|
module("draggable: core");
|
||||||
|
|
||||||
test("element types", function() {
|
test("element types", function() {
|
||||||
var typeNames = ('p,h1,h2,h3,h4,h5,h6,blockquote,ol,ul,dl,div,form' +
|
var typeNames = ("p,h1,h2,h3,h4,h5,h6,blockquote,ol,ul,dl,div,form" +
|
||||||
',table,fieldset,address,ins,del,em,strong,q,cite,dfn,abbr' +
|
",table,fieldset,address,ins,del,em,strong,q,cite,dfn,abbr" +
|
||||||
',acronym,code,samp,kbd,var,img,hr' +
|
",acronym,code,samp,kbd,var,img,hr" +
|
||||||
',input,button,label,select,iframe').split(',');
|
",input,button,label,select,iframe").split(",");
|
||||||
|
|
||||||
expect( typeNames.length * 2 );
|
expect( typeNames.length * 2 );
|
||||||
|
|
||||||
$.each(typeNames, function(i) {
|
$.each(typeNames, function(i) {
|
||||||
var offsetBefore, offsetAfter,
|
var offsetBefore, offsetAfter,
|
||||||
typeName = typeNames[i],
|
typeName = typeNames[i],
|
||||||
el = $(document.createElement(typeName)).appendTo('#qunit-fixture');
|
el = $(document.createElement(typeName)).appendTo("#qunit-fixture");
|
||||||
|
|
||||||
(typeName === 'table' && el.append("<tr><td>content</td></tr>"));
|
(typeName === "table" && el.append("<tr><td>content</td></tr>"));
|
||||||
el.draggable({ cancel: '' });
|
el.draggable({ cancel: "" });
|
||||||
offsetBefore = el.offset();
|
offsetBefore = el.offset();
|
||||||
el.simulate( "drag", {
|
el.simulate( "drag", {
|
||||||
dx: 50,
|
dx: 50,
|
||||||
@ -50,16 +50,16 @@ test("No options, absolute", function() {
|
|||||||
test("resizable handle with complex markup (#8756 / #8757)", function() {
|
test("resizable handle with complex markup (#8756 / #8757)", function() {
|
||||||
expect( 2 );
|
expect( 2 );
|
||||||
|
|
||||||
$('#draggable1')
|
$("#draggable1")
|
||||||
.append(
|
.append(
|
||||||
$('<div>')
|
$("<div>")
|
||||||
.addClass("ui-resizable-handle")
|
.addClass("ui-resizable-handle")
|
||||||
.addClass("ui-resizable-w")
|
.addClass("ui-resizable-w")
|
||||||
.append($('<div>'))
|
.append($("<div>"))
|
||||||
);
|
);
|
||||||
|
|
||||||
var handle = $('.ui-resizable-w div'),
|
var handle = $(".ui-resizable-w div"),
|
||||||
target = $('#draggable1').draggable().resizable({ handles: 'all' });
|
target = $("#draggable1").draggable().resizable({ handles: "all" });
|
||||||
|
|
||||||
// todo: fix resizable so it doesn't require a mouseover
|
// todo: fix resizable so it doesn't require a mouseover
|
||||||
handle.simulate("mouseover").simulate( "drag", { dx: -50 } );
|
handle.simulate("mouseover").simulate( "drag", { dx: -50 } );
|
||||||
|
@ -82,7 +82,7 @@ test("stopping the stop callback", function() {
|
|||||||
expect(1);
|
expect(1);
|
||||||
|
|
||||||
var el = $("#draggable2").draggable({
|
var el = $("#draggable2").draggable({
|
||||||
helper: 'clone',
|
helper: "clone",
|
||||||
stop: function() { return false; }
|
stop: function() { return false; }
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -91,7 +91,7 @@ test("stopping the stop callback", function() {
|
|||||||
dy: 10
|
dy: 10
|
||||||
});
|
});
|
||||||
|
|
||||||
ok($("#draggable2").data('ui-draggable').helper, "the clone should not be deleted if the stop callback is stopped");
|
ok($("#draggable2").data("ui-draggable").helper, "the clone should not be deleted if the stop callback is stopped");
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@ -8,36 +8,36 @@ module("draggable: methods");
|
|||||||
test("init", function() {
|
test("init", function() {
|
||||||
expect(5);
|
expect(5);
|
||||||
|
|
||||||
$("<div></div>").appendTo('body').draggable().remove();
|
$("<div></div>").appendTo("body").draggable().remove();
|
||||||
ok(true, '.draggable() called on element');
|
ok(true, ".draggable() called on element");
|
||||||
|
|
||||||
$([]).draggable();
|
$([]).draggable();
|
||||||
ok(true, '.draggable() called on empty collection');
|
ok(true, ".draggable() called on empty collection");
|
||||||
|
|
||||||
$("<div></div>").draggable();
|
$("<div></div>").draggable();
|
||||||
ok(true, '.draggable() called on disconnected DOMElement');
|
ok(true, ".draggable() called on disconnected DOMElement");
|
||||||
|
|
||||||
$("<div></div>").draggable().draggable("option", "foo");
|
$("<div></div>").draggable().draggable("option", "foo");
|
||||||
ok(true, 'arbitrary option getter after init');
|
ok(true, "arbitrary option getter after init");
|
||||||
|
|
||||||
$("<div></div>").draggable().draggable("option", "foo", "bar");
|
$("<div></div>").draggable().draggable("option", "foo", "bar");
|
||||||
ok(true, 'arbitrary option setter after init');
|
ok(true, "arbitrary option setter after init");
|
||||||
});
|
});
|
||||||
|
|
||||||
test("destroy", function() {
|
test("destroy", function() {
|
||||||
expect(4);
|
expect(4);
|
||||||
$("<div></div>").appendTo('body').draggable().draggable("destroy").remove();
|
$("<div></div>").appendTo("body").draggable().draggable("destroy").remove();
|
||||||
ok(true, '.draggable("destroy") called on element');
|
ok(true, ".draggable('destroy') called on element");
|
||||||
|
|
||||||
$([]).draggable().draggable("destroy");
|
$([]).draggable().draggable("destroy");
|
||||||
ok(true, '.draggable("destroy") called on empty collection');
|
ok(true, ".draggable('destroy') called on empty collection");
|
||||||
|
|
||||||
$("<div></div>").draggable().draggable("destroy");
|
$("<div></div>").draggable().draggable("destroy");
|
||||||
ok(true, '.draggable("destroy") called on disconnected DOMElement');
|
ok(true, ".draggable('destroy') called on disconnected DOMElement");
|
||||||
|
|
||||||
var expected = $('<div></div>').draggable(),
|
var expected = $("<div></div>").draggable(),
|
||||||
actual = expected.draggable('destroy');
|
actual = expected.draggable("destroy");
|
||||||
equal(actual, expected, 'destroy is chainable');
|
equal(actual, expected, "destroy is chainable");
|
||||||
});
|
});
|
||||||
|
|
||||||
test("enable", function() {
|
test("enable", function() {
|
||||||
@ -46,23 +46,23 @@ test("enable", function() {
|
|||||||
var expected, actual, el;
|
var expected, actual, el;
|
||||||
|
|
||||||
el = $("#draggable2").draggable({ disabled: true });
|
el = $("#draggable2").draggable({ disabled: true });
|
||||||
TestHelpers.draggable.shouldNotMove(el, '.draggable({ disabled: true })');
|
TestHelpers.draggable.shouldNotMove(el, ".draggable({ disabled: true })");
|
||||||
|
|
||||||
el.draggable("enable");
|
el.draggable("enable");
|
||||||
TestHelpers.draggable.shouldMove(el, '.draggable("enable")');
|
TestHelpers.draggable.shouldMove(el, ".draggable('enable')");
|
||||||
equal(el.draggable("option", "disabled"), false, "disabled option getter");
|
equal(el.draggable("option", "disabled"), false, "disabled option getter");
|
||||||
|
|
||||||
el.draggable("destroy");
|
el.draggable("destroy");
|
||||||
el.draggable({ disabled: true });
|
el.draggable({ disabled: true });
|
||||||
TestHelpers.draggable.shouldNotMove(el, '.draggable({ disabled: true })');
|
TestHelpers.draggable.shouldNotMove(el, ".draggable({ disabled: true })");
|
||||||
|
|
||||||
el.draggable("option", "disabled", false);
|
el.draggable("option", "disabled", false);
|
||||||
equal(el.draggable("option", "disabled"), false, "disabled option setter");
|
equal(el.draggable("option", "disabled"), false, "disabled option setter");
|
||||||
TestHelpers.draggable.shouldMove(el, '.draggable("option", "disabled", false)');
|
TestHelpers.draggable.shouldMove(el, ".draggable('option', 'disabled', false)");
|
||||||
|
|
||||||
expected = $('<div></div>').draggable(),
|
expected = $("<div></div>").draggable(),
|
||||||
actual = expected.draggable('enable');
|
actual = expected.draggable("enable");
|
||||||
equal(actual, expected, 'enable is chainable');
|
equal(actual, expected, "enable is chainable");
|
||||||
});
|
});
|
||||||
|
|
||||||
test("disable", function() {
|
test("disable", function() {
|
||||||
@ -71,24 +71,24 @@ test("disable", function() {
|
|||||||
var expected, actual, el;
|
var expected, actual, el;
|
||||||
|
|
||||||
el = $("#draggable2").draggable({ disabled: false });
|
el = $("#draggable2").draggable({ disabled: false });
|
||||||
TestHelpers.draggable.shouldMove(el, '.draggable({ disabled: false })');
|
TestHelpers.draggable.shouldMove(el, ".draggable({ disabled: false })");
|
||||||
|
|
||||||
el.draggable("disable");
|
el.draggable("disable");
|
||||||
TestHelpers.draggable.shouldNotMove(el, '.draggable("disable")');
|
TestHelpers.draggable.shouldNotMove(el, ".draggable('disable')");
|
||||||
equal(el.draggable("option", "disabled"), true, "disabled option getter");
|
equal(el.draggable("option", "disabled"), true, "disabled option getter");
|
||||||
|
|
||||||
el.draggable("destroy");
|
el.draggable("destroy");
|
||||||
|
|
||||||
el.draggable({ disabled: false });
|
el.draggable({ disabled: false });
|
||||||
TestHelpers.draggable.shouldMove(el, '.draggable({ disabled: false })');
|
TestHelpers.draggable.shouldMove(el, ".draggable({ disabled: false })");
|
||||||
|
|
||||||
el.draggable("option", "disabled", true);
|
el.draggable("option", "disabled", true);
|
||||||
equal(el.draggable("option", "disabled"), true, "disabled option setter");
|
equal(el.draggable("option", "disabled"), true, "disabled option setter");
|
||||||
TestHelpers.draggable.shouldNotMove(el, '.draggable("option", "disabled", true)');
|
TestHelpers.draggable.shouldNotMove(el, ".draggable('option', 'disabled', true)");
|
||||||
|
|
||||||
expected = $('<div></div>').draggable(),
|
expected = $("<div></div>").draggable(),
|
||||||
actual = expected.draggable('disable');
|
actual = expected.draggable("disable");
|
||||||
equal(actual, expected, 'disable is chainable');
|
equal(actual, expected, "disable is chainable");
|
||||||
});
|
});
|
||||||
|
|
||||||
})(jQuery);
|
})(jQuery);
|
||||||
|
@ -7,10 +7,10 @@ module("draggable: options");
|
|||||||
|
|
||||||
test("{ appendTo: 'parent' }, default", function() {
|
test("{ appendTo: 'parent' }, default", function() {
|
||||||
expect( 2 );
|
expect( 2 );
|
||||||
var el = $("#draggable2").draggable({ appendTo: 'parent' });
|
var el = $("#draggable2").draggable({ appendTo: "parent" });
|
||||||
TestHelpers.draggable.shouldMove(el);
|
TestHelpers.draggable.shouldMove(el);
|
||||||
|
|
||||||
el = $("#draggable1").draggable({ appendTo: 'parent' });
|
el = $("#draggable1").draggable({ appendTo: "parent" });
|
||||||
TestHelpers.draggable.shouldMove(el);
|
TestHelpers.draggable.shouldMove(el);
|
||||||
|
|
||||||
});
|
});
|
||||||
@ -74,7 +74,7 @@ test("{ axis: ? }, unexpected", function() {
|
|||||||
test("{ cancel: 'input,textarea,button,select,option' }, default", function() {
|
test("{ cancel: 'input,textarea,button,select,option' }, default", function() {
|
||||||
expect( 2 );
|
expect( 2 );
|
||||||
|
|
||||||
$('<div id="draggable-option-cancel-default"><input type="text"></div>').appendTo('#main');
|
$("<div id='draggable-option-cancel-default'><input type='text'></div>").appendTo("#main");
|
||||||
|
|
||||||
var el = $("#draggable-option-cancel-default").draggable({ cancel: "input,textarea,button,select,option" });
|
var el = $("#draggable-option-cancel-default").draggable({ cancel: "input,textarea,button,select,option" });
|
||||||
TestHelpers.draggable.shouldMove(el);
|
TestHelpers.draggable.shouldMove(el);
|
||||||
@ -94,7 +94,7 @@ test("{ cancel: 'span' }", function() {
|
|||||||
|
|
||||||
el.draggable("destroy");
|
el.draggable("destroy");
|
||||||
|
|
||||||
el = $("#draggable2").draggable({ cancel: 'span' });
|
el = $("#draggable2").draggable({ cancel: "span" });
|
||||||
TestHelpers.draggable.testDrag(el, "#draggable2 span", 50, 50, 0, 0);
|
TestHelpers.draggable.testDrag(el, "#draggable2 span", 50, 50, 0, 0);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -122,13 +122,13 @@ test("{ cancel: ? }, unexpected", function() {
|
|||||||
test("{ containment: false }, default", function() {
|
test("{ containment: false }, default", function() {
|
||||||
expect( 1 );
|
expect( 1 );
|
||||||
|
|
||||||
ok(false, 'missing test - untested code is broken code');
|
ok(false, "missing test - untested code is broken code");
|
||||||
});
|
});
|
||||||
|
|
||||||
test("{ containment: Element }", function() {
|
test("{ containment: Element }", function() {
|
||||||
expect( 1 );
|
expect( 1 );
|
||||||
|
|
||||||
ok(false, 'missing test - untested code is broken code');
|
ok(false, "missing test - untested code is broken code");
|
||||||
});
|
});
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -136,12 +136,12 @@ test("{ containment: 'parent' }, relative", function() {
|
|||||||
expect( 1 );
|
expect( 1 );
|
||||||
|
|
||||||
var offsetAfter,
|
var offsetAfter,
|
||||||
el = $("#draggable1").draggable({ containment: 'parent' }),
|
el = $("#draggable1").draggable({ containment: "parent" }),
|
||||||
p = el.parent(),
|
p = el.parent(),
|
||||||
po = p.offset(),
|
po = p.offset(),
|
||||||
expected = {
|
expected = {
|
||||||
left: po.left + TestHelpers.draggable.border(p, 'left') + TestHelpers.draggable.margin(el, 'left'),
|
left: po.left + TestHelpers.draggable.border(p, "left") + TestHelpers.draggable.margin(el, "left"),
|
||||||
top: po.top + TestHelpers.draggable.border(p, 'top') + TestHelpers.draggable.margin(el, 'top')
|
top: po.top + TestHelpers.draggable.border(p, "top") + TestHelpers.draggable.margin(el, "top")
|
||||||
};
|
};
|
||||||
|
|
||||||
el.simulate( "drag", {
|
el.simulate( "drag", {
|
||||||
@ -149,19 +149,19 @@ test("{ containment: 'parent' }, relative", function() {
|
|||||||
dy: -100
|
dy: -100
|
||||||
});
|
});
|
||||||
offsetAfter = el.offset();
|
offsetAfter = el.offset();
|
||||||
deepEqual(offsetAfter, expected, 'compare offset to parent');
|
deepEqual(offsetAfter, expected, "compare offset to parent");
|
||||||
});
|
});
|
||||||
|
|
||||||
test("{ containment: 'parent' }, absolute", function() {
|
test("{ containment: 'parent' }, absolute", function() {
|
||||||
expect( 1 );
|
expect( 1 );
|
||||||
|
|
||||||
var offsetAfter,
|
var offsetAfter,
|
||||||
el = $("#draggable2").draggable({ containment: 'parent' }),
|
el = $("#draggable2").draggable({ containment: "parent" }),
|
||||||
p = el.parent(),
|
p = el.parent(),
|
||||||
po = p.offset(),
|
po = p.offset(),
|
||||||
expected = {
|
expected = {
|
||||||
left: po.left + TestHelpers.draggable.border(p, 'left') + TestHelpers.draggable.margin(el, 'left'),
|
left: po.left + TestHelpers.draggable.border(p, "left") + TestHelpers.draggable.margin(el, "left"),
|
||||||
top: po.top + TestHelpers.draggable.border(p, 'top') + TestHelpers.draggable.margin(el, 'top')
|
top: po.top + TestHelpers.draggable.border(p, "top") + TestHelpers.draggable.margin(el, "top")
|
||||||
};
|
};
|
||||||
|
|
||||||
el.simulate( "drag", {
|
el.simulate( "drag", {
|
||||||
@ -169,32 +169,32 @@ test("{ containment: 'parent' }, absolute", function() {
|
|||||||
dy: -100
|
dy: -100
|
||||||
});
|
});
|
||||||
offsetAfter = el.offset();
|
offsetAfter = el.offset();
|
||||||
deepEqual(offsetAfter, expected, 'compare offset to parent');
|
deepEqual(offsetAfter, expected, "compare offset to parent");
|
||||||
});
|
});
|
||||||
|
|
||||||
/*
|
/*
|
||||||
test("{ containment: 'document' }", function() {
|
test("{ containment: 'document' }", function() {
|
||||||
expect( 1 );
|
expect( 1 );
|
||||||
|
|
||||||
ok(false, 'missing test - untested code is broken code');
|
ok(false, "missing test - untested code is broken code");
|
||||||
});
|
});
|
||||||
|
|
||||||
test("{ containment: 'window' }", function() {
|
test("{ containment: 'window' }", function() {
|
||||||
expect( 1 );
|
expect( 1 );
|
||||||
|
|
||||||
ok(false, 'missing test - untested code is broken code');
|
ok(false, "missing test - untested code is broken code");
|
||||||
});
|
});
|
||||||
|
|
||||||
test("{ containment: Selector }", function() {
|
test("{ containment: Selector }", function() {
|
||||||
expect( 1 );
|
expect( 1 );
|
||||||
|
|
||||||
ok(false, 'missing test - untested code is broken code');
|
ok(false, "missing test - untested code is broken code");
|
||||||
});
|
});
|
||||||
|
|
||||||
test("{ containment: [x1, y1, x2, y2] }", function() {
|
test("{ containment: [x1, y1, x2, y2] }", function() {
|
||||||
expect( 1 );
|
expect( 1 );
|
||||||
|
|
||||||
ok(false, 'missing test - untested code is broken code');
|
ok(false, "missing test - untested code is broken code");
|
||||||
});
|
});
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -251,20 +251,13 @@ test("{ cursor: 'move' }", function() {
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
/*
|
test( "cursorAt", function() {
|
||||||
test("{ cursorAt: false}, default", function() {
|
expect( 24 );
|
||||||
expect( 1 );
|
|
||||||
|
|
||||||
ok(false, 'missing test - untested code is broken code');
|
|
||||||
});
|
|
||||||
*/
|
|
||||||
|
|
||||||
test( "{ cursorAt: left, top }", function() {
|
|
||||||
expect( 20 );
|
|
||||||
|
|
||||||
var deltaX = -3,
|
var deltaX = -3,
|
||||||
deltaY = -3,
|
deltaY = -3,
|
||||||
tests = {
|
tests = {
|
||||||
|
"false": { cursorAt : false },
|
||||||
"{ left: -5, top: -5 }": { x: -5, y: -5, cursorAt : { left: -5, top: -5 } },
|
"{ left: -5, top: -5 }": { x: -5, y: -5, cursorAt : { left: -5, top: -5 } },
|
||||||
"[ 10, 20 ]": { x: 10, y: 20, cursorAt : [ 10, 20 ] },
|
"[ 10, 20 ]": { x: 10, y: 20, cursorAt : [ 10, 20 ] },
|
||||||
"'10 20'": { x: 10, y: 20, cursorAt : "10 20" },
|
"'10 20'": { x: 10, y: 20, cursorAt : "10 20" },
|
||||||
@ -277,9 +270,12 @@ test( "{ cursorAt: left, top }", function() {
|
|||||||
var el = $( "#draggable" + ( i + 1 ) ).draggable({
|
var el = $( "#draggable" + ( i + 1 ) ).draggable({
|
||||||
cursorAt: testData.cursorAt,
|
cursorAt: testData.cursorAt,
|
||||||
drag: function( event, ui ) {
|
drag: function( event, ui ) {
|
||||||
if( testData.cursorAt.right ) {
|
if( !testData.cursorAt ) {
|
||||||
equal( ui.helper.width() - ( event.clientX - ui.offset.left ), testData.x + TestHelpers.draggable.unreliableOffset, testName + " " + position + " left" );
|
equal( ui.position.left - ui.originalPosition.left, deltaX, testName + " " + position + " left" );
|
||||||
equal( ui.helper.height() - ( event.clientY - ui.offset.top ), testData.y + TestHelpers.draggable.unreliableOffset, testName + position + " top" );
|
equal( ui.position.top - ui.originalPosition.top, deltaY, testName + " " + position + " top" );
|
||||||
|
} else if( testData.cursorAt.right ) {
|
||||||
|
equal( ui.helper.width() - ( event.clientX - ui.offset.left ), testData.x - TestHelpers.draggable.unreliableOffset, testName + " " + position + " left" );
|
||||||
|
equal( ui.helper.height() - ( event.clientY - ui.offset.top ), testData.y - TestHelpers.draggable.unreliableOffset, testName + " " +position + " top" );
|
||||||
} else {
|
} else {
|
||||||
equal( event.clientX - ui.offset.left, testData.x + TestHelpers.draggable.unreliableOffset, testName + " " + position + " left" );
|
equal( event.clientX - ui.offset.left, testData.x + TestHelpers.draggable.unreliableOffset, testName + " " + position + " left" );
|
||||||
equal( event.clientY - ui.offset.top, testData.y + TestHelpers.draggable.unreliableOffset, testName + " " + position + " top" );
|
equal( event.clientY - ui.offset.top, testData.y + TestHelpers.draggable.unreliableOffset, testName + " " + position + " top" );
|
||||||
@ -315,7 +311,7 @@ test("{ grid: [50, 50] }, absolute", function() {
|
|||||||
test("{ handle: 'span' }", function() {
|
test("{ handle: 'span' }", function() {
|
||||||
expect( 2 );
|
expect( 2 );
|
||||||
|
|
||||||
var el = $("#draggable2").draggable({ handle: 'span' });
|
var el = $("#draggable2").draggable({ handle: "span" });
|
||||||
|
|
||||||
TestHelpers.draggable.testDrag(el, "#draggable2 span", 50, 50, 50, 50, "drag span");
|
TestHelpers.draggable.testDrag(el, "#draggable2 span", 50, 50, 50, 50, "drag span");
|
||||||
TestHelpers.draggable.shouldNotMove(el, "drag element");
|
TestHelpers.draggable.shouldNotMove(el, "drag element");
|
||||||
@ -341,13 +337,13 @@ test("{ helper: 'original' }, relative, with scroll offset on parent", function(
|
|||||||
var el = $("#draggable1").draggable({ helper: "original" });
|
var el = $("#draggable1").draggable({ helper: "original" });
|
||||||
|
|
||||||
TestHelpers.draggable.setScroll();
|
TestHelpers.draggable.setScroll();
|
||||||
TestHelpers.draggable.testScroll(el, 'relative');
|
TestHelpers.draggable.testScroll(el, "relative");
|
||||||
|
|
||||||
TestHelpers.draggable.setScroll();
|
TestHelpers.draggable.setScroll();
|
||||||
TestHelpers.draggable.testScroll(el, 'static');
|
TestHelpers.draggable.testScroll(el, "static");
|
||||||
|
|
||||||
TestHelpers.draggable.setScroll();
|
TestHelpers.draggable.setScroll();
|
||||||
TestHelpers.draggable.testScroll(el, 'absolute');
|
TestHelpers.draggable.testScroll(el, "absolute");
|
||||||
|
|
||||||
TestHelpers.draggable.restoreScroll();
|
TestHelpers.draggable.restoreScroll();
|
||||||
|
|
||||||
@ -358,16 +354,16 @@ test("{ helper: 'original' }, relative, with scroll offset on root", function()
|
|||||||
|
|
||||||
var el = $("#draggable1").draggable({ helper: "original" });
|
var el = $("#draggable1").draggable({ helper: "original" });
|
||||||
|
|
||||||
TestHelpers.draggable.setScroll('root');
|
TestHelpers.draggable.setScroll("root");
|
||||||
TestHelpers.draggable.testScroll(el, 'relative');
|
TestHelpers.draggable.testScroll(el, "relative");
|
||||||
|
|
||||||
TestHelpers.draggable.setScroll('root');
|
TestHelpers.draggable.setScroll("root");
|
||||||
TestHelpers.draggable.testScroll(el, 'static');
|
TestHelpers.draggable.testScroll(el, "static");
|
||||||
|
|
||||||
TestHelpers.draggable.setScroll('root');
|
TestHelpers.draggable.setScroll("root");
|
||||||
TestHelpers.draggable.testScroll(el, 'absolute');
|
TestHelpers.draggable.testScroll(el, "absolute");
|
||||||
|
|
||||||
TestHelpers.draggable.restoreScroll('root');
|
TestHelpers.draggable.restoreScroll("root");
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -378,19 +374,19 @@ test("{ helper: 'original' }, relative, with scroll offset on root and parent",
|
|||||||
var el = $("#draggable1").draggable({ helper: "original" });
|
var el = $("#draggable1").draggable({ helper: "original" });
|
||||||
|
|
||||||
TestHelpers.draggable.setScroll();
|
TestHelpers.draggable.setScroll();
|
||||||
TestHelpers.draggable.setScroll('root');
|
TestHelpers.draggable.setScroll("root");
|
||||||
TestHelpers.draggable.testScroll(el, 'relative');
|
TestHelpers.draggable.testScroll(el, "relative");
|
||||||
|
|
||||||
TestHelpers.draggable.setScroll();
|
TestHelpers.draggable.setScroll();
|
||||||
TestHelpers.draggable.setScroll('root');
|
TestHelpers.draggable.setScroll("root");
|
||||||
TestHelpers.draggable.testScroll(el, 'static');
|
TestHelpers.draggable.testScroll(el, "static");
|
||||||
|
|
||||||
TestHelpers.draggable.setScroll();
|
TestHelpers.draggable.setScroll();
|
||||||
TestHelpers.draggable.setScroll('root');
|
TestHelpers.draggable.setScroll("root");
|
||||||
TestHelpers.draggable.testScroll(el, 'absolute');
|
TestHelpers.draggable.testScroll(el, "absolute");
|
||||||
|
|
||||||
TestHelpers.draggable.restoreScroll();
|
TestHelpers.draggable.restoreScroll();
|
||||||
TestHelpers.draggable.restoreScroll('root');
|
TestHelpers.draggable.restoreScroll("root");
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -398,16 +394,16 @@ test("{ helper: 'original' }, absolute, with scroll offset on parent", function(
|
|||||||
|
|
||||||
expect(3);
|
expect(3);
|
||||||
|
|
||||||
var el = $("#draggable1").css({ position: 'absolute', top: 0, left: 0 }).draggable({ helper: "original" });
|
var el = $("#draggable1").css({ position: "absolute", top: 0, left: 0 }).draggable({ helper: "original" });
|
||||||
|
|
||||||
TestHelpers.draggable.setScroll();
|
TestHelpers.draggable.setScroll();
|
||||||
TestHelpers.draggable.testScroll(el, 'relative');
|
TestHelpers.draggable.testScroll(el, "relative");
|
||||||
|
|
||||||
TestHelpers.draggable.setScroll();
|
TestHelpers.draggable.setScroll();
|
||||||
TestHelpers.draggable.testScroll(el, 'static');
|
TestHelpers.draggable.testScroll(el, "static");
|
||||||
|
|
||||||
TestHelpers.draggable.setScroll();
|
TestHelpers.draggable.setScroll();
|
||||||
TestHelpers.draggable.testScroll(el, 'absolute');
|
TestHelpers.draggable.testScroll(el, "absolute");
|
||||||
|
|
||||||
TestHelpers.draggable.restoreScroll();
|
TestHelpers.draggable.restoreScroll();
|
||||||
|
|
||||||
@ -417,18 +413,18 @@ test("{ helper: 'original' }, absolute, with scroll offset on root", function()
|
|||||||
|
|
||||||
expect(3);
|
expect(3);
|
||||||
|
|
||||||
var el = $("#draggable1").css({ position: 'absolute', top: 0, left: 0 }).draggable({ helper: "original" });
|
var el = $("#draggable1").css({ position: "absolute", top: 0, left: 0 }).draggable({ helper: "original" });
|
||||||
|
|
||||||
TestHelpers.draggable.setScroll('root');
|
TestHelpers.draggable.setScroll("root");
|
||||||
TestHelpers.draggable.testScroll(el, 'relative');
|
TestHelpers.draggable.testScroll(el, "relative");
|
||||||
|
|
||||||
TestHelpers.draggable.setScroll('root');
|
TestHelpers.draggable.setScroll("root");
|
||||||
TestHelpers.draggable.testScroll(el, 'static');
|
TestHelpers.draggable.testScroll(el, "static");
|
||||||
|
|
||||||
TestHelpers.draggable.setScroll('root');
|
TestHelpers.draggable.setScroll("root");
|
||||||
TestHelpers.draggable.testScroll(el, 'absolute');
|
TestHelpers.draggable.testScroll(el, "absolute");
|
||||||
|
|
||||||
TestHelpers.draggable.restoreScroll('root');
|
TestHelpers.draggable.restoreScroll("root");
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -436,22 +432,22 @@ test("{ helper: 'original' }, absolute, with scroll offset on root and parent",
|
|||||||
|
|
||||||
expect(3);
|
expect(3);
|
||||||
|
|
||||||
var el = $("#draggable1").css({ position: 'absolute', top: 0, left: 0 }).draggable({ helper: "original" });
|
var el = $("#draggable1").css({ position: "absolute", top: 0, left: 0 }).draggable({ helper: "original" });
|
||||||
|
|
||||||
TestHelpers.draggable.setScroll();
|
TestHelpers.draggable.setScroll();
|
||||||
TestHelpers.draggable.setScroll('root');
|
TestHelpers.draggable.setScroll("root");
|
||||||
TestHelpers.draggable.testScroll(el, 'relative');
|
TestHelpers.draggable.testScroll(el, "relative");
|
||||||
|
|
||||||
TestHelpers.draggable.setScroll();
|
TestHelpers.draggable.setScroll();
|
||||||
TestHelpers.draggable.setScroll('root');
|
TestHelpers.draggable.setScroll("root");
|
||||||
TestHelpers.draggable.testScroll(el, 'static');
|
TestHelpers.draggable.testScroll(el, "static");
|
||||||
|
|
||||||
TestHelpers.draggable.setScroll();
|
TestHelpers.draggable.setScroll();
|
||||||
TestHelpers.draggable.setScroll('root');
|
TestHelpers.draggable.setScroll("root");
|
||||||
TestHelpers.draggable.testScroll(el, 'absolute');
|
TestHelpers.draggable.testScroll(el, "absolute");
|
||||||
|
|
||||||
TestHelpers.draggable.restoreScroll();
|
TestHelpers.draggable.restoreScroll();
|
||||||
TestHelpers.draggable.restoreScroll('root');
|
TestHelpers.draggable.restoreScroll("root");
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -459,16 +455,16 @@ test("{ helper: 'original' }, fixed, with scroll offset on parent", function() {
|
|||||||
|
|
||||||
expect(3);
|
expect(3);
|
||||||
|
|
||||||
var el = $("#draggable1").css({ position: 'fixed', top: 0, left: 0 }).draggable({ helper: "original" });
|
var el = $("#draggable1").css({ position: "fixed", top: 0, left: 0 }).draggable({ helper: "original" });
|
||||||
|
|
||||||
TestHelpers.draggable.setScroll();
|
TestHelpers.draggable.setScroll();
|
||||||
TestHelpers.draggable.testScroll(el, 'relative');
|
TestHelpers.draggable.testScroll(el, "relative");
|
||||||
|
|
||||||
TestHelpers.draggable.setScroll();
|
TestHelpers.draggable.setScroll();
|
||||||
TestHelpers.draggable.testScroll(el, 'static');
|
TestHelpers.draggable.testScroll(el, "static");
|
||||||
|
|
||||||
TestHelpers.draggable.setScroll();
|
TestHelpers.draggable.setScroll();
|
||||||
TestHelpers.draggable.testScroll(el, 'absolute');
|
TestHelpers.draggable.testScroll(el, "absolute");
|
||||||
|
|
||||||
TestHelpers.draggable.restoreScroll();
|
TestHelpers.draggable.restoreScroll();
|
||||||
|
|
||||||
@ -478,40 +474,40 @@ test("{ helper: 'original' }, fixed, with scroll offset on root", function() {
|
|||||||
|
|
||||||
expect(3);
|
expect(3);
|
||||||
|
|
||||||
var el = $("#draggable1").css({ position: 'fixed', top: 0, left: 0 }).draggable({ helper: "original" });
|
var el = $("#draggable1").css({ position: "fixed", top: 0, left: 0 }).draggable({ helper: "original" });
|
||||||
|
|
||||||
TestHelpers.draggable.setScroll('root');
|
TestHelpers.draggable.setScroll("root");
|
||||||
TestHelpers.draggable.testScroll(el, 'relative');
|
TestHelpers.draggable.testScroll(el, "relative");
|
||||||
|
|
||||||
TestHelpers.draggable.setScroll('root');
|
TestHelpers.draggable.setScroll("root");
|
||||||
TestHelpers.draggable.testScroll(el, 'static');
|
TestHelpers.draggable.testScroll(el, "static");
|
||||||
|
|
||||||
TestHelpers.draggable.setScroll('root');
|
TestHelpers.draggable.setScroll("root");
|
||||||
TestHelpers.draggable.testScroll(el, 'absolute');
|
TestHelpers.draggable.testScroll(el, "absolute");
|
||||||
|
|
||||||
TestHelpers.draggable.restoreScroll('root');
|
TestHelpers.draggable.restoreScroll("root");
|
||||||
});
|
});
|
||||||
|
|
||||||
test("{ helper: 'original' }, fixed, with scroll offset on root and parent", function() {
|
test("{ helper: 'original' }, fixed, with scroll offset on root and parent", function() {
|
||||||
|
|
||||||
expect(3);
|
expect(3);
|
||||||
|
|
||||||
var el = $("#draggable1").css({ position: 'fixed', top: 0, left: 0 }).draggable({ helper: "original" });
|
var el = $("#draggable1").css({ position: "fixed", top: 0, left: 0 }).draggable({ helper: "original" });
|
||||||
|
|
||||||
TestHelpers.draggable.setScroll();
|
TestHelpers.draggable.setScroll();
|
||||||
TestHelpers.draggable.setScroll('root');
|
TestHelpers.draggable.setScroll("root");
|
||||||
TestHelpers.draggable.testScroll(el, 'relative');
|
TestHelpers.draggable.testScroll(el, "relative");
|
||||||
|
|
||||||
TestHelpers.draggable.setScroll();
|
TestHelpers.draggable.setScroll();
|
||||||
TestHelpers.draggable.setScroll('root');
|
TestHelpers.draggable.setScroll("root");
|
||||||
TestHelpers.draggable.testScroll(el, 'static');
|
TestHelpers.draggable.testScroll(el, "static");
|
||||||
|
|
||||||
TestHelpers.draggable.setScroll();
|
TestHelpers.draggable.setScroll();
|
||||||
TestHelpers.draggable.setScroll('root');
|
TestHelpers.draggable.setScroll("root");
|
||||||
TestHelpers.draggable.testScroll(el, 'absolute');
|
TestHelpers.draggable.testScroll(el, "absolute");
|
||||||
|
|
||||||
TestHelpers.draggable.restoreScroll();
|
TestHelpers.draggable.restoreScroll();
|
||||||
TestHelpers.draggable.restoreScroll('root');
|
TestHelpers.draggable.restoreScroll("root");
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -529,7 +525,7 @@ test("{ helper: 'clone' }, absolute", function() {
|
|||||||
dx: 1,
|
dx: 1,
|
||||||
dy: 1
|
dy: 1
|
||||||
});
|
});
|
||||||
deepEqual({ top: helperOffset.top-1, left: helperOffset.left-1 }, origOffset, 'dragged[1, 1] ');
|
deepEqual({ top: helperOffset.top-1, left: helperOffset.left-1 }, origOffset, "dragged[1, 1] ");
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -544,29 +540,29 @@ test("{ helper: 'clone' }, absolute with scroll offset on parent", function() {
|
|||||||
helperOffset = ui.helper.offset();
|
helperOffset = ui.helper.offset();
|
||||||
} });
|
} });
|
||||||
|
|
||||||
$("#main").css('position', 'relative');
|
$("#main").css("position", "relative");
|
||||||
origOffset = $("#draggable1").offset();
|
origOffset = $("#draggable1").offset();
|
||||||
el.simulate( "drag", {
|
el.simulate( "drag", {
|
||||||
dx: 1,
|
dx: 1,
|
||||||
dy: 1
|
dy: 1
|
||||||
});
|
});
|
||||||
deepEqual({ top: helperOffset.top-1, left: helperOffset.left-1 }, origOffset, 'dragged[1, 1] ');
|
deepEqual({ top: helperOffset.top-1, left: helperOffset.left-1 }, origOffset, "dragged[1, 1] ");
|
||||||
|
|
||||||
$("#main").css('position', 'static');
|
$("#main").css("position", "static");
|
||||||
origOffset = $("#draggable1").offset();
|
origOffset = $("#draggable1").offset();
|
||||||
el.simulate( "drag", {
|
el.simulate( "drag", {
|
||||||
dx: 1,
|
dx: 1,
|
||||||
dy: 1
|
dy: 1
|
||||||
});
|
});
|
||||||
deepEqual({ top: helperOffset.top-1, left: helperOffset.left-1 }, origOffset, 'dragged[1, 1] ');
|
deepEqual({ top: helperOffset.top-1, left: helperOffset.left-1 }, origOffset, "dragged[1, 1] ");
|
||||||
|
|
||||||
$("#main").css('position', 'absolute');
|
$("#main").css("position", "absolute");
|
||||||
origOffset = $("#draggable1").offset();
|
origOffset = $("#draggable1").offset();
|
||||||
el.simulate( "drag", {
|
el.simulate( "drag", {
|
||||||
dx: 1,
|
dx: 1,
|
||||||
dy: 1
|
dy: 1
|
||||||
});
|
});
|
||||||
deepEqual({ top: helperOffset.top-1, left: helperOffset.left-1 }, origOffset, 'dragged[1, 1] ');
|
deepEqual({ top: helperOffset.top-1, left: helperOffset.left-1 }, origOffset, "dragged[1, 1] ");
|
||||||
|
|
||||||
TestHelpers.draggable.restoreScroll();
|
TestHelpers.draggable.restoreScroll();
|
||||||
|
|
||||||
@ -576,38 +572,38 @@ test("{ helper: 'clone' }, absolute with scroll offset on root", function() {
|
|||||||
|
|
||||||
expect(3);
|
expect(3);
|
||||||
|
|
||||||
TestHelpers.draggable.setScroll('root');
|
TestHelpers.draggable.setScroll("root");
|
||||||
var helperOffset = null,
|
var helperOffset = null,
|
||||||
origOffset = null,
|
origOffset = null,
|
||||||
el = $("#draggable1").draggable({ helper: "clone", drag: function(event, ui) {
|
el = $("#draggable1").draggable({ helper: "clone", drag: function(event, ui) {
|
||||||
helperOffset = ui.helper.offset();
|
helperOffset = ui.helper.offset();
|
||||||
} });
|
} });
|
||||||
|
|
||||||
$("#main").css('position', 'relative');
|
$("#main").css("position", "relative");
|
||||||
origOffset = $("#draggable1").offset();
|
origOffset = $("#draggable1").offset();
|
||||||
el.simulate( "drag", {
|
el.simulate( "drag", {
|
||||||
dx: 1,
|
dx: 1,
|
||||||
dy: 1
|
dy: 1
|
||||||
});
|
});
|
||||||
deepEqual({ top: helperOffset.top-1, left: helperOffset.left-1 }, origOffset, 'dragged[1, 1] ');
|
deepEqual({ top: helperOffset.top-1, left: helperOffset.left-1 }, origOffset, "dragged[1, 1] ");
|
||||||
|
|
||||||
$("#main").css('position', 'static');
|
$("#main").css("position", "static");
|
||||||
origOffset = $("#draggable1").offset();
|
origOffset = $("#draggable1").offset();
|
||||||
el.simulate( "drag", {
|
el.simulate( "drag", {
|
||||||
dx: 1,
|
dx: 1,
|
||||||
dy: 1
|
dy: 1
|
||||||
});
|
});
|
||||||
deepEqual({ top: helperOffset.top-1, left: helperOffset.left-1 }, origOffset, 'dragged[1, 1] ');
|
deepEqual({ top: helperOffset.top-1, left: helperOffset.left-1 }, origOffset, "dragged[1, 1] ");
|
||||||
|
|
||||||
$("#main").css('position', 'absolute');
|
$("#main").css("position", "absolute");
|
||||||
origOffset = $("#draggable1").offset();
|
origOffset = $("#draggable1").offset();
|
||||||
el.simulate( "drag", {
|
el.simulate( "drag", {
|
||||||
dx: 1,
|
dx: 1,
|
||||||
dy: 1
|
dy: 1
|
||||||
});
|
});
|
||||||
deepEqual({ top: helperOffset.top-1, left: helperOffset.left-1 }, origOffset, 'dragged[1, 1] ');
|
deepEqual({ top: helperOffset.top-1, left: helperOffset.left-1 }, origOffset, "dragged[1, 1] ");
|
||||||
|
|
||||||
TestHelpers.draggable.restoreScroll('root');
|
TestHelpers.draggable.restoreScroll("root");
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -615,7 +611,7 @@ test("{ helper: 'clone' }, absolute with scroll offset on root and parent", func
|
|||||||
|
|
||||||
expect(3);
|
expect(3);
|
||||||
|
|
||||||
TestHelpers.draggable.setScroll('root');
|
TestHelpers.draggable.setScroll("root");
|
||||||
TestHelpers.draggable.setScroll();
|
TestHelpers.draggable.setScroll();
|
||||||
|
|
||||||
var helperOffset = null,
|
var helperOffset = null,
|
||||||
@ -624,31 +620,31 @@ test("{ helper: 'clone' }, absolute with scroll offset on root and parent", func
|
|||||||
helperOffset = ui.helper.offset();
|
helperOffset = ui.helper.offset();
|
||||||
} });
|
} });
|
||||||
|
|
||||||
$("#main").css('position', 'relative');
|
$("#main").css("position", "relative");
|
||||||
origOffset = $("#draggable1").offset();
|
origOffset = $("#draggable1").offset();
|
||||||
el.simulate( "drag", {
|
el.simulate( "drag", {
|
||||||
dx: 1,
|
dx: 1,
|
||||||
dy: 1
|
dy: 1
|
||||||
});
|
});
|
||||||
deepEqual({ top: helperOffset.top-1, left: helperOffset.left-1 }, origOffset, 'dragged[1, 1] ');
|
deepEqual({ top: helperOffset.top-1, left: helperOffset.left-1 }, origOffset, "dragged[1, 1] ");
|
||||||
|
|
||||||
$("#main").css('position', 'static');
|
$("#main").css("position", "static");
|
||||||
origOffset = $("#draggable1").offset();
|
origOffset = $("#draggable1").offset();
|
||||||
el.simulate( "drag", {
|
el.simulate( "drag", {
|
||||||
dx: 1,
|
dx: 1,
|
||||||
dy: 1
|
dy: 1
|
||||||
});
|
});
|
||||||
deepEqual({ top: helperOffset.top-1, left: helperOffset.left-1 }, origOffset, 'dragged[1, 1] ');
|
deepEqual({ top: helperOffset.top-1, left: helperOffset.left-1 }, origOffset, "dragged[1, 1] ");
|
||||||
|
|
||||||
$("#main").css('position', 'absolute');
|
$("#main").css("position", "absolute");
|
||||||
origOffset = $("#draggable1").offset();
|
origOffset = $("#draggable1").offset();
|
||||||
el.simulate( "drag", {
|
el.simulate( "drag", {
|
||||||
dx: 1,
|
dx: 1,
|
||||||
dy: 1
|
dy: 1
|
||||||
});
|
});
|
||||||
deepEqual({ top: helperOffset.top-1, left: helperOffset.left-1 }, origOffset, 'dragged[1, 1] ');
|
deepEqual({ top: helperOffset.top-1, left: helperOffset.left-1 }, origOffset, "dragged[1, 1] ");
|
||||||
|
|
||||||
TestHelpers.draggable.restoreScroll('root');
|
TestHelpers.draggable.restoreScroll("root");
|
||||||
TestHelpers.draggable.restoreScroll();
|
TestHelpers.draggable.restoreScroll();
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@ -15,7 +15,7 @@ TestHelpers.draggable = {
|
|||||||
expected = { left: offsetBefore.left + expectedDX, top: offsetBefore.top + expectedDY };
|
expected = { left: offsetBefore.left + expectedDX, top: offsetBefore.top + expectedDY };
|
||||||
|
|
||||||
msg = msg ? msg + "." : "";
|
msg = msg ? msg + "." : "";
|
||||||
deepEqual(actual, expected, 'dragged[' + dx + ', ' + dy + '] ' + msg);
|
deepEqual(actual, expected, "dragged[" + dx + ", " + dy + "] " + msg);
|
||||||
},
|
},
|
||||||
shouldMove: function(el, why) {
|
shouldMove: function(el, why) {
|
||||||
TestHelpers.draggable.testDrag(el, el, 50, 50, 50, 50, why);
|
TestHelpers.draggable.testDrag(el, el, 50, 50, 50, 50, why);
|
||||||
@ -24,10 +24,10 @@ TestHelpers.draggable = {
|
|||||||
TestHelpers.draggable.testDrag(el, el, 50, 50, 0, 0, why);
|
TestHelpers.draggable.testDrag(el, el, 50, 50, 0, 0, why);
|
||||||
},
|
},
|
||||||
testScroll: function(el, position ) {
|
testScroll: function(el, position ) {
|
||||||
var oldPosition = $("#main").css('position');
|
var oldPosition = $("#main").css("position");
|
||||||
$("#main").css('position', position);
|
$("#main").css("position", position);
|
||||||
TestHelpers.draggable.shouldMove(el, position+' parent');
|
TestHelpers.draggable.shouldMove(el, position+" parent");
|
||||||
$("#main").css('position', oldPosition);
|
$("#main").css("position", oldPosition);
|
||||||
},
|
},
|
||||||
restoreScroll: function( what ) {
|
restoreScroll: function( what ) {
|
||||||
if( what ) {
|
if( what ) {
|
||||||
@ -46,9 +46,9 @@ TestHelpers.draggable = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
border: function(el, side) {
|
border: function(el, side) {
|
||||||
return parseInt(el.css('border-' + side + '-width'), 10) || 0;
|
return parseInt(el.css("border-" + side + "-width"), 10) || 0;
|
||||||
},
|
},
|
||||||
margin: function(el, side) {
|
margin: function(el, side) {
|
||||||
return parseInt(el.css('margin-' + side), 10) || 0;
|
return parseInt(el.css("margin-" + side), 10) || 0;
|
||||||
}
|
}
|
||||||
};
|
};
|
@ -7,18 +7,18 @@
|
|||||||
module("droppable: core");
|
module("droppable: core");
|
||||||
|
|
||||||
test("element types", function() {
|
test("element types", function() {
|
||||||
var typeNames = ('p,h1,h2,h3,h4,h5,h6,blockquote,ol,ul,dl,div,form' +
|
var typeNames = ("p,h1,h2,h3,h4,h5,h6,blockquote,ol,ul,dl,div,form" +
|
||||||
',table,fieldset,address,ins,del,em,strong,q,cite,dfn,abbr' +
|
",table,fieldset,address,ins,del,em,strong,q,cite,dfn,abbr" +
|
||||||
',acronym,code,samp,kbd,var,img,hr' +
|
",acronym,code,samp,kbd,var,img,hr" +
|
||||||
',input,button,label,select,iframe').split(',');
|
",input,button,label,select,iframe").split(",");
|
||||||
|
|
||||||
expect( typeNames.length );
|
expect( typeNames.length );
|
||||||
|
|
||||||
$.each(typeNames, function(i) {
|
$.each(typeNames, function(i) {
|
||||||
var typeName = typeNames[i],
|
var typeName = typeNames[i],
|
||||||
el = $(document.createElement(typeName)).appendTo('body');
|
el = $(document.createElement(typeName)).appendTo("body");
|
||||||
|
|
||||||
(typeName === 'table' && el.append("<tr><td>content</td></tr>"));
|
(typeName === "table" && el.append("<tr><td>content</td></tr>"));
|
||||||
el.droppable();
|
el.droppable();
|
||||||
TestHelpers.droppable.shouldDrop();
|
TestHelpers.droppable.shouldDrop();
|
||||||
el.droppable("destroy");
|
el.droppable("destroy");
|
||||||
|
@ -8,37 +8,37 @@ module("droppable: methods");
|
|||||||
test("init", function() {
|
test("init", function() {
|
||||||
expect( 5 );
|
expect( 5 );
|
||||||
|
|
||||||
$("<div></div>").appendTo('body').droppable().remove();
|
$("<div></div>").appendTo("body").droppable().remove();
|
||||||
ok(true, '.droppable() called on element');
|
ok(true, ".droppable() called on element");
|
||||||
|
|
||||||
$([]).droppable();
|
$([]).droppable();
|
||||||
ok(true, '.droppable() called on empty collection');
|
ok(true, ".droppable() called on empty collection");
|
||||||
|
|
||||||
$("<div></div>").droppable();
|
$("<div></div>").droppable();
|
||||||
ok(true, '.droppable() called on disconnected DOMElement');
|
ok(true, ".droppable() called on disconnected DOMElement");
|
||||||
|
|
||||||
$("<div></div>").droppable().droppable("option", "foo");
|
$("<div></div>").droppable().droppable("option", "foo");
|
||||||
ok(true, 'arbitrary option getter after init');
|
ok(true, "arbitrary option getter after init");
|
||||||
|
|
||||||
$("<div></div>").droppable().droppable("option", "foo", "bar");
|
$("<div></div>").droppable().droppable("option", "foo", "bar");
|
||||||
ok(true, 'arbitrary option setter after init');
|
ok(true, "arbitrary option setter after init");
|
||||||
});
|
});
|
||||||
|
|
||||||
test("destroy", function() {
|
test("destroy", function() {
|
||||||
expect( 4 );
|
expect( 4 );
|
||||||
|
|
||||||
$("<div></div>").appendTo('body').droppable().droppable("destroy").remove();
|
$("<div></div>").appendTo("body").droppable().droppable("destroy").remove();
|
||||||
ok(true, '.droppable("destroy") called on element');
|
ok(true, ".droppable('destroy') called on element");
|
||||||
|
|
||||||
$([]).droppable().droppable("destroy");
|
$([]).droppable().droppable("destroy");
|
||||||
ok(true, '.droppable("destroy") called on empty collection');
|
ok(true, ".droppable('destroy') called on empty collection");
|
||||||
|
|
||||||
$("<div></div>").droppable().droppable("destroy");
|
$("<div></div>").droppable().droppable("destroy");
|
||||||
ok(true, '.droppable("destroy") called on disconnected DOMElement');
|
ok(true, ".droppable('destroy') called on disconnected DOMElement");
|
||||||
|
|
||||||
var expected = $('<div></div>').droppable(),
|
var expected = $("<div></div>").droppable(),
|
||||||
actual = expected.droppable('destroy');
|
actual = expected.droppable("destroy");
|
||||||
equal(actual, expected, 'destroy is chainable');
|
equal(actual, expected, "destroy is chainable");
|
||||||
});
|
});
|
||||||
|
|
||||||
test("enable", function() {
|
test("enable", function() {
|
||||||
@ -58,9 +58,9 @@ test("enable", function() {
|
|||||||
equal(el.droppable("option", "disabled"), false, "disabled option setter");
|
equal(el.droppable("option", "disabled"), false, "disabled option setter");
|
||||||
TestHelpers.droppable.shouldDrop();
|
TestHelpers.droppable.shouldDrop();
|
||||||
|
|
||||||
expected = $('<div></div>').droppable(),
|
expected = $("<div></div>").droppable(),
|
||||||
actual = expected.droppable('enable');
|
actual = expected.droppable("enable");
|
||||||
equal(actual, expected, 'enable is chainable');
|
equal(actual, expected, "enable is chainable");
|
||||||
});
|
});
|
||||||
|
|
||||||
test("disable", function() {
|
test("disable", function() {
|
||||||
@ -80,9 +80,9 @@ test("disable", function() {
|
|||||||
equal(el.droppable("option", "disabled"), true, "disabled option setter");
|
equal(el.droppable("option", "disabled"), true, "disabled option setter");
|
||||||
TestHelpers.droppable.shouldNotDrop();
|
TestHelpers.droppable.shouldNotDrop();
|
||||||
|
|
||||||
expected = $('<div></div>').droppable(),
|
expected = $("<div></div>").droppable(),
|
||||||
actual = expected.droppable('disable');
|
actual = expected.droppable("disable");
|
||||||
equal(actual, expected, 'disable is chainable');
|
equal(actual, expected, "disable is chainable");
|
||||||
});
|
});
|
||||||
|
|
||||||
})(jQuery);
|
})(jQuery);
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
TestHelpers.droppable = {
|
TestHelpers.droppable = {
|
||||||
shouldDrop: function() {
|
shouldDrop: function() {
|
||||||
// todo: actually implement this
|
// todo: actually implement this
|
||||||
ok(true, 'missing test - untested code is broken code');
|
ok(true, "missing test - untested code is broken code");
|
||||||
},
|
},
|
||||||
shouldNotDrop: function() {
|
shouldNotDrop: function() {
|
||||||
// todo: actually implement this
|
// todo: actually implement this
|
||||||
ok(true, 'missing test - untested code is broken code');
|
ok(true, "missing test - untested code is broken code");
|
||||||
}
|
}
|
||||||
};
|
};
|
@ -41,9 +41,12 @@ test( "{ disabled: false }", function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test( "{ icons: default }", function() {
|
test( "{ icons: default }", function() {
|
||||||
expect( 1 );
|
expect( 2 );
|
||||||
var element = $( "#menu2" ).menu();
|
var element = $( "#menu2" ).menu();
|
||||||
equal( element.find( ".ui-menu-icon" ).attr( "class" ), "ui-menu-icon ui-icon ui-icon-carat-1-e" );
|
equal( element.find( ".ui-menu-icon" ).attr( "class" ), "ui-menu-icon ui-icon ui-icon-carat-1-e" );
|
||||||
|
|
||||||
|
element.menu("option", "icons.submenu", "ui-icon-triangle-1-e");
|
||||||
|
equal( element.find( ".ui-menu-icon" ).attr( "class" ), "ui-menu-icon ui-icon ui-icon-triangle-1-e" );
|
||||||
});
|
});
|
||||||
|
|
||||||
test( "{ icons: { submenu: 'custom' } }", function() {
|
test( "{ icons: { submenu: 'custom' } }", function() {
|
||||||
|
@ -96,7 +96,7 @@ QUnit.testDone(function() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
current.getElementsByTagName('a')[0].href = src;
|
current.getElementsByTagName("a")[0].href = src;
|
||||||
});
|
});
|
||||||
|
|
||||||
}( QUnit ) );
|
}( QUnit ) );
|
||||||
|
@ -1,19 +1,19 @@
|
|||||||
TestHelpers.commonWidgetTests('resizable', {
|
TestHelpers.commonWidgetTests("resizable", {
|
||||||
defaults: {
|
defaults: {
|
||||||
alsoResize: false,
|
alsoResize: false,
|
||||||
animate: false,
|
animate: false,
|
||||||
animateDuration: 'slow',
|
animateDuration: "slow",
|
||||||
animateEasing: 'swing',
|
animateEasing: "swing",
|
||||||
aspectRatio: false,
|
aspectRatio: false,
|
||||||
autoHide: false,
|
autoHide: false,
|
||||||
cancel: 'input,textarea,button,select,option',
|
cancel: "input,textarea,button,select,option",
|
||||||
containment: false,
|
containment: false,
|
||||||
delay: 0,
|
delay: 0,
|
||||||
disabled: false,
|
disabled: false,
|
||||||
distance: 1,
|
distance: 1,
|
||||||
ghost: false,
|
ghost: false,
|
||||||
grid: false,
|
grid: false,
|
||||||
handles: 'e,s,se',
|
handles: "e,s,se",
|
||||||
helper: false,
|
helper: false,
|
||||||
maxHeight: null,
|
maxHeight: null,
|
||||||
maxWidth: null,
|
maxWidth: null,
|
||||||
|
@ -8,17 +8,17 @@ module("resizable: core");
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
test("element types", function() {
|
test("element types", function() {
|
||||||
var typeNames = ('p,h1,h2,h3,h4,h5,h6,blockquote,ol,ul,dl,div,form'
|
var typeNames = ("p,h1,h2,h3,h4,h5,h6,blockquote,ol,ul,dl,div,form"
|
||||||
+ ',table,fieldset,address,ins,del,em,strong,q,cite,dfn,abbr'
|
+ ",table,fieldset,address,ins,del,em,strong,q,cite,dfn,abbr"
|
||||||
+ ',acronym,code,samp,kbd,var,img,object,hr'
|
+ ",acronym,code,samp,kbd,var,img,object,hr"
|
||||||
+ ',input,button,label,select,iframe').split(',');
|
+ ",input,button,label,select,iframe").split(",");
|
||||||
|
|
||||||
$.each(typeNames, function(i) {
|
$.each(typeNames, function(i) {
|
||||||
var typeName = typeNames[i];
|
var typeName = typeNames[i];
|
||||||
el = $(document.createElement(typeName)).appendTo('body');
|
el = $(document.createElement(typeName)).appendTo("body");
|
||||||
(typeName == 'table' && el.append("<tr><td>content</td></tr>"));
|
(typeName == "table" && el.append("<tr><td>content</td></tr>"));
|
||||||
el.resizable();
|
el.resizable();
|
||||||
ok(true, '$("<' + typeName + '/>").resizable()');
|
ok(true, "$('<" + typeName + "/>').resizable()");
|
||||||
el.resizable("destroy");
|
el.resizable("destroy");
|
||||||
el.remove();
|
el.remove();
|
||||||
});
|
});
|
||||||
@ -28,7 +28,7 @@ test("element types", function() {
|
|||||||
test("n", function() {
|
test("n", function() {
|
||||||
expect(4);
|
expect(4);
|
||||||
|
|
||||||
var handle = '.ui-resizable-n', target = $('#resizable1').resizable({ handles: 'all' });
|
var handle = ".ui-resizable-n", target = $("#resizable1").resizable({ handles: "all" });
|
||||||
|
|
||||||
TestHelpers.resizable.drag(handle, 0, -50);
|
TestHelpers.resizable.drag(handle, 0, -50);
|
||||||
equal( target.height(), 150, "compare height" );
|
equal( target.height(), 150, "compare height" );
|
||||||
@ -43,7 +43,7 @@ test("n", function() {
|
|||||||
test("s", function() {
|
test("s", function() {
|
||||||
expect(5);
|
expect(5);
|
||||||
|
|
||||||
var handle = '.ui-resizable-s', target = $('#resizable1').resizable({ handles: 'all' });
|
var handle = ".ui-resizable-s", target = $("#resizable1").resizable({ handles: "all" });
|
||||||
|
|
||||||
TestHelpers.resizable.drag(handle, 0, 50);
|
TestHelpers.resizable.drag(handle, 0, 50);
|
||||||
equal( target.height(), 150, "compare height" );
|
equal( target.height(), 150, "compare height" );
|
||||||
@ -59,7 +59,7 @@ test("s", function() {
|
|||||||
test("e", function() {
|
test("e", function() {
|
||||||
expect(5);
|
expect(5);
|
||||||
|
|
||||||
var handle = '.ui-resizable-e', target = $('#resizable1').resizable({ handles: 'all' });
|
var handle = ".ui-resizable-e", target = $("#resizable1").resizable({ handles: "all" });
|
||||||
|
|
||||||
TestHelpers.resizable.drag(handle, 50);
|
TestHelpers.resizable.drag(handle, 50);
|
||||||
equal( target.width(), 150, "compare width");
|
equal( target.width(), 150, "compare width");
|
||||||
@ -75,7 +75,7 @@ test("e", function() {
|
|||||||
test("w", function() {
|
test("w", function() {
|
||||||
expect(4);
|
expect(4);
|
||||||
|
|
||||||
var handle = '.ui-resizable-w', target = $('#resizable1').resizable({ handles: 'all' });
|
var handle = ".ui-resizable-w", target = $("#resizable1").resizable({ handles: "all" });
|
||||||
|
|
||||||
TestHelpers.resizable.drag(handle, -50);
|
TestHelpers.resizable.drag(handle, -50);
|
||||||
equal( target.width(), 150, "compare width" );
|
equal( target.width(), 150, "compare width" );
|
||||||
@ -90,7 +90,7 @@ test("w", function() {
|
|||||||
test("ne", function() {
|
test("ne", function() {
|
||||||
expect(5);
|
expect(5);
|
||||||
|
|
||||||
var handle = '.ui-resizable-ne', target = $('#resizable1').css({ overflow: 'hidden' }).resizable({ handles: 'all' });
|
var handle = ".ui-resizable-ne", target = $("#resizable1").css({ overflow: "hidden" }).resizable({ handles: "all" });
|
||||||
|
|
||||||
TestHelpers.resizable.drag(handle, -50, -50);
|
TestHelpers.resizable.drag(handle, -50, -50);
|
||||||
equal( target.width(), 50, "compare width" );
|
equal( target.width(), 50, "compare width" );
|
||||||
@ -106,7 +106,7 @@ test("ne", function() {
|
|||||||
test("se", function() {
|
test("se", function() {
|
||||||
expect(6);
|
expect(6);
|
||||||
|
|
||||||
var handle = '.ui-resizable-se', target = $('#resizable1').resizable({ handles: 'all' });
|
var handle = ".ui-resizable-se", target = $("#resizable1").resizable({ handles: "all" });
|
||||||
|
|
||||||
TestHelpers.resizable.drag(handle, 50, 50);
|
TestHelpers.resizable.drag(handle, 50, 50);
|
||||||
equal( target.width(), 150, "compare width" );
|
equal( target.width(), 150, "compare width" );
|
||||||
@ -123,7 +123,7 @@ test("se", function() {
|
|||||||
test("sw", function() {
|
test("sw", function() {
|
||||||
expect(5);
|
expect(5);
|
||||||
|
|
||||||
var handle = '.ui-resizable-sw', target = $('#resizable1').resizable({ handles: 'all' });
|
var handle = ".ui-resizable-sw", target = $("#resizable1").resizable({ handles: "all" });
|
||||||
|
|
||||||
TestHelpers.resizable.drag(handle, -50, -50);
|
TestHelpers.resizable.drag(handle, -50, -50);
|
||||||
equal( target.width(), 150, "compare width" );
|
equal( target.width(), 150, "compare width" );
|
||||||
@ -139,7 +139,7 @@ test("sw", function() {
|
|||||||
test("nw", function() {
|
test("nw", function() {
|
||||||
expect(4);
|
expect(4);
|
||||||
|
|
||||||
var handle = '.ui-resizable-nw', target = $('#resizable1').resizable({ handles: 'all' });
|
var handle = ".ui-resizable-nw", target = $("#resizable1").resizable({ handles: "all" });
|
||||||
|
|
||||||
TestHelpers.resizable.drag(handle, -50, -50);
|
TestHelpers.resizable.drag(handle, -50, -50);
|
||||||
equal( target.width(), 150, "compare width" );
|
equal( target.width(), 150, "compare width" );
|
||||||
@ -153,15 +153,15 @@ test("nw", function() {
|
|||||||
test("handle with complex markup (#8756)", function() {
|
test("handle with complex markup (#8756)", function() {
|
||||||
expect(2);
|
expect(2);
|
||||||
|
|
||||||
$('#resizable1')
|
$("#resizable1")
|
||||||
.append(
|
.append(
|
||||||
$('<div>')
|
$("<div>")
|
||||||
.addClass("ui-resizable-handle")
|
.addClass("ui-resizable-handle")
|
||||||
.addClass("ui-resizable-w")
|
.addClass("ui-resizable-w")
|
||||||
.append($('<div>'))
|
.append($("<div>"))
|
||||||
);
|
);
|
||||||
|
|
||||||
var handle = '.ui-resizable-w div', target = $('#resizable1').resizable({ handles: 'all' });
|
var handle = ".ui-resizable-w div", target = $("#resizable1").resizable({ handles: "all" });
|
||||||
|
|
||||||
TestHelpers.resizable.drag(handle, -50);
|
TestHelpers.resizable.drag(handle, -50);
|
||||||
equal( target.width(), 150, "compare width" );
|
equal( target.width(), 150, "compare width" );
|
||||||
@ -176,7 +176,7 @@ test("resizable accounts for scroll position correctly (#3815)", function() {
|
|||||||
var position, top, left,
|
var position, top, left,
|
||||||
container = $("<div style='overflow:scroll;height:300px;width:300px;position:relative;'></div>").appendTo("#qunit-fixture"),
|
container = $("<div style='overflow:scroll;height:300px;width:300px;position:relative;'></div>").appendTo("#qunit-fixture"),
|
||||||
overflowed = $("<div style='width: 1000px; height: 1000px;'></div>").appendTo( container ),
|
overflowed = $("<div style='width: 1000px; height: 1000px;'></div>").appendTo( container ),
|
||||||
el = $("<div style='height:100px;width:100px;position:absolute;top:10px;left:10px;'></div>").appendTo( overflowed ).resizable({ handles: 'all' }),
|
el = $("<div style='height:100px;width:100px;position:absolute;top:10px;left:10px;'></div>").appendTo( overflowed ).resizable({ handles: "all" }),
|
||||||
handle = ".ui-resizable-e";
|
handle = ".ui-resizable-e";
|
||||||
|
|
||||||
container.scrollLeft( 100 ).scrollTop( 100 );
|
container.scrollLeft( 100 ).scrollTop( 100 );
|
||||||
|
@ -28,7 +28,7 @@ test( "alsoResize", function() {
|
|||||||
test("aspectRatio: 'preserve' (e)", function() {
|
test("aspectRatio: 'preserve' (e)", function() {
|
||||||
expect(4);
|
expect(4);
|
||||||
|
|
||||||
var handle = '.ui-resizable-e', target = $('#resizable1').resizable({ aspectRatio: 'preserve', handles: 'all', minWidth: 70, minHeight: 50, maxWidth: 150, maxHeight: 130 });
|
var handle = ".ui-resizable-e", target = $("#resizable1").resizable({ aspectRatio: "preserve", handles: "all", minWidth: 70, minHeight: 50, maxWidth: 150, maxHeight: 130 });
|
||||||
|
|
||||||
TestHelpers.resizable.drag(handle, 80);
|
TestHelpers.resizable.drag(handle, 80);
|
||||||
equal( target.width(), 130, "compare maxWidth");
|
equal( target.width(), 130, "compare maxWidth");
|
||||||
@ -42,7 +42,7 @@ test("aspectRatio: 'preserve' (e)", function() {
|
|||||||
test("aspectRatio: 'preserve' (w)", function() {
|
test("aspectRatio: 'preserve' (w)", function() {
|
||||||
expect(4);
|
expect(4);
|
||||||
|
|
||||||
var handle = '.ui-resizable-w', target = $('#resizable1').resizable({ aspectRatio: 'preserve', handles: 'all', minWidth: 70, minHeight: 50, maxWidth: 150, maxHeight: 130 });
|
var handle = ".ui-resizable-w", target = $("#resizable1").resizable({ aspectRatio: "preserve", handles: "all", minWidth: 70, minHeight: 50, maxWidth: 150, maxHeight: 130 });
|
||||||
|
|
||||||
TestHelpers.resizable.drag(handle, -80);
|
TestHelpers.resizable.drag(handle, -80);
|
||||||
equal( target.width(), 130, "compare maxWidth");
|
equal( target.width(), 130, "compare maxWidth");
|
||||||
@ -56,7 +56,7 @@ test("aspectRatio: 'preserve' (w)", function() {
|
|||||||
test("aspectRatio: 'preserve' (n)", function() {
|
test("aspectRatio: 'preserve' (n)", function() {
|
||||||
expect(4);
|
expect(4);
|
||||||
|
|
||||||
var handle = '.ui-resizable-n', target = $('#resizable1').resizable({ aspectRatio: 'preserve', handles: 'all', minWidth: 70, minHeight: 50, maxWidth: 150, maxHeight: 130 });
|
var handle = ".ui-resizable-n", target = $("#resizable1").resizable({ aspectRatio: "preserve", handles: "all", minWidth: 70, minHeight: 50, maxWidth: 150, maxHeight: 130 });
|
||||||
|
|
||||||
TestHelpers.resizable.drag(handle, 0, -80);
|
TestHelpers.resizable.drag(handle, 0, -80);
|
||||||
equal( target.width(), 130, "compare maxWidth");
|
equal( target.width(), 130, "compare maxWidth");
|
||||||
@ -70,7 +70,7 @@ test("aspectRatio: 'preserve' (n)", function() {
|
|||||||
test("aspectRatio: 'preserve' (s)", function() {
|
test("aspectRatio: 'preserve' (s)", function() {
|
||||||
expect(4);
|
expect(4);
|
||||||
|
|
||||||
var handle = '.ui-resizable-s', target = $('#resizable1').resizable({ aspectRatio: 'preserve', handles: 'all', minWidth: 70, minHeight: 50, maxWidth: 150, maxHeight: 130 });
|
var handle = ".ui-resizable-s", target = $("#resizable1").resizable({ aspectRatio: "preserve", handles: "all", minWidth: 70, minHeight: 50, maxWidth: 150, maxHeight: 130 });
|
||||||
|
|
||||||
TestHelpers.resizable.drag(handle, 0, 80);
|
TestHelpers.resizable.drag(handle, 0, 80);
|
||||||
equal( target.width(), 130, "compare maxWidth");
|
equal( target.width(), 130, "compare maxWidth");
|
||||||
@ -84,7 +84,7 @@ test("aspectRatio: 'preserve' (s)", function() {
|
|||||||
test("aspectRatio: 'preserve' (se)", function() {
|
test("aspectRatio: 'preserve' (se)", function() {
|
||||||
expect(4);
|
expect(4);
|
||||||
|
|
||||||
var handle = '.ui-resizable-se', target = $('#resizable1').resizable({ aspectRatio: 'preserve', handles: 'all', minWidth: 70, minHeight: 50, maxWidth: 150, maxHeight: 130 });
|
var handle = ".ui-resizable-se", target = $("#resizable1").resizable({ aspectRatio: "preserve", handles: "all", minWidth: 70, minHeight: 50, maxWidth: 150, maxHeight: 130 });
|
||||||
|
|
||||||
TestHelpers.resizable.drag(handle, 80, 80);
|
TestHelpers.resizable.drag(handle, 80, 80);
|
||||||
equal( target.width(), 130, "compare maxWidth");
|
equal( target.width(), 130, "compare maxWidth");
|
||||||
@ -98,7 +98,7 @@ test("aspectRatio: 'preserve' (se)", function() {
|
|||||||
test("aspectRatio: 'preserve' (sw)", function() {
|
test("aspectRatio: 'preserve' (sw)", function() {
|
||||||
expect(4);
|
expect(4);
|
||||||
|
|
||||||
var handle = '.ui-resizable-sw', target = $('#resizable1').resizable({ aspectRatio: 'preserve', handles: 'all', minWidth: 70, minHeight: 50, maxWidth: 150, maxHeight: 130 });
|
var handle = ".ui-resizable-sw", target = $("#resizable1").resizable({ aspectRatio: "preserve", handles: "all", minWidth: 70, minHeight: 50, maxWidth: 150, maxHeight: 130 });
|
||||||
|
|
||||||
TestHelpers.resizable.drag(handle, -80, 80);
|
TestHelpers.resizable.drag(handle, -80, 80);
|
||||||
equal( target.width(), 130, "compare maxWidth");
|
equal( target.width(), 130, "compare maxWidth");
|
||||||
@ -112,7 +112,7 @@ test("aspectRatio: 'preserve' (sw)", function() {
|
|||||||
test("aspectRatio: 'preserve' (ne)", function() {
|
test("aspectRatio: 'preserve' (ne)", function() {
|
||||||
expect(4);
|
expect(4);
|
||||||
|
|
||||||
var handle = '.ui-resizable-ne', target = $('#resizable1').resizable({ aspectRatio: 'preserve', handles: 'all', minWidth: 70, minHeight: 50, maxWidth: 150, maxHeight: 130 });
|
var handle = ".ui-resizable-ne", target = $("#resizable1").resizable({ aspectRatio: "preserve", handles: "all", minWidth: 70, minHeight: 50, maxWidth: 150, maxHeight: 130 });
|
||||||
|
|
||||||
TestHelpers.resizable.drag(handle, 80, -80);
|
TestHelpers.resizable.drag(handle, 80, -80);
|
||||||
equal( target.width(), 130, "compare maxWidth");
|
equal( target.width(), 130, "compare maxWidth");
|
||||||
@ -141,7 +141,7 @@ test( "containment", function() {
|
|||||||
test("grid", function() {
|
test("grid", function() {
|
||||||
expect(4);
|
expect(4);
|
||||||
|
|
||||||
var handle = '.ui-resizable-se', target = $('#resizable1').resizable({ handles: 'all', grid: [0, 20] });
|
var handle = ".ui-resizable-se", target = $("#resizable1").resizable({ handles: "all", grid: [0, 20] });
|
||||||
|
|
||||||
TestHelpers.resizable.drag(handle, 3, 9);
|
TestHelpers.resizable.drag(handle, 3, 9);
|
||||||
equal( target.width(), 103, "compare width");
|
equal( target.width(), 103, "compare width");
|
||||||
@ -169,7 +169,7 @@ test("grid (min/max dimensions)", function() {
|
|||||||
test("grid (wrapped)", function() {
|
test("grid (wrapped)", function() {
|
||||||
expect(4);
|
expect(4);
|
||||||
|
|
||||||
var handle = '.ui-resizable-se', target = $('#resizable2').resizable({ handles: 'all', grid: [0, 20] });
|
var handle = ".ui-resizable-se", target = $("#resizable2").resizable({ handles: "all", grid: [0, 20] });
|
||||||
|
|
||||||
TestHelpers.resizable.drag(handle, 3, 9);
|
TestHelpers.resizable.drag(handle, 3, 9);
|
||||||
equal( target.width(), 103, "compare width");
|
equal( target.width(), 103, "compare width");
|
||||||
@ -183,7 +183,7 @@ test("grid (wrapped)", function() {
|
|||||||
test("ui-resizable-se { handles: 'all', minWidth: 60, minHeight: 60, maxWidth: 100, maxHeight: 100 }", function() {
|
test("ui-resizable-se { handles: 'all', minWidth: 60, minHeight: 60, maxWidth: 100, maxHeight: 100 }", function() {
|
||||||
expect(4);
|
expect(4);
|
||||||
|
|
||||||
var handle = '.ui-resizable-se', target = $('#resizable1').resizable({ handles: 'all', minWidth: 60, minHeight: 60, maxWidth: 100, maxHeight: 100 });
|
var handle = ".ui-resizable-se", target = $("#resizable1").resizable({ handles: "all", minWidth: 60, minHeight: 60, maxWidth: 100, maxHeight: 100 });
|
||||||
|
|
||||||
TestHelpers.resizable.drag(handle, -50, -50);
|
TestHelpers.resizable.drag(handle, -50, -50);
|
||||||
equal( target.width(), 60, "compare minWidth" );
|
equal( target.width(), 60, "compare minWidth" );
|
||||||
@ -197,7 +197,7 @@ test("ui-resizable-se { handles: 'all', minWidth: 60, minHeight: 60, maxWidth: 1
|
|||||||
test("ui-resizable-sw { handles: 'all', minWidth: 60, minHeight: 60, maxWidth: 100, maxHeight: 100 }", function() {
|
test("ui-resizable-sw { handles: 'all', minWidth: 60, minHeight: 60, maxWidth: 100, maxHeight: 100 }", function() {
|
||||||
expect(4);
|
expect(4);
|
||||||
|
|
||||||
var handle = '.ui-resizable-sw', target = $('#resizable1').resizable({ handles: 'all', minWidth: 60, minHeight: 60, maxWidth: 100, maxHeight: 100 });
|
var handle = ".ui-resizable-sw", target = $("#resizable1").resizable({ handles: "all", minWidth: 60, minHeight: 60, maxWidth: 100, maxHeight: 100 });
|
||||||
|
|
||||||
TestHelpers.resizable.drag(handle, 50, -50);
|
TestHelpers.resizable.drag(handle, 50, -50);
|
||||||
equal( target.width(), 60, "compare minWidth" );
|
equal( target.width(), 60, "compare minWidth" );
|
||||||
@ -211,7 +211,7 @@ test("ui-resizable-sw { handles: 'all', minWidth: 60, minHeight: 60, maxWidth: 1
|
|||||||
test("ui-resizable-ne { handles: 'all', minWidth: 60, minHeight: 60, maxWidth: 100, maxHeight: 100 }", function() {
|
test("ui-resizable-ne { handles: 'all', minWidth: 60, minHeight: 60, maxWidth: 100, maxHeight: 100 }", function() {
|
||||||
expect(4);
|
expect(4);
|
||||||
|
|
||||||
var handle = '.ui-resizable-ne', target = $('#resizable1').resizable({ handles: 'all', minWidth: 60, minHeight: 60, maxWidth: 100, maxHeight: 100 });
|
var handle = ".ui-resizable-ne", target = $("#resizable1").resizable({ handles: "all", minWidth: 60, minHeight: 60, maxWidth: 100, maxHeight: 100 });
|
||||||
|
|
||||||
TestHelpers.resizable.drag(handle, -50, 50);
|
TestHelpers.resizable.drag(handle, -50, 50);
|
||||||
equal( target.width(), 60, "compare minWidth" );
|
equal( target.width(), 60, "compare minWidth" );
|
||||||
@ -225,7 +225,7 @@ test("ui-resizable-ne { handles: 'all', minWidth: 60, minHeight: 60, maxWidth: 1
|
|||||||
test("ui-resizable-nw { handles: 'all', minWidth: 60, minHeight: 60, maxWidth: 100, maxHeight: 100 }", function() {
|
test("ui-resizable-nw { handles: 'all', minWidth: 60, minHeight: 60, maxWidth: 100, maxHeight: 100 }", function() {
|
||||||
expect(4);
|
expect(4);
|
||||||
|
|
||||||
var handle = '.ui-resizable-nw', target = $('#resizable1').resizable({ handles: 'all', minWidth: 60, minHeight: 60, maxWidth: 100, maxHeight: 100 });
|
var handle = ".ui-resizable-nw", target = $("#resizable1").resizable({ handles: "all", minWidth: 60, minHeight: 60, maxWidth: 100, maxHeight: 100 });
|
||||||
|
|
||||||
TestHelpers.resizable.drag(handle, 70, 70);
|
TestHelpers.resizable.drag(handle, 70, 70);
|
||||||
equal( target.width(), 60, "compare minWidth" );
|
equal( target.width(), 60, "compare minWidth" );
|
||||||
@ -239,9 +239,9 @@ test("ui-resizable-nw { handles: 'all', minWidth: 60, minHeight: 60, maxWidth: 1
|
|||||||
test("zIndex, applied to all handles", function() {
|
test("zIndex, applied to all handles", function() {
|
||||||
expect(8);
|
expect(8);
|
||||||
|
|
||||||
var target = $('<div></div>').resizable({ handles: 'all', zIndex: 100 });
|
var target = $("<div></div>").resizable({ handles: "all", zIndex: 100 });
|
||||||
target.children( '.ui-resizable-handle' ).each( function( index, handle ) {
|
target.children( ".ui-resizable-handle" ).each( function( index, handle ) {
|
||||||
equal( $( handle ).css( 'zIndex' ), 100, 'compare zIndex' );
|
equal( $( handle ).css( "zIndex" ), 100, "compare zIndex" );
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -26,7 +26,6 @@
|
|||||||
<script src="selectable_events.js"></script>
|
<script src="selectable_events.js"></script>
|
||||||
<script src="selectable_methods.js"></script>
|
<script src="selectable_methods.js"></script>
|
||||||
<script src="selectable_options.js"></script>
|
<script src="selectable_options.js"></script>
|
||||||
<script src="selectable_test_helpers.js"></script>
|
|
||||||
|
|
||||||
<script src="../swarminject.js"></script>
|
<script src="../swarminject.js"></script>
|
||||||
</head>
|
</head>
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
TestHelpers.commonWidgetTests('selectable', {
|
TestHelpers.commonWidgetTests("selectable", {
|
||||||
defaults: {
|
defaults: {
|
||||||
appendTo: 'body',
|
appendTo: "body",
|
||||||
autoRefresh: true,
|
autoRefresh: true,
|
||||||
cancel: 'input,textarea,button,select,option',
|
cancel: "input,textarea,button,select,option",
|
||||||
create: null,
|
create: null,
|
||||||
delay: 0,
|
delay: 0,
|
||||||
disabled: false,
|
disabled: false,
|
||||||
distance: 0,
|
distance: 0,
|
||||||
filter: '*',
|
filter: "*",
|
||||||
tolerance: 'touch'
|
tolerance: "touch"
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -35,4 +35,32 @@ test( "stop", function() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test( "mousedown: initial position of helper", function() {
|
||||||
|
expect( 2 );
|
||||||
|
|
||||||
|
var contentToForceScroll, helper,
|
||||||
|
element = $("#selectable1").selectable();
|
||||||
|
|
||||||
|
contentToForceScroll = $("<div>").css({
|
||||||
|
height: "10000px",
|
||||||
|
width: "10000px"
|
||||||
|
});
|
||||||
|
|
||||||
|
contentToForceScroll.appendTo("body");
|
||||||
|
$( window ).scrollTop( 1 ).scrollLeft( 1 );
|
||||||
|
element.simulate( "mousedown", {
|
||||||
|
clientX: 10,
|
||||||
|
clientY: 10
|
||||||
|
});
|
||||||
|
|
||||||
|
helper = $(".ui-selectable-helper");
|
||||||
|
equal( helper.css("top"), "11px", "Scroll top should be accounted for." );
|
||||||
|
equal( helper.css("left"), "11px", "Scroll left should be accounted for." );
|
||||||
|
|
||||||
|
// Cleanup
|
||||||
|
element.simulate("mouseup");
|
||||||
|
contentToForceScroll.remove();
|
||||||
|
$( window ).scrollTop( 0 ).scrollLeft( 0 );
|
||||||
|
});
|
||||||
|
|
||||||
})( jQuery );
|
})( jQuery );
|
||||||
|
@ -8,39 +8,39 @@ module("selectable: methods");
|
|||||||
test("init", function() {
|
test("init", function() {
|
||||||
expect( 5 );
|
expect( 5 );
|
||||||
|
|
||||||
$("<div></div>").appendTo('body').selectable().remove();
|
$("<div></div>").appendTo("body").selectable().remove();
|
||||||
ok(true, '.selectable() called on element');
|
ok(true, ".selectable() called on element");
|
||||||
|
|
||||||
$([]).selectable().remove();
|
$([]).selectable().remove();
|
||||||
ok(true, '.selectable() called on empty collection');
|
ok(true, ".selectable() called on empty collection");
|
||||||
|
|
||||||
$("<div></div>").selectable().remove();
|
$("<div></div>").selectable().remove();
|
||||||
ok(true, '.selectable() called on disconnected DOMElement');
|
ok(true, ".selectable() called on disconnected DOMElement");
|
||||||
|
|
||||||
var el = $("<div></div>").selectable();
|
var el = $("<div></div>").selectable();
|
||||||
el.selectable("option", "foo");
|
el.selectable("option", "foo");
|
||||||
el.remove();
|
el.remove();
|
||||||
ok(true, 'arbitrary option getter after init');
|
ok(true, "arbitrary option getter after init");
|
||||||
|
|
||||||
$("<div></div>").selectable().selectable("option", "foo", "bar").remove();
|
$("<div></div>").selectable().selectable("option", "foo", "bar").remove();
|
||||||
ok(true, 'arbitrary option setter after init');
|
ok(true, "arbitrary option setter after init");
|
||||||
});
|
});
|
||||||
|
|
||||||
test("destroy", function() {
|
test("destroy", function() {
|
||||||
expect( 4 );
|
expect( 4 );
|
||||||
|
|
||||||
$("<div></div>").appendTo('body').selectable().selectable("destroy").remove();
|
$("<div></div>").appendTo("body").selectable().selectable("destroy").remove();
|
||||||
ok(true, '.selectable("destroy") called on element');
|
ok(true, ".selectable('destroy') called on element");
|
||||||
|
|
||||||
$([]).selectable().selectable("destroy").remove();
|
$([]).selectable().selectable("destroy").remove();
|
||||||
ok(true, '.selectable("destroy") called on empty collection');
|
ok(true, ".selectable('destroy') called on empty collection");
|
||||||
|
|
||||||
$("<div></div>").selectable().selectable("destroy").remove();
|
$("<div></div>").selectable().selectable("destroy").remove();
|
||||||
ok(true, '.selectable("destroy") called on disconnected DOMElement');
|
ok(true, ".selectable('destroy') called on disconnected DOMElement");
|
||||||
|
|
||||||
var expected = $('<div></div>').selectable(),
|
var expected = $("<div></div>").selectable(),
|
||||||
actual = expected.selectable('destroy');
|
actual = expected.selectable("destroy");
|
||||||
equal(actual, expected, 'destroy is chainable');
|
equal(actual, expected, "destroy is chainable");
|
||||||
});
|
});
|
||||||
|
|
||||||
test("enable", function() {
|
test("enable", function() {
|
||||||
@ -66,9 +66,9 @@ test("enable", function() {
|
|||||||
equal(fired, true, "start fired");
|
equal(fired, true, "start fired");
|
||||||
el.selectable("destroy");
|
el.selectable("destroy");
|
||||||
|
|
||||||
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() {
|
||||||
@ -96,9 +96,9 @@ test("disable", function() {
|
|||||||
equal(fired, false, "start fired");
|
equal(fired, false, "start fired");
|
||||||
el.selectable("destroy");
|
el.selectable("destroy");
|
||||||
|
|
||||||
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");
|
||||||
});
|
});
|
||||||
|
|
||||||
})(jQuery);
|
})(jQuery);
|
||||||
|
@ -52,7 +52,7 @@ test("filter", function() {
|
|||||||
selected = function() { actual += 1; };
|
selected = function() { actual += 1; };
|
||||||
|
|
||||||
|
|
||||||
el = $("#selectable1").selectable({ filter: '.special', selected: selected });
|
el = $("#selectable1").selectable({ filter: ".special", selected: selected });
|
||||||
el.simulate( "drag", {
|
el.simulate( "drag", {
|
||||||
dx: 1000,
|
dx: 1000,
|
||||||
dy: 1000
|
dy: 1000
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
TestHelpers.commonWidgetTests( "slider", {
|
TestHelpers.commonWidgetTests( "slider", {
|
||||||
defaults: {
|
defaults: {
|
||||||
animate: false,
|
animate: false,
|
||||||
cancel: 'input,textarea,button,select,option',
|
cancel: "input,textarea,button,select,option",
|
||||||
delay: 0,
|
delay: 0,
|
||||||
disabled: false,
|
disabled: false,
|
||||||
distance: 0,
|
distance: 0,
|
||||||
max: 100,
|
max: 100,
|
||||||
min: 0,
|
min: 0,
|
||||||
orientation: 'horizontal',
|
orientation: "horizontal",
|
||||||
range: false,
|
range: false,
|
||||||
step: 1,
|
step: 1,
|
||||||
value: 0,
|
value: 0,
|
||||||
|
@ -17,11 +17,11 @@ module("slider: core");
|
|||||||
|
|
||||||
test("keydown HOME on handle sets value to min", function() {
|
test("keydown HOME on handle sets value to min", function() {
|
||||||
expect( 2 );
|
expect( 2 );
|
||||||
el = $('<div></div>');
|
el = $("<div></div>");
|
||||||
options = {
|
options = {
|
||||||
max: 5,
|
max: 5,
|
||||||
min: -5,
|
min: -5,
|
||||||
orientation: 'horizontal',
|
orientation: "horizontal",
|
||||||
step: 1
|
step: 1
|
||||||
};
|
};
|
||||||
el.slider(options);
|
el.slider(options);
|
||||||
@ -31,13 +31,13 @@ test("keydown HOME on handle sets value to min", function() {
|
|||||||
handle().simulate("keydown", { keyCode: $.ui.keyCode.HOME });
|
handle().simulate("keydown", { keyCode: $.ui.keyCode.HOME });
|
||||||
equal(el.slider("value"), options.min);
|
equal(el.slider("value"), options.min);
|
||||||
|
|
||||||
el.slider('destroy');
|
el.slider("destroy");
|
||||||
|
|
||||||
el = $('<div></div>');
|
el = $("<div></div>");
|
||||||
options = {
|
options = {
|
||||||
max: 5,
|
max: 5,
|
||||||
min: -5,
|
min: -5,
|
||||||
orientation: 'vertical',
|
orientation: "vertical",
|
||||||
step: 1
|
step: 1
|
||||||
};
|
};
|
||||||
el.slider(options);
|
el.slider(options);
|
||||||
@ -47,16 +47,16 @@ test("keydown HOME on handle sets value to min", function() {
|
|||||||
handle().simulate("keydown", { keyCode: $.ui.keyCode.HOME });
|
handle().simulate("keydown", { keyCode: $.ui.keyCode.HOME });
|
||||||
equal(el.slider("value"), options.min);
|
equal(el.slider("value"), options.min);
|
||||||
|
|
||||||
el.slider('destroy');
|
el.slider("destroy");
|
||||||
});
|
});
|
||||||
|
|
||||||
test("keydown END on handle sets value to max", function() {
|
test("keydown END on handle sets value to max", function() {
|
||||||
expect( 2 );
|
expect( 2 );
|
||||||
el = $('<div></div>');
|
el = $("<div></div>");
|
||||||
options = {
|
options = {
|
||||||
max: 5,
|
max: 5,
|
||||||
min: -5,
|
min: -5,
|
||||||
orientation: 'horizontal',
|
orientation: "horizontal",
|
||||||
step: 1
|
step: 1
|
||||||
};
|
};
|
||||||
el.slider(options);
|
el.slider(options);
|
||||||
@ -66,13 +66,13 @@ test("keydown END on handle sets value to max", function() {
|
|||||||
handle().simulate("keydown", { keyCode: $.ui.keyCode.END });
|
handle().simulate("keydown", { keyCode: $.ui.keyCode.END });
|
||||||
equal(el.slider("value"), options.max);
|
equal(el.slider("value"), options.max);
|
||||||
|
|
||||||
el.slider('destroy');
|
el.slider("destroy");
|
||||||
|
|
||||||
el = $('<div></div>');
|
el = $("<div></div>");
|
||||||
options = {
|
options = {
|
||||||
max: 5,
|
max: 5,
|
||||||
min: -5,
|
min: -5,
|
||||||
orientation: 'vertical',
|
orientation: "vertical",
|
||||||
step: 1
|
step: 1
|
||||||
};
|
};
|
||||||
el.slider(options);
|
el.slider(options);
|
||||||
@ -82,13 +82,13 @@ test("keydown END on handle sets value to max", function() {
|
|||||||
handle().simulate("keydown", { keyCode: $.ui.keyCode.END });
|
handle().simulate("keydown", { keyCode: $.ui.keyCode.END });
|
||||||
equal(el.slider("value"), options.max);
|
equal(el.slider("value"), options.max);
|
||||||
|
|
||||||
el.slider('destroy');
|
el.slider("destroy");
|
||||||
});
|
});
|
||||||
|
|
||||||
test("keydown PAGE_UP on handle increases value by 1/5 range, not greater than max", function() {
|
test("keydown PAGE_UP on handle increases value by 1/5 range, not greater than max", function() {
|
||||||
expect( 4 );
|
expect( 4 );
|
||||||
$.each(['horizontal', 'vertical'], function(i, orientation) {
|
$.each(["horizontal", "vertical"], function(i, orientation) {
|
||||||
el = $('<div></div>');
|
el = $("<div></div>");
|
||||||
options = {
|
options = {
|
||||||
max: 100,
|
max: 100,
|
||||||
min: 0,
|
min: 0,
|
||||||
@ -111,8 +111,8 @@ test("keydown PAGE_UP on handle increases value by 1/5 range, not greater than m
|
|||||||
|
|
||||||
test("keydown PAGE_DOWN on handle decreases value by 1/5 range, not less than min", function() {
|
test("keydown PAGE_DOWN on handle decreases value by 1/5 range, not less than min", function() {
|
||||||
expect( 4 );
|
expect( 4 );
|
||||||
$.each(['horizontal', 'vertical'], function(i, orientation) {
|
$.each(["horizontal", "vertical"], function(i, orientation) {
|
||||||
el = $('<div></div>');
|
el = $("<div></div>");
|
||||||
options = {
|
options = {
|
||||||
max: 100,
|
max: 100,
|
||||||
min: 0,
|
min: 0,
|
||||||
@ -135,11 +135,11 @@ test("keydown PAGE_DOWN on handle decreases value by 1/5 range, not less than mi
|
|||||||
|
|
||||||
test("keydown UP on handle increases value by step, not greater than max", function() {
|
test("keydown UP on handle increases value by step, not greater than max", function() {
|
||||||
expect( 4 );
|
expect( 4 );
|
||||||
el = $('<div></div>');
|
el = $("<div></div>");
|
||||||
options = {
|
options = {
|
||||||
max: 5,
|
max: 5,
|
||||||
min: -5,
|
min: -5,
|
||||||
orientation: 'horizontal',
|
orientation: "horizontal",
|
||||||
step: 1
|
step: 1
|
||||||
};
|
};
|
||||||
el.slider(options);
|
el.slider(options);
|
||||||
@ -154,11 +154,11 @@ test("keydown UP on handle increases value by step, not greater than max", funct
|
|||||||
|
|
||||||
el.slider("destroy");
|
el.slider("destroy");
|
||||||
|
|
||||||
el = $('<div></div>');
|
el = $("<div></div>");
|
||||||
options = {
|
options = {
|
||||||
max: 5,
|
max: 5,
|
||||||
min: -5,
|
min: -5,
|
||||||
orientation: 'vertical',
|
orientation: "vertical",
|
||||||
step: 1
|
step: 1
|
||||||
};
|
};
|
||||||
el.slider(options);
|
el.slider(options);
|
||||||
@ -176,11 +176,11 @@ test("keydown UP on handle increases value by step, not greater than max", funct
|
|||||||
|
|
||||||
test("keydown RIGHT on handle increases value by step, not greater than max", function() {
|
test("keydown RIGHT on handle increases value by step, not greater than max", function() {
|
||||||
expect( 4 );
|
expect( 4 );
|
||||||
el = $('<div></div>');
|
el = $("<div></div>");
|
||||||
options = {
|
options = {
|
||||||
max: 5,
|
max: 5,
|
||||||
min: -5,
|
min: -5,
|
||||||
orientation: 'horizontal',
|
orientation: "horizontal",
|
||||||
step: 1
|
step: 1
|
||||||
};
|
};
|
||||||
el.slider(options);
|
el.slider(options);
|
||||||
@ -195,11 +195,11 @@ test("keydown RIGHT on handle increases value by step, not greater than max", fu
|
|||||||
|
|
||||||
el.slider("destroy");
|
el.slider("destroy");
|
||||||
|
|
||||||
el = $('<div></div>');
|
el = $("<div></div>");
|
||||||
options = {
|
options = {
|
||||||
max: 5,
|
max: 5,
|
||||||
min: -5,
|
min: -5,
|
||||||
orientation: 'vertical',
|
orientation: "vertical",
|
||||||
step: 1
|
step: 1
|
||||||
};
|
};
|
||||||
el.slider(options);
|
el.slider(options);
|
||||||
@ -217,11 +217,11 @@ test("keydown RIGHT on handle increases value by step, not greater than max", fu
|
|||||||
|
|
||||||
test("keydown DOWN on handle decreases value by step, not less than min", function() {
|
test("keydown DOWN on handle decreases value by step, not less than min", function() {
|
||||||
expect( 4 );
|
expect( 4 );
|
||||||
el = $('<div></div>');
|
el = $("<div></div>");
|
||||||
options = {
|
options = {
|
||||||
max: 5,
|
max: 5,
|
||||||
min: -5,
|
min: -5,
|
||||||
orientation: 'horizontal',
|
orientation: "horizontal",
|
||||||
step: 1
|
step: 1
|
||||||
};
|
};
|
||||||
el.slider(options);
|
el.slider(options);
|
||||||
@ -236,11 +236,11 @@ test("keydown DOWN on handle decreases value by step, not less than min", functi
|
|||||||
|
|
||||||
el.slider("destroy");
|
el.slider("destroy");
|
||||||
|
|
||||||
el = $('<div></div>');
|
el = $("<div></div>");
|
||||||
options = {
|
options = {
|
||||||
max: 5,
|
max: 5,
|
||||||
min: -5,
|
min: -5,
|
||||||
orientation: 'vertical',
|
orientation: "vertical",
|
||||||
step: 1
|
step: 1
|
||||||
};
|
};
|
||||||
el.slider(options);
|
el.slider(options);
|
||||||
@ -258,11 +258,11 @@ test("keydown DOWN on handle decreases value by step, not less than min", functi
|
|||||||
|
|
||||||
test("keydown LEFT on handle decreases value by step, not less than min", function() {
|
test("keydown LEFT on handle decreases value by step, not less than min", function() {
|
||||||
expect( 4 );
|
expect( 4 );
|
||||||
el = $('<div></div>');
|
el = $("<div></div>");
|
||||||
options = {
|
options = {
|
||||||
max: 5,
|
max: 5,
|
||||||
min: -5,
|
min: -5,
|
||||||
orientation: 'horizontal',
|
orientation: "horizontal",
|
||||||
step: 1
|
step: 1
|
||||||
};
|
};
|
||||||
el.slider(options);
|
el.slider(options);
|
||||||
@ -277,11 +277,11 @@ test("keydown LEFT on handle decreases value by step, not less than min", functi
|
|||||||
|
|
||||||
el.slider("destroy");
|
el.slider("destroy");
|
||||||
|
|
||||||
el = $('<div></div>');
|
el = $("<div></div>");
|
||||||
options = {
|
options = {
|
||||||
max: 5,
|
max: 5,
|
||||||
min: -5,
|
min: -5,
|
||||||
orientation: 'vertical',
|
orientation: "vertical",
|
||||||
step: 1
|
step: 1
|
||||||
};
|
};
|
||||||
el.slider(options);
|
el.slider(options);
|
||||||
|
@ -8,22 +8,22 @@ module("slider: methods");
|
|||||||
test("init", function() {
|
test("init", function() {
|
||||||
expect(5);
|
expect(5);
|
||||||
|
|
||||||
$("<div></div>").appendTo('body').slider().remove();
|
$("<div></div>").appendTo("body").slider().remove();
|
||||||
ok(true, '.slider() called on element');
|
ok(true, ".slider() called on element");
|
||||||
|
|
||||||
$([]).slider().remove();
|
$([]).slider().remove();
|
||||||
ok(true, '.slider() called on empty collection');
|
ok(true, ".slider() called on empty collection");
|
||||||
|
|
||||||
$('<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();
|
||||||
el.slider("option", "foo");
|
el.slider("option", "foo");
|
||||||
el.remove();
|
el.remove();
|
||||||
ok(true, 'arbitrary option getter after init');
|
ok(true, "arbitrary option getter after init");
|
||||||
|
|
||||||
$('<div></div>').slider().slider("option", "foo", "bar").remove();
|
$("<div></div>").slider().slider("option", "foo", "bar").remove();
|
||||||
ok(true, 'arbitrary option setter after init');
|
ok(true, "arbitrary option setter after init");
|
||||||
});
|
});
|
||||||
|
|
||||||
test("destroy", function() {
|
test("destroy", function() {
|
||||||
@ -36,60 +36,60 @@ test("destroy", function() {
|
|||||||
test("enable", function() {
|
test("enable", function() {
|
||||||
expect( 5 );
|
expect( 5 );
|
||||||
var el,
|
var el,
|
||||||
expected = $('<div></div>').slider(),
|
expected = $("<div></div>").slider(),
|
||||||
actual = expected.slider('enable');
|
actual = expected.slider("enable");
|
||||||
equal(actual, expected, 'enable is chainable');
|
equal(actual, expected, "enable is chainable");
|
||||||
|
|
||||||
el = $('<div></div>').slider({ disabled: true });
|
el = $("<div></div>").slider({ disabled: true });
|
||||||
ok(el.hasClass('ui-state-disabled'), 'slider has ui-state-disabled class before enable method call');
|
ok(el.hasClass("ui-state-disabled"), "slider has ui-state-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");
|
||||||
ok(!el.hasClass('ui-state-disabled'), 'slider does not have ui-state-disabled class after enable method call');
|
ok(!el.hasClass("ui-state-disabled"), "slider does not have ui-state-disabled class after enable method call");
|
||||||
ok(!el.hasClass('ui-slider-disabled'), 'slider does not have ui-slider-disabled class after enable method call');
|
ok(!el.hasClass("ui-slider-disabled"), "slider does not have ui-slider-disabled class after enable method call");
|
||||||
});
|
});
|
||||||
|
|
||||||
test("disable", function() {
|
test("disable", function() {
|
||||||
expect( 5 );
|
expect( 5 );
|
||||||
var el,
|
var el,
|
||||||
expected = $('<div></div>').slider(),
|
expected = $("<div></div>").slider(),
|
||||||
actual = expected.slider('disable');
|
actual = expected.slider("disable");
|
||||||
equal(actual, expected, 'disable is chainable');
|
equal(actual, expected, "disable is chainable");
|
||||||
|
|
||||||
el = $('<div></div>').slider({ disabled: false });
|
el = $("<div></div>").slider({ disabled: false });
|
||||||
ok(!el.hasClass('ui-state-disabled'), 'slider does not have ui-state-disabled class before disabled method call');
|
ok(!el.hasClass("ui-state-disabled"), "slider does not have ui-state-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");
|
||||||
ok(el.hasClass('ui-state-disabled'), 'slider has ui-state-disabled class after disable method call');
|
ok(el.hasClass("ui-state-disabled"), "slider has ui-state-disabled class after disable method call");
|
||||||
ok(el.hasClass('ui-slider-disabled'), 'slider has ui-slider-disabled class after disable method call');
|
ok(el.hasClass("ui-slider-disabled"), "slider has ui-slider-disabled class after disable method call");
|
||||||
});
|
});
|
||||||
|
|
||||||
test("value", function() {
|
test("value", function() {
|
||||||
expect( 17 );
|
expect( 17 );
|
||||||
$([false, 'min', 'max']).each(function() {
|
$([false, "min", "max"]).each(function() {
|
||||||
var el = $('<div></div>').slider({
|
var el = $("<div></div>").slider({
|
||||||
range: this,
|
range: this,
|
||||||
value: 5
|
value: 5
|
||||||
});
|
});
|
||||||
equal(el.slider('value'), 5, 'range: ' + this + ' slider method get');
|
equal(el.slider("value"), 5, "range: " + this + " slider method get");
|
||||||
equal(el.slider('value', 10), el, 'value method is chainable');
|
equal(el.slider("value", 10), el, "value method is chainable");
|
||||||
equal(el.slider('value'), 10, 'range: ' + this + ' slider method set');
|
equal(el.slider("value"), 10, "range: " + this + " slider method set");
|
||||||
el.remove();
|
el.remove();
|
||||||
});
|
});
|
||||||
var el = $('<div></div>').slider({
|
var el = $("<div></div>").slider({
|
||||||
min: -1, value: 0, max: 1
|
min: -1, value: 0, max: 1
|
||||||
});
|
});
|
||||||
// min with value option vs value method
|
// min with value option vs value method
|
||||||
el.slider('option', 'value', -2);
|
el.slider("option", "value", -2);
|
||||||
equal(el.slider('option', 'value'), -2, 'value option does not respect min');
|
equal(el.slider("option", "value"), -2, "value option does not respect min");
|
||||||
equal(el.slider('value'), -1, 'value method get respects min');
|
equal(el.slider("value"), -1, "value method get respects min");
|
||||||
equal(el.slider('value', -2), el, 'value method is chainable');
|
equal(el.slider("value", -2), el, "value method is chainable");
|
||||||
equal(el.slider('option', 'value'), -1, 'value method set respects min');
|
equal(el.slider("option", "value"), -1, "value method set respects min");
|
||||||
// max with value option vs value method
|
// max with value option vs value method
|
||||||
el.slider('option', 'value', 2);
|
el.slider("option", "value", 2);
|
||||||
equal(el.slider('option', 'value'), 2, 'value option does not respect max');
|
equal(el.slider("option", "value"), 2, "value option does not respect max");
|
||||||
equal(el.slider('value'), 1, 'value method get respects max');
|
equal(el.slider("value"), 1, "value method get respects max");
|
||||||
equal(el.slider('value', 2), el, 'value method is chainable');
|
equal(el.slider("value", 2), el, "value method is chainable");
|
||||||
equal(el.slider('option', 'value'), 1, 'value method set respects max');
|
equal(el.slider("option", "value"), 1, "value method set respects max");
|
||||||
});
|
});
|
||||||
|
|
||||||
//test("values", function() {
|
//test("values", function() {
|
||||||
|
@ -13,12 +13,12 @@ module("slider: options");
|
|||||||
|
|
||||||
test("max", function() {
|
test("max", function() {
|
||||||
expect( 2 );
|
expect( 2 );
|
||||||
el = $('<div></div>');
|
el = $("<div></div>");
|
||||||
|
|
||||||
options = {
|
options = {
|
||||||
max: 37,
|
max: 37,
|
||||||
min: 6,
|
min: 6,
|
||||||
orientation: 'horizontal',
|
orientation: "horizontal",
|
||||||
step: 1,
|
step: 1,
|
||||||
value: 50
|
value: 50
|
||||||
};
|
};
|
||||||
@ -26,18 +26,18 @@ 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");
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
test("min", function() {
|
test("min", function() {
|
||||||
expect( 2 );
|
expect( 2 );
|
||||||
el = $('<div></div>');
|
el = $("<div></div>");
|
||||||
|
|
||||||
options = {
|
options = {
|
||||||
max: 37,
|
max: 37,
|
||||||
min: 6,
|
min: 6,
|
||||||
orientation: 'vertical',
|
orientation: "vertical",
|
||||||
step: 1,
|
step: 1,
|
||||||
value: 2
|
value: 2
|
||||||
};
|
};
|
||||||
@ -45,45 +45,45 @@ 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");
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
test("orientation", function() {
|
test("orientation", function() {
|
||||||
expect( 6 );
|
expect( 6 );
|
||||||
el = $('#slider1');
|
el = $("#slider1");
|
||||||
|
|
||||||
options = {
|
options = {
|
||||||
max: 2,
|
max: 2,
|
||||||
min: -2,
|
min: -2,
|
||||||
orientation: 'vertical',
|
orientation: "vertical",
|
||||||
value: 1
|
value: 1
|
||||||
};
|
};
|
||||||
|
|
||||||
var percentVal = (options.value - options.min) / (options.max - options.min) * 100;
|
var percentVal = (options.value - options.min) / (options.max - options.min) * 100;
|
||||||
|
|
||||||
el.slider(options).slider("option", "orientation", "horizontal");
|
el.slider(options).slider("option", "orientation", "horizontal");
|
||||||
ok(el.is('.ui-slider-horizontal'), "horizontal slider has class .ui-slider-horizontal");
|
ok(el.is(".ui-slider-horizontal"), "horizontal slider has class .ui-slider-horizontal");
|
||||||
ok(!el.is('.ui-slider-vertical'), "horizontal slider does not have class .ui-slider-vertical");
|
ok(!el.is(".ui-slider-vertical"), "horizontal slider does not have class .ui-slider-vertical");
|
||||||
equal(handle()[0].style.left, percentVal + '%', "horizontal slider handle is positioned with left: %");
|
equal(handle()[0].style.left, percentVal + "%", "horizontal slider handle is positioned with left: %");
|
||||||
|
|
||||||
el.slider('destroy');
|
el.slider("destroy");
|
||||||
|
|
||||||
options = {
|
options = {
|
||||||
max: 2,
|
max: 2,
|
||||||
min: -2,
|
min: -2,
|
||||||
orientation: 'horizontal',
|
orientation: "horizontal",
|
||||||
value: -1
|
value: -1
|
||||||
};
|
};
|
||||||
|
|
||||||
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");
|
||||||
ok(!el.is('.ui-slider-horizontal'), "vertical slider does not have class .ui-slider-horizontal");
|
ok(!el.is(".ui-slider-horizontal"), "vertical slider does not have class .ui-slider-horizontal");
|
||||||
equal(handle()[0].style.bottom, percentVal + '%', "vertical slider handle is positioned with bottom: %");
|
equal(handle()[0].style.bottom, percentVal + "%", "vertical slider handle is positioned with bottom: %");
|
||||||
|
|
||||||
el.slider('destroy');
|
el.slider("destroy");
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -96,7 +96,7 @@ test("orientation", function() {
|
|||||||
// What is returned by the value method is restricted by min (>=), max (<=), and step (even multiple)
|
// What is returned by the value method is restricted by min (>=), max (<=), and step (even multiple)
|
||||||
test("step", function() {
|
test("step", function() {
|
||||||
expect( 9 );
|
expect( 9 );
|
||||||
var el = $('<div></div>').slider({
|
var el = $("<div></div>").slider({
|
||||||
min: 0,
|
min: 0,
|
||||||
value: 0,
|
value: 0,
|
||||||
step: 10,
|
step: 10,
|
||||||
@ -116,7 +116,7 @@ test("step", function() {
|
|||||||
el.slider("value", 19);
|
el.slider("value", 19);
|
||||||
equal( el.slider("value"), 20 );
|
equal( el.slider("value"), 20 );
|
||||||
|
|
||||||
el = $('<div></div>').slider({
|
el = $("<div></div>").slider({
|
||||||
min: 0,
|
min: 0,
|
||||||
value: 0,
|
value: 0,
|
||||||
step: 20,
|
step: 20,
|
||||||
@ -136,7 +136,7 @@ test("step", function() {
|
|||||||
el.slider("option", "value", 19);
|
el.slider("option", "value", 19);
|
||||||
equal( el.slider("value"), 20 );
|
equal( el.slider("value"), 20 );
|
||||||
|
|
||||||
el.slider('destroy');
|
el.slider("destroy");
|
||||||
});
|
});
|
||||||
|
|
||||||
//test("value", function() {
|
//test("value", function() {
|
||||||
|
@ -17,15 +17,15 @@ test("start", function() {
|
|||||||
dy: 10
|
dy: 10
|
||||||
});
|
});
|
||||||
|
|
||||||
ok(hash, 'start event triggered');
|
ok(hash, "start event triggered");
|
||||||
ok(hash.helper, 'UI hash includes: helper');
|
ok(hash.helper, "UI hash includes: helper");
|
||||||
ok(hash.placeholder, 'UI hash includes: placeholder');
|
ok(hash.placeholder, "UI hash includes: placeholder");
|
||||||
ok(hash.item, 'UI hash includes: item');
|
ok(hash.item, "UI hash includes: item");
|
||||||
ok(!hash.sender, 'UI hash does not include: sender');
|
ok(!hash.sender, "UI hash does not include: sender");
|
||||||
|
|
||||||
// todo: see if these events should actually have sane values in them
|
// todo: see if these events should actually have sane values in them
|
||||||
ok('position' in hash, 'UI hash includes: position');
|
ok("position" in hash, "UI hash includes: position");
|
||||||
ok('offset' in hash, 'UI hash includes: offset');
|
ok("offset" in hash, "UI hash includes: offset");
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
@ -42,13 +42,13 @@ test("sort", function() {
|
|||||||
dy: 10
|
dy: 10
|
||||||
});
|
});
|
||||||
|
|
||||||
ok(hash, 'sort event triggered');
|
ok(hash, "sort event triggered");
|
||||||
ok(hash.helper, 'UI hash includes: helper');
|
ok(hash.helper, "UI hash includes: helper");
|
||||||
ok(hash.placeholder, 'UI hash includes: placeholder');
|
ok(hash.placeholder, "UI hash includes: placeholder");
|
||||||
ok(hash.position && ('top' in hash.position && 'left' in hash.position), 'UI hash includes: position');
|
ok(hash.position && ("top" in hash.position && "left" in hash.position), "UI hash includes: position");
|
||||||
ok(hash.offset && (hash.offset.top && hash.offset.left), 'UI hash includes: offset');
|
ok(hash.offset && (hash.offset.top && hash.offset.left), "UI hash includes: offset");
|
||||||
ok(hash.item, 'UI hash includes: item');
|
ok(hash.item, "UI hash includes: item");
|
||||||
ok(!hash.sender, 'UI hash does not include: sender');
|
ok(!hash.sender, "UI hash does not include: sender");
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -65,7 +65,7 @@ test("change", function() {
|
|||||||
dy: 1
|
dy: 1
|
||||||
});
|
});
|
||||||
|
|
||||||
ok(!hash, '1px drag, change event should not be triggered');
|
ok(!hash, "1px drag, change event should not be triggered");
|
||||||
|
|
||||||
$("#sortable").sortable({
|
$("#sortable").sortable({
|
||||||
change: function( e, ui ) {
|
change: function( e, ui ) {
|
||||||
@ -75,13 +75,13 @@ test("change", function() {
|
|||||||
dy: 22
|
dy: 22
|
||||||
});
|
});
|
||||||
|
|
||||||
ok(hash, 'change event triggered');
|
ok(hash, "change event triggered");
|
||||||
ok(hash.helper, 'UI hash includes: helper');
|
ok(hash.helper, "UI hash includes: helper");
|
||||||
ok(hash.placeholder, 'UI hash includes: placeholder');
|
ok(hash.placeholder, "UI hash includes: placeholder");
|
||||||
ok(hash.position && ('top' in hash.position && 'left' in hash.position), 'UI hash includes: position');
|
ok(hash.position && ("top" in hash.position && "left" in hash.position), "UI hash includes: position");
|
||||||
ok(hash.offset && (hash.offset.top && hash.offset.left), 'UI hash includes: offset');
|
ok(hash.offset && (hash.offset.top && hash.offset.left), "UI hash includes: offset");
|
||||||
ok(hash.item, 'UI hash includes: item');
|
ok(hash.item, "UI hash includes: item");
|
||||||
ok(!hash.sender, 'UI hash does not include: sender');
|
ok(!hash.sender, "UI hash does not include: sender");
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -97,13 +97,13 @@ test("beforeStop", function() {
|
|||||||
dy: 20
|
dy: 20
|
||||||
});
|
});
|
||||||
|
|
||||||
ok(hash, 'beforeStop event triggered');
|
ok(hash, "beforeStop event triggered");
|
||||||
ok(hash.helper, 'UI hash includes: helper');
|
ok(hash.helper, "UI hash includes: helper");
|
||||||
ok(hash.placeholder, 'UI hash includes: placeholder');
|
ok(hash.placeholder, "UI hash includes: placeholder");
|
||||||
ok(hash.position && ('top' in hash.position && 'left' in hash.position), 'UI hash includes: position');
|
ok(hash.position && ("top" in hash.position && "left" in hash.position), "UI hash includes: position");
|
||||||
ok(hash.offset && (hash.offset.top && hash.offset.left), 'UI hash includes: offset');
|
ok(hash.offset && (hash.offset.top && hash.offset.left), "UI hash includes: offset");
|
||||||
ok(hash.item, 'UI hash includes: item');
|
ok(hash.item, "UI hash includes: item");
|
||||||
ok(!hash.sender, 'UI hash does not include: sender');
|
ok(!hash.sender, "UI hash does not include: sender");
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -119,13 +119,13 @@ test("stop", function() {
|
|||||||
dy: 20
|
dy: 20
|
||||||
});
|
});
|
||||||
|
|
||||||
ok(hash, 'stop event triggered');
|
ok(hash, "stop event triggered");
|
||||||
ok(!hash.helper, 'UI should not include: helper');
|
ok(!hash.helper, "UI should not include: helper");
|
||||||
ok(hash.placeholder, 'UI hash includes: placeholder');
|
ok(hash.placeholder, "UI hash includes: placeholder");
|
||||||
ok(hash.position && ('top' in hash.position && 'left' in hash.position), 'UI hash includes: position');
|
ok(hash.position && ("top" in hash.position && "left" in hash.position), "UI hash includes: position");
|
||||||
ok(hash.offset && (hash.offset.top && hash.offset.left), 'UI hash includes: offset');
|
ok(hash.offset && (hash.offset.top && hash.offset.left), "UI hash includes: offset");
|
||||||
ok(hash.item, 'UI hash includes: item');
|
ok(hash.item, "UI hash includes: item");
|
||||||
ok(!hash.sender, 'UI hash does not include: sender');
|
ok(!hash.sender, "UI hash does not include: sender");
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -142,7 +142,7 @@ test("update", function() {
|
|||||||
dy: 1
|
dy: 1
|
||||||
});
|
});
|
||||||
|
|
||||||
ok(!hash, '1px drag, update event should not be triggered');
|
ok(!hash, "1px drag, update event should not be triggered");
|
||||||
|
|
||||||
$("#sortable").sortable({
|
$("#sortable").sortable({
|
||||||
update: function( e, ui ) {
|
update: function( e, ui ) {
|
||||||
@ -152,13 +152,13 @@ test("update", function() {
|
|||||||
dy: 22
|
dy: 22
|
||||||
});
|
});
|
||||||
|
|
||||||
ok(hash, 'update event triggered');
|
ok(hash, "update event triggered");
|
||||||
ok(!hash.helper, 'UI hash should not include: helper');
|
ok(!hash.helper, "UI hash should not include: helper");
|
||||||
ok(hash.placeholder, 'UI hash includes: placeholder');
|
ok(hash.placeholder, "UI hash includes: placeholder");
|
||||||
ok(hash.position && ('top' in hash.position && 'left' in hash.position), 'UI hash includes: position');
|
ok(hash.position && ("top" in hash.position && "left" in hash.position), "UI hash includes: position");
|
||||||
ok(hash.offset && (hash.offset.top && hash.offset.left), 'UI hash includes: offset');
|
ok(hash.offset && (hash.offset.top && hash.offset.left), "UI hash includes: offset");
|
||||||
ok(hash.item, 'UI hash includes: item');
|
ok(hash.item, "UI hash includes: item");
|
||||||
ok(!hash.sender, 'UI hash does not include: sender');
|
ok(!hash.sender, "UI hash does not include: sender");
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -172,21 +172,21 @@ test("#3019: Stop fires too early", function() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
TestHelpers.sortable.sort($("li", el)[0], 0, 44, 2, 'Dragging the sortable');
|
TestHelpers.sortable.sort($("li", el)[0], 0, 44, 2, "Dragging the sortable");
|
||||||
equal(helper, null, "helper should be false");
|
equal(helper, null, "helper should be false");
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
test('#4752: link event firing on sortable with connect list', function () {
|
test("#4752: link event firing on sortable with connect list", function () {
|
||||||
expect( 10 );
|
expect( 10 );
|
||||||
|
|
||||||
var fired = {},
|
var fired = {},
|
||||||
hasFired = function (type) { return (type in fired) && (true === fired[type]); };
|
hasFired = function (type) { return (type in fired) && (true === fired[type]); };
|
||||||
|
|
||||||
$('#sortable').clone().attr('id', 'sortable2').insertAfter('#sortable');
|
$("#sortable").clone().attr("id", "sortable2").insertAfter("#sortable");
|
||||||
|
|
||||||
$('#qunit-fixture ul').sortable({
|
$("#qunit-fixture ul").sortable({
|
||||||
connectWith: '#qunit-fixture ul',
|
connectWith: "#qunit-fixture ul",
|
||||||
change: function () {
|
change: function () {
|
||||||
fired.change = true;
|
fired.change = true;
|
||||||
},
|
},
|
||||||
@ -198,29 +198,29 @@ test('#4752: link event firing on sortable with connect list', function () {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#qunit-fixture ul').bind('click.ui-sortable-test', function () {
|
$("#qunit-fixture ul").bind("click.ui-sortable-test", function () {
|
||||||
fired.click = true;
|
fired.click = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#sortable li:eq(0)').simulate('click');
|
$("#sortable li:eq(0)").simulate("click");
|
||||||
ok(!hasFired('change'), 'Click only, change event should not have fired');
|
ok(!hasFired("change"), "Click only, change event should not have fired");
|
||||||
ok(hasFired('click'), 'Click event should have fired');
|
ok(hasFired("click"), "Click event should have fired");
|
||||||
|
|
||||||
// Drag an item within the first list
|
// Drag an item within the first list
|
||||||
fired = {};
|
fired = {};
|
||||||
$('#sortable li:eq(0)').simulate('drag', { dx: 0, dy: 40 });
|
$("#sortable li:eq(0)").simulate("drag", { dx: 0, dy: 40 });
|
||||||
ok(hasFired('change'), '40px drag, change event should have fired');
|
ok(hasFired("change"), "40px drag, change event should have fired");
|
||||||
ok(!hasFired('receive'), 'Receive event should not have fired');
|
ok(!hasFired("receive"), "Receive event should not have fired");
|
||||||
ok(!hasFired('remove'), 'Remove event should not have fired');
|
ok(!hasFired("remove"), "Remove event should not have fired");
|
||||||
ok(!hasFired('click'), 'Click event should not have fired');
|
ok(!hasFired("click"), "Click event should not have fired");
|
||||||
|
|
||||||
// Drag an item from the first list to the second, connected list
|
// Drag an item from the first list to the second, connected list
|
||||||
fired = {};
|
fired = {};
|
||||||
$('#sortable li:eq(0)').simulate('drag', { dx: 0, dy: 150 });
|
$("#sortable li:eq(0)").simulate("drag", { dx: 0, dy: 150 });
|
||||||
ok(hasFired('change'), '150px drag, change event should have fired');
|
ok(hasFired("change"), "150px drag, change event should have fired");
|
||||||
ok(hasFired('receive'), 'Receive event should have fired');
|
ok(hasFired("receive"), "Receive event should have fired");
|
||||||
ok(hasFired('remove'), 'Remove event should have fired');
|
ok(hasFired("remove"), "Remove event should have fired");
|
||||||
ok(!hasFired('click'), 'Click event should not have fired');
|
ok(!hasFired("click"), "Click event should not have fired");
|
||||||
});
|
});
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -8,36 +8,36 @@ module("sortable: methods");
|
|||||||
test("init", function() {
|
test("init", function() {
|
||||||
expect(5);
|
expect(5);
|
||||||
|
|
||||||
$("<div></div>").appendTo('body').sortable().remove();
|
$("<div></div>").appendTo("body").sortable().remove();
|
||||||
ok(true, '.sortable() called on element');
|
ok(true, ".sortable() called on element");
|
||||||
|
|
||||||
$([]).sortable();
|
$([]).sortable();
|
||||||
ok(true, '.sortable() called on empty collection');
|
ok(true, ".sortable() called on empty collection");
|
||||||
|
|
||||||
$("<div></div>").sortable();
|
$("<div></div>").sortable();
|
||||||
ok(true, '.sortable() called on disconnected DOMElement');
|
ok(true, ".sortable() called on disconnected DOMElement");
|
||||||
|
|
||||||
$("<div></div>").sortable().sortable("option", "foo");
|
$("<div></div>").sortable().sortable("option", "foo");
|
||||||
ok(true, 'arbitrary option getter after init');
|
ok(true, "arbitrary option getter after init");
|
||||||
|
|
||||||
$("<div></div>").sortable().sortable("option", "foo", "bar");
|
$("<div></div>").sortable().sortable("option", "foo", "bar");
|
||||||
ok(true, 'arbitrary option setter after init');
|
ok(true, "arbitrary option setter after init");
|
||||||
});
|
});
|
||||||
|
|
||||||
test("destroy", function() {
|
test("destroy", function() {
|
||||||
expect(4);
|
expect(4);
|
||||||
$("<div></div>").appendTo('body').sortable().sortable("destroy").remove();
|
$("<div></div>").appendTo("body").sortable().sortable("destroy").remove();
|
||||||
ok(true, '.sortable("destroy") called on element');
|
ok(true, ".sortable('destroy') called on element");
|
||||||
|
|
||||||
$([]).sortable().sortable("destroy");
|
$([]).sortable().sortable("destroy");
|
||||||
ok(true, '.sortable("destroy") called on empty collection');
|
ok(true, ".sortable('destroy') called on empty collection");
|
||||||
|
|
||||||
$("<div></div>").sortable().sortable("destroy");
|
$("<div></div>").sortable().sortable("destroy");
|
||||||
ok(true, '.sortable("destroy") called on disconnected DOMElement');
|
ok(true, ".sortable('destroy') called on disconnected DOMElement");
|
||||||
|
|
||||||
var expected = $('<div></div>').sortable(),
|
var expected = $("<div></div>").sortable(),
|
||||||
actual = expected.sortable('destroy');
|
actual = expected.sortable("destroy");
|
||||||
equal(actual, expected, 'destroy is chainable');
|
equal(actual, expected, "destroy is chainable");
|
||||||
});
|
});
|
||||||
|
|
||||||
test("enable", function() {
|
test("enable", function() {
|
||||||
@ -47,7 +47,7 @@ test("enable", function() {
|
|||||||
|
|
||||||
el = $("#sortable").sortable({ disabled: true });
|
el = $("#sortable").sortable({ disabled: true });
|
||||||
|
|
||||||
TestHelpers.sortable.sort($("li", el)[0], 0, 44, 0, '.sortable({ disabled: true })');
|
TestHelpers.sortable.sort($("li", el)[0], 0, 44, 0, ".sortable({ disabled: true })");
|
||||||
|
|
||||||
el.sortable("enable");
|
el.sortable("enable");
|
||||||
equal(el.sortable("option", "disabled"), false, "disabled option getter");
|
equal(el.sortable("option", "disabled"), false, "disabled option getter");
|
||||||
@ -57,11 +57,11 @@ test("enable", function() {
|
|||||||
el.sortable("option", "disabled", false);
|
el.sortable("option", "disabled", false);
|
||||||
equal(el.sortable("option", "disabled"), false, "disabled option setter");
|
equal(el.sortable("option", "disabled"), false, "disabled option setter");
|
||||||
|
|
||||||
TestHelpers.sortable.sort($("li", el)[0], 0, 44, 2, '.sortable("option", "disabled", false)');
|
TestHelpers.sortable.sort($("li", el)[0], 0, 44, 2, ".sortable('option', 'disabled', false)");
|
||||||
|
|
||||||
expected = $('<div></div>').sortable(),
|
expected = $("<div></div>").sortable(),
|
||||||
actual = expected.sortable('enable');
|
actual = expected.sortable("enable");
|
||||||
equal(actual, expected, 'enable is chainable');
|
equal(actual, expected, "enable is chainable");
|
||||||
});
|
});
|
||||||
|
|
||||||
test("disable", function() {
|
test("disable", function() {
|
||||||
@ -70,23 +70,23 @@ test("disable", function() {
|
|||||||
var el, actual, expected;
|
var el, actual, expected;
|
||||||
|
|
||||||
el = $("#sortable").sortable({ disabled: false });
|
el = $("#sortable").sortable({ disabled: false });
|
||||||
TestHelpers.sortable.sort($("li", el)[0], 0, 44, 2, '.sortable({ disabled: false })');
|
TestHelpers.sortable.sort($("li", el)[0], 0, 44, 2, ".sortable({ disabled: false })");
|
||||||
|
|
||||||
el.sortable("disable");
|
el.sortable("disable");
|
||||||
TestHelpers.sortable.sort($("li", el)[0], 0, 44, 0, 'disabled.sortable getter');
|
TestHelpers.sortable.sort($("li", el)[0], 0, 44, 0, "disabled.sortable getter");
|
||||||
|
|
||||||
el.sortable("destroy");
|
el.sortable("destroy");
|
||||||
|
|
||||||
el.sortable({ disabled: false });
|
el.sortable({ disabled: false });
|
||||||
TestHelpers.sortable.sort($("li", el)[0], 0, 44, 2, '.sortable({ disabled: false })');
|
TestHelpers.sortable.sort($("li", el)[0], 0, 44, 2, ".sortable({ disabled: false })");
|
||||||
el.sortable("option", "disabled", true);
|
el.sortable("option", "disabled", true);
|
||||||
equal(el.sortable("option", "disabled"), true, "disabled option setter");
|
equal(el.sortable("option", "disabled"), true, "disabled option setter");
|
||||||
ok(el.sortable("widget").is(":not(.ui-state-disabled)"), "sortable element does not get ui-state-disabled since it's an interaction");
|
ok(el.sortable("widget").is(":not(.ui-state-disabled)"), "sortable element does not get ui-state-disabled since it's an interaction");
|
||||||
TestHelpers.sortable.sort($("li", el)[0], 0, 44, 0, '.sortable("option", "disabled", true)');
|
TestHelpers.sortable.sort($("li", el)[0], 0, 44, 0, ".sortable('option', 'disabled', true)");
|
||||||
|
|
||||||
expected = $('<div></div>').sortable(),
|
expected = $("<div></div>").sortable(),
|
||||||
actual = expected.sortable('disable');
|
actual = expected.sortable("disable");
|
||||||
equal(actual, expected, 'disable is chainable');
|
equal(actual, expected, "disable is chainable");
|
||||||
});
|
});
|
||||||
|
|
||||||
})(jQuery);
|
})(jQuery);
|
||||||
|
@ -5,7 +5,7 @@ var simulateKeyDownUp = TestHelpers.spinner.simulateKeyDownUp;
|
|||||||
module( "spinner: events" );
|
module( "spinner: events" );
|
||||||
|
|
||||||
test( "start", function() {
|
test( "start", function() {
|
||||||
expect( 6 );
|
expect( 10 );
|
||||||
var element = $( "#spin" ).spinner();
|
var element = $( "#spin" ).spinner();
|
||||||
|
|
||||||
function shouldStart( expectation, msg ) {
|
function shouldStart( expectation, msg ) {
|
||||||
@ -29,14 +29,14 @@ test( "start", function() {
|
|||||||
shouldStart( true, "button down" );
|
shouldStart( true, "button down" );
|
||||||
element.spinner( "widget" ).find( ".ui-spinner-down" ).mousedown().mouseup();
|
element.spinner( "widget" ).find( ".ui-spinner-down" ).mousedown().mouseup();
|
||||||
|
|
||||||
shouldStart( false, "stepUp" );
|
shouldStart( true, "stepUp" );
|
||||||
element.spinner( "stepUp" );
|
element.spinner( "stepUp" );
|
||||||
shouldStart( false, "stepDown" );
|
shouldStart( true, "stepDown" );
|
||||||
element.spinner( "stepDown" );
|
element.spinner( "stepDown" );
|
||||||
|
|
||||||
shouldStart( false, "pageUp" );
|
shouldStart( true, "pageUp" );
|
||||||
element.spinner( "pageUp" );
|
element.spinner( "pageUp" );
|
||||||
shouldStart( false, "pageDown" );
|
shouldStart( true, "pageDown" );
|
||||||
element.spinner( "pageDown" );
|
element.spinner( "pageDown" );
|
||||||
|
|
||||||
shouldStart( false, "value" );
|
shouldStart( false, "value" );
|
||||||
@ -44,7 +44,7 @@ test( "start", function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test( "spin", function() {
|
test( "spin", function() {
|
||||||
expect( 6 );
|
expect( 10 );
|
||||||
var element = $( "#spin" ).spinner();
|
var element = $( "#spin" ).spinner();
|
||||||
|
|
||||||
function shouldSpin( expectation, msg ) {
|
function shouldSpin( expectation, msg ) {
|
||||||
@ -68,14 +68,14 @@ test( "spin", function() {
|
|||||||
shouldSpin( true, "button down" );
|
shouldSpin( true, "button down" );
|
||||||
element.spinner( "widget" ).find( ".ui-spinner-down" ).mousedown().mouseup();
|
element.spinner( "widget" ).find( ".ui-spinner-down" ).mousedown().mouseup();
|
||||||
|
|
||||||
shouldSpin( false, "stepUp" );
|
shouldSpin( true, "stepUp" );
|
||||||
element.spinner( "stepUp" );
|
element.spinner( "stepUp" );
|
||||||
shouldSpin( false, "stepDown" );
|
shouldSpin( true, "stepDown" );
|
||||||
element.spinner( "stepDown" );
|
element.spinner( "stepDown" );
|
||||||
|
|
||||||
shouldSpin( false, "pageUp" );
|
shouldSpin( true, "pageUp" );
|
||||||
element.spinner( "pageUp" );
|
element.spinner( "pageUp" );
|
||||||
shouldSpin( false, "pageDown" );
|
shouldSpin( true, "pageDown" );
|
||||||
element.spinner( "pageDown" );
|
element.spinner( "pageDown" );
|
||||||
|
|
||||||
shouldSpin( false, "value" );
|
shouldSpin( false, "value" );
|
||||||
@ -83,7 +83,7 @@ test( "spin", function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test( "stop", function() {
|
test( "stop", function() {
|
||||||
expect( 6 );
|
expect( 10 );
|
||||||
var element = $( "#spin" ).spinner();
|
var element = $( "#spin" ).spinner();
|
||||||
|
|
||||||
function shouldStop( expectation, msg ) {
|
function shouldStop( expectation, msg ) {
|
||||||
@ -107,14 +107,14 @@ test( "stop", function() {
|
|||||||
shouldStop( true, "button down" );
|
shouldStop( true, "button down" );
|
||||||
element.spinner( "widget" ).find( ".ui-spinner-down" ).mousedown().mouseup();
|
element.spinner( "widget" ).find( ".ui-spinner-down" ).mousedown().mouseup();
|
||||||
|
|
||||||
shouldStop( false, "stepUp" );
|
shouldStop( true, "stepUp" );
|
||||||
element.spinner( "stepUp" );
|
element.spinner( "stepUp" );
|
||||||
shouldStop( false, "stepDown" );
|
shouldStop( true, "stepDown" );
|
||||||
element.spinner( "stepDown" );
|
element.spinner( "stepDown" );
|
||||||
|
|
||||||
shouldStop( false, "pageUp" );
|
shouldStop( true, "pageUp" );
|
||||||
element.spinner( "pageUp" );
|
element.spinner( "pageUp" );
|
||||||
shouldStop( false, "pageDown" );
|
shouldStop( true, "pageDown" );
|
||||||
element.spinner( "pageDown" );
|
element.spinner( "pageDown" );
|
||||||
|
|
||||||
shouldStop( false, "value" );
|
shouldStop( false, "value" );
|
||||||
|
@ -5,10 +5,17 @@ module( "spinner: options" );
|
|||||||
// culture is tested after numberFormat, since it depends on numberFormat
|
// culture is tested after numberFormat, since it depends on numberFormat
|
||||||
|
|
||||||
test( "icons: default ", function() {
|
test( "icons: default ", function() {
|
||||||
expect( 2 );
|
expect( 4 );
|
||||||
var element = $( "#spin" ).val( 0 ).spinner().spinner( "widget" );
|
var element = $( "#spin" ).val( 0 ).spinner();
|
||||||
equal( element.find( ".ui-icon:first" ).attr( "class" ), "ui-icon ui-icon-triangle-1-n" );
|
equal( element.spinner( "widget" ).find( ".ui-icon:first" ).attr( "class" ), "ui-icon ui-icon-triangle-1-n" );
|
||||||
equal( element.find( ".ui-icon:last" ).attr( "class" ), "ui-icon ui-icon-triangle-1-s" );
|
equal( element.spinner( "widget" ).find( ".ui-icon:last" ).attr( "class" ), "ui-icon ui-icon-triangle-1-s" );
|
||||||
|
|
||||||
|
element.spinner( "option", "icons", {
|
||||||
|
up: "ui-icon-carat-1-n",
|
||||||
|
down: "ui-icon-carat-1-s"
|
||||||
|
});
|
||||||
|
equal( element.spinner( "widget" ).find( ".ui-icon:first" ).attr( "class" ), "ui-icon ui-icon-carat-1-n" );
|
||||||
|
equal( element.spinner( "widget" ).find( ".ui-icon:last" ).attr( "class" ), "ui-icon ui-icon-carat-1-s" );
|
||||||
});
|
});
|
||||||
|
|
||||||
test( "icons: custom ", function() {
|
test( "icons: custom ", function() {
|
||||||
|
8
themes/base/jquery.ui.theme.css
vendored
8
themes/base/jquery.ui.theme.css
vendored
@ -393,14 +393,14 @@
|
|||||||
/* Overlays */
|
/* Overlays */
|
||||||
.ui-widget-overlay {
|
.ui-widget-overlay {
|
||||||
background: #aaaaaa/*{bgColorOverlay}*/ url(images/ui-bg_flat_0_aaaaaa_40x100.png)/*{bgImgUrlOverlay}*/ 50%/*{bgOverlayXPos}*/ 50%/*{bgOverlayYPos}*/ repeat-x/*{bgOverlayRepeat}*/;
|
background: #aaaaaa/*{bgColorOverlay}*/ url(images/ui-bg_flat_0_aaaaaa_40x100.png)/*{bgImgUrlOverlay}*/ 50%/*{bgOverlayXPos}*/ 50%/*{bgOverlayYPos}*/ repeat-x/*{bgOverlayRepeat}*/;
|
||||||
/* no space between ".3;" and "filter" because themeRoller looks back to the first space for replacement */
|
opacity: .3/*{opacityOverlay}*/;
|
||||||
opacity: .3;filter:Alpha(Opacity=30)/*{opacityOverlay}*/;
|
filter: Alpha(Opacity=30)/*{opacityFilterOverlay}*/;
|
||||||
}
|
}
|
||||||
.ui-widget-shadow {
|
.ui-widget-shadow {
|
||||||
margin: -8px/*{offsetTopShadow}*/ 0 0 -8px/*{offsetLeftShadow}*/;
|
margin: -8px/*{offsetTopShadow}*/ 0 0 -8px/*{offsetLeftShadow}*/;
|
||||||
padding: 8px/*{thicknessShadow}*/;
|
padding: 8px/*{thicknessShadow}*/;
|
||||||
background: #aaaaaa/*{bgColorShadow}*/ url(images/ui-bg_flat_0_aaaaaa_40x100.png)/*{bgImgUrlShadow}*/ 50%/*{bgShadowXPos}*/ 50%/*{bgShadowYPos}*/ repeat-x/*{bgShadowRepeat}*/;
|
background: #aaaaaa/*{bgColorShadow}*/ url(images/ui-bg_flat_0_aaaaaa_40x100.png)/*{bgImgUrlShadow}*/ 50%/*{bgShadowXPos}*/ 50%/*{bgShadowYPos}*/ repeat-x/*{bgShadowRepeat}*/;
|
||||||
/* no space between ".3;" and "filter" because themeRoller looks back to the first space for replacement */
|
opacity: .3/*{opacityShadow}*/;
|
||||||
opacity: .3;filter:Alpha(Opacity=30)/*{opacityShadow}*/;
|
filter: Alpha(Opacity=30)/*{opacityFilterShadow}*/;
|
||||||
border-radius: 8px/*{cornerRadiusShadow}*/;
|
border-radius: 8px/*{cornerRadiusShadow}*/;
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
"latedef": true,
|
"latedef": true,
|
||||||
"noarg": true,
|
"noarg": true,
|
||||||
"onevar": true,
|
"onevar": true,
|
||||||
|
"quotmark": "double",
|
||||||
"trailing": true,
|
"trailing": true,
|
||||||
"undef": true,
|
"undef": true,
|
||||||
"unused": true,
|
"unused": true,
|
||||||
|
8
ui/jquery.ui.core.js
vendored
8
ui/jquery.ui.core.js
vendored
@ -69,17 +69,17 @@ $.fn.extend({
|
|||||||
|
|
||||||
scrollParent: function() {
|
scrollParent: function() {
|
||||||
var scrollParent;
|
var scrollParent;
|
||||||
if (($.ui.ie && (/(static|relative)/).test(this.css('position'))) || (/absolute/).test(this.css('position'))) {
|
if (($.ui.ie && (/(static|relative)/).test(this.css("position"))) || (/absolute/).test(this.css("position"))) {
|
||||||
scrollParent = this.parents().filter(function() {
|
scrollParent = this.parents().filter(function() {
|
||||||
return (/(relative|absolute|fixed)/).test($.css(this,'position')) && (/(auto|scroll)/).test($.css(this,'overflow')+$.css(this,'overflow-y')+$.css(this,'overflow-x'));
|
return (/(relative|absolute|fixed)/).test($.css(this,"position")) && (/(auto|scroll)/).test($.css(this,"overflow")+$.css(this,"overflow-y")+$.css(this,"overflow-x"));
|
||||||
}).eq(0);
|
}).eq(0);
|
||||||
} else {
|
} else {
|
||||||
scrollParent = this.parents().filter(function() {
|
scrollParent = this.parents().filter(function() {
|
||||||
return (/(auto|scroll)/).test($.css(this,'overflow')+$.css(this,'overflow-y')+$.css(this,'overflow-x'));
|
return (/(auto|scroll)/).test($.css(this,"overflow")+$.css(this,"overflow-y")+$.css(this,"overflow-x"));
|
||||||
}).eq(0);
|
}).eq(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (/fixed/).test(this.css('position')) || !scrollParent.length ? $(document) : scrollParent;
|
return (/fixed/).test(this.css("position")) || !scrollParent.length ? $(document) : scrollParent;
|
||||||
},
|
},
|
||||||
|
|
||||||
zIndex: function( zIndex ) {
|
zIndex: function( zIndex ) {
|
||||||
|
810
ui/jquery.ui.datepicker.js
vendored
810
ui/jquery.ui.datepicker.js
vendored
File diff suppressed because it is too large
Load Diff
2
ui/jquery.ui.dialog.js
vendored
2
ui/jquery.ui.dialog.js
vendored
@ -466,7 +466,7 @@ $.widget( "ui.dialog", {
|
|||||||
// .ui-resizable has position: relative defined in the stylesheet
|
// .ui-resizable has position: relative defined in the stylesheet
|
||||||
// but dialogs have to use absolute or fixed positioning
|
// but dialogs have to use absolute or fixed positioning
|
||||||
position = this.uiDialog.css("position"),
|
position = this.uiDialog.css("position"),
|
||||||
resizeHandles = typeof handles === 'string' ?
|
resizeHandles = typeof handles === "string" ?
|
||||||
handles :
|
handles :
|
||||||
"n,e,s,w,se,sw,ne,nw";
|
"n,e,s,w,se,sw,ne,nw";
|
||||||
|
|
||||||
|
66
ui/jquery.ui.draggable.js
vendored
66
ui/jquery.ui.draggable.js
vendored
@ -81,7 +81,7 @@ $.widget( "ui.draggable", $.ui.interaction, {
|
|||||||
this.dragDimensions = null;
|
this.dragDimensions = null;
|
||||||
|
|
||||||
// The actual dragging element, should always be a jQuery object
|
// The actual dragging element, should always be a jQuery object
|
||||||
this.dragEl = ( this.options.helper === true || typeof this.options.helper === 'function' ) ?
|
this.dragEl = ( this.options.helper === true || typeof this.options.helper === "function" ) ?
|
||||||
this._createHelper( pointerPosition ) :
|
this._createHelper( pointerPosition ) :
|
||||||
this.element;
|
this.element;
|
||||||
|
|
||||||
@ -208,7 +208,7 @@ $.widget( "ui.draggable", $.ui.interaction, {
|
|||||||
// If user cancels stop, leave helper there
|
// If user cancels stop, leave helper there
|
||||||
if ( this._trigger( "stop", event, this._fullHash( pointerPosition ) ) !== false ) {
|
if ( this._trigger( "stop", event, this._fullHash( pointerPosition ) ) !== false ) {
|
||||||
if ( this.options.helper ) {
|
if ( this.options.helper ) {
|
||||||
delete this.element.data( 'uiDraggable' ).helper;
|
delete this.element.data( "uiDraggable" ).helper;
|
||||||
this.dragEl.remove();
|
this.dragEl.remove();
|
||||||
}
|
}
|
||||||
this._resetDomPosition();
|
this._resetDomPosition();
|
||||||
@ -242,7 +242,7 @@ $.widget( "ui.draggable", $.ui.interaction, {
|
|||||||
helper.appendTo( this._appendToEl() || this.document[0].body );
|
helper.appendTo( this._appendToEl() || this.document[0].body );
|
||||||
}
|
}
|
||||||
|
|
||||||
this.element.data( 'uiDraggable' ).helper = helper;
|
this.element.data( "uiDraggable" ).helper = helper;
|
||||||
|
|
||||||
this._cacheDragDimensions( helper );
|
this._cacheDragDimensions( helper );
|
||||||
|
|
||||||
@ -536,7 +536,7 @@ if ( $.uiBackCompat !== false ) {
|
|||||||
|
|
||||||
var el = this.options.appendTo;
|
var el = this.options.appendTo;
|
||||||
|
|
||||||
if ( el === 'parent' ) {
|
if ( el === "parent" ) {
|
||||||
el = this.dragEl.parent();
|
el = this.dragEl.parent();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -556,11 +556,11 @@ if ( $.uiBackCompat !== false ) {
|
|||||||
|
|
||||||
this._super();
|
this._super();
|
||||||
|
|
||||||
if ( this.options.helper === 'original' ) {
|
if ( this.options.helper === "original" ) {
|
||||||
this.options.helper = false;
|
this.options.helper = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( this.options.helper === 'clone' ) {
|
if ( this.options.helper === "clone" ) {
|
||||||
this.options.helper = true;
|
this.options.helper = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -580,15 +580,15 @@ if ( $.uiBackCompat !== false ) {
|
|||||||
|
|
||||||
_setOption: function( key, value ) {
|
_setOption: function( key, value ) {
|
||||||
|
|
||||||
if ( key !== 'helper' ) {
|
if ( key !== "helper" ) {
|
||||||
return this._super( key, value );
|
return this._super( key, value );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( value === 'clone' ) {
|
if ( value === "clone" ) {
|
||||||
value = true;
|
value = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( value === 'original' ) {
|
if ( value === "original" ) {
|
||||||
value = false;
|
value = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -645,7 +645,7 @@ if ( $.uiBackCompat !== false ) {
|
|||||||
|
|
||||||
_setOption: function( key, value ) {
|
_setOption: function( key, value ) {
|
||||||
|
|
||||||
if ( key !== 'cancel' ) {
|
if ( key !== "cancel" ) {
|
||||||
return this._super( key, value );
|
return this._super( key, value );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -831,10 +831,10 @@ if ( $.uiBackCompat !== false ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Cache the original opacity of draggable element to reset later
|
// Cache the original opacity of draggable element to reset later
|
||||||
originalOpacity = self.dragEl.css( 'opacity' );
|
originalOpacity = self.dragEl.css( "opacity" );
|
||||||
|
|
||||||
// Set draggable element to new opacity
|
// Set draggable element to new opacity
|
||||||
self.dragEl.css( 'opacity', self.options.opacity );
|
self.dragEl.css( "opacity", self.options.opacity );
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -846,7 +846,7 @@ if ( $.uiBackCompat !== false ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Reset opacity
|
// Reset opacity
|
||||||
self.dragEl.css( 'opacity', originalOpacity );
|
self.dragEl.css( "opacity", originalOpacity );
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -877,9 +877,9 @@ if ( $.uiBackCompat !== false ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Cache the original css of draggable element to reset later
|
// Cache the original css of draggable element to reset later
|
||||||
originalLeft = self.dragEl.css( 'left' );
|
originalLeft = self.dragEl.css( "left" );
|
||||||
originalTop = self.dragEl.css( 'top' );
|
originalTop = self.dragEl.css( "top" );
|
||||||
originalPosition = self.dragEl.css( 'position' );
|
originalPosition = self.dragEl.css( "position" );
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -924,10 +924,10 @@ if ( $.uiBackCompat !== false ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Cache the original zIndex of draggable element to reset later
|
// Cache the original zIndex of draggable element to reset later
|
||||||
originalZIndex = self.dragEl.css( 'z-index' );
|
originalZIndex = self.dragEl.css( "z-index" );
|
||||||
|
|
||||||
// Set draggable element to new zIndex
|
// Set draggable element to new zIndex
|
||||||
self.dragEl.css( 'z-index', self.options.zIndex );
|
self.dragEl.css( "z-index", self.options.zIndex );
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -939,7 +939,7 @@ if ( $.uiBackCompat !== false ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Reset zIndex
|
// Reset zIndex
|
||||||
self.dragEl.css( 'z-index', originalZIndex );
|
self.dragEl.css( "z-index", originalZIndex );
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -1055,7 +1055,7 @@ if ( $.uiBackCompat !== false ) {
|
|||||||
$.widget( "ui.draggable", $.ui.draggable, {
|
$.widget( "ui.draggable", $.ui.draggable, {
|
||||||
options: {
|
options: {
|
||||||
snap: false,
|
snap: false,
|
||||||
snapMode: 'both',
|
snapMode: "both",
|
||||||
snapTolerance: 20
|
snapTolerance: 20
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -1066,7 +1066,7 @@ if ( $.uiBackCompat !== false ) {
|
|||||||
|
|
||||||
this._super();
|
this._super();
|
||||||
|
|
||||||
this.element.on( 'dragstart', function() {
|
this.element.on( "dragstart", function() {
|
||||||
|
|
||||||
// Nothing to do
|
// Nothing to do
|
||||||
if ( !inst.options.snap ) {
|
if ( !inst.options.snap ) {
|
||||||
@ -1077,7 +1077,7 @@ if ( $.uiBackCompat !== false ) {
|
|||||||
snapElements = [];
|
snapElements = [];
|
||||||
|
|
||||||
// Select either all draggable elements, or the selector that was passed in
|
// Select either all draggable elements, or the selector that was passed in
|
||||||
$( inst.options.snap === true ? ':data(ui-draggable)' : inst.options.snap ).each(function() {
|
$( inst.options.snap === true ? ":data(ui-draggable)" : inst.options.snap ).each(function() {
|
||||||
|
|
||||||
var el = $(this),
|
var el = $(this),
|
||||||
offset = el.offset();
|
offset = el.offset();
|
||||||
@ -1107,7 +1107,7 @@ if ( $.uiBackCompat !== false ) {
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
this.element.on( 'drag', function( event, ui ) {
|
this.element.on( "drag", function( event, ui ) {
|
||||||
|
|
||||||
// Nothing to do
|
// Nothing to do
|
||||||
if ( !inst.options.snap ) {
|
if ( !inst.options.snap ) {
|
||||||
@ -1136,7 +1136,7 @@ if ( $.uiBackCompat !== false ) {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(o.snapMode !== 'inner') {
|
if(o.snapMode !== "inner") {
|
||||||
ts = Math.abs(t - y2) <= d;
|
ts = Math.abs(t - y2) <= d;
|
||||||
bs = Math.abs(b - y1) <= d;
|
bs = Math.abs(b - y1) <= d;
|
||||||
ls = Math.abs(l - x2) <= d;
|
ls = Math.abs(l - x2) <= d;
|
||||||
@ -1157,7 +1157,7 @@ if ( $.uiBackCompat !== false ) {
|
|||||||
|
|
||||||
first = (ts || bs || ls || rs);
|
first = (ts || bs || ls || rs);
|
||||||
|
|
||||||
if(o.snapMode !== 'outer') {
|
if(o.snapMode !== "outer") {
|
||||||
ts = Math.abs(t - y1) <= d;
|
ts = Math.abs(t - y1) <= d;
|
||||||
bs = Math.abs(b - y2) <= d;
|
bs = Math.abs(b - y2) <= d;
|
||||||
ls = Math.abs(l - x1) <= d;
|
ls = Math.abs(l - x1) <= d;
|
||||||
@ -1195,7 +1195,7 @@ if ( $.uiBackCompat !== false ) {
|
|||||||
|
|
||||||
var mod = d === "absolute" ? 1 : -1,
|
var mod = d === "absolute" ? 1 : -1,
|
||||||
offset = {},
|
offset = {},
|
||||||
scroll = this.cssPosition === 'absolute' && !(this.scrollParent[0] !== document && $.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);
|
scroll = this.cssPosition === "absolute" && !(this.scrollParent[0] !== document && $.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);
|
||||||
|
|
||||||
$.extend(offset, {
|
$.extend(offset, {
|
||||||
parent: this._getParentOffset(),
|
parent: this._getParentOffset(),
|
||||||
@ -1207,13 +1207,13 @@ if ( $.uiBackCompat !== false ) {
|
|||||||
pos.top + // The absolute mouse position
|
pos.top + // The absolute mouse position
|
||||||
offset.relative.top * mod + // Only for relative positioned nodes: Relative offset from element to offset parent
|
offset.relative.top * mod + // Only for relative positioned nodes: Relative offset from element to offset parent
|
||||||
offset.parent.top * mod - // The offsetParent's offset without borders (offset + border)
|
offset.parent.top * mod - // The offsetParent's offset without borders (offset + border)
|
||||||
( ( this.cssPosition === 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod)
|
( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod)
|
||||||
),
|
),
|
||||||
left: (
|
left: (
|
||||||
pos.left + // The absolute mouse position
|
pos.left + // The absolute mouse position
|
||||||
offset.relative.left * mod + // Only for relative positioned nodes: Relative offset from element to offset parent
|
offset.relative.left * mod + // Only for relative positioned nodes: Relative offset from element to offset parent
|
||||||
offset.parent.left * mod - // The offsetParent's offset without borders (offset + border)
|
offset.parent.left * mod - // The offsetParent's offset without borders (offset + border)
|
||||||
( ( this.cssPosition === 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ) * mod)
|
( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ) * mod)
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1229,7 +1229,7 @@ if ( $.uiBackCompat !== false ) {
|
|||||||
// 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent
|
// 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent
|
||||||
// 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that
|
// 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that
|
||||||
// the scroll is included in the initial calculation of the offset of the parent, and never recalculated upon drag
|
// the scroll is included in the initial calculation of the offset of the parent, and never recalculated upon drag
|
||||||
if(this.cssPosition === 'absolute' && this.scrollParent[0] !== document && $.contains(this.scrollParent[0], this.offsetParent[0])) {
|
if(this.cssPosition === "absolute" && this.scrollParent[0] !== document && $.contains(this.scrollParent[0], this.offsetParent[0])) {
|
||||||
po.left += this.scrollParent.scrollLeft();
|
po.left += this.scrollParent.scrollLeft();
|
||||||
po.top += this.scrollParent.scrollTop();
|
po.top += this.scrollParent.scrollTop();
|
||||||
}
|
}
|
||||||
@ -1237,7 +1237,7 @@ if ( $.uiBackCompat !== false ) {
|
|||||||
//This needs to be actually done for all browsers, since pageX/pageY includes this information
|
//This needs to be actually done for all browsers, since pageX/pageY includes this information
|
||||||
//Ugly IE fix
|
//Ugly IE fix
|
||||||
if((this.offsetParent[0] === document.body) ||
|
if((this.offsetParent[0] === document.body) ||
|
||||||
(this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() === 'html' && $.ui.ie)) {
|
(this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() === "html" && $.ui.ie)) {
|
||||||
po = { top: 0, left: 0 };
|
po = { top: 0, left: 0 };
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1278,7 +1278,7 @@ if ( $.uiBackCompat !== false ) {
|
|||||||
this._super();
|
this._super();
|
||||||
|
|
||||||
this.element.on( "dragstart", function() {
|
this.element.on( "dragstart", function() {
|
||||||
drops = $(':data(ui-sortable)');
|
drops = $(":data(ui-sortable)");
|
||||||
});
|
});
|
||||||
|
|
||||||
// On drag, make sure top does not change so axis is locked
|
// On drag, make sure top does not change so axis is locked
|
||||||
@ -1289,7 +1289,7 @@ if ( $.uiBackCompat !== false ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
drops.each( function() {
|
drops.each( function() {
|
||||||
$(this).sortable('refreshPositions');
|
$(this).sortable("refreshPositions");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@ -1300,4 +1300,4 @@ if ( $.uiBackCompat !== false ) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
6
ui/jquery.ui.droppable.js
vendored
6
ui/jquery.ui.droppable.js
vendored
@ -123,11 +123,11 @@ $.extend( $.ui.droppable, {
|
|||||||
var draggableProportions = $.ui.droppable.draggableProportions,
|
var draggableProportions = $.ui.droppable.draggableProportions,
|
||||||
xHalf = ui.offset.left + draggableProportions.width / 2,
|
xHalf = ui.offset.left + draggableProportions.width / 2,
|
||||||
yHalf = ui.offset.top + draggableProportions.height / 2;
|
yHalf = ui.offset.top + draggableProportions.height / 2;
|
||||||
|
|
||||||
return this.offset.left < xHalf && edges.right > xHalf &&
|
return this.offset.left < xHalf && edges.right > xHalf &&
|
||||||
this.offset.top < yHalf && edges.bottom > yHalf;
|
this.offset.top < yHalf && edges.bottom > yHalf;
|
||||||
},
|
},
|
||||||
|
|
||||||
// Draggable overlaps droppable by at least one pixel
|
// Draggable overlaps droppable by at least one pixel
|
||||||
touch: function( event, edges, ui ) {
|
touch: function( event, edges, ui ) {
|
||||||
return this.offset.left < edges.draggableRight &&
|
return this.offset.left < edges.draggableRight &&
|
||||||
@ -135,7 +135,7 @@ $.extend( $.ui.droppable, {
|
|||||||
this.offset.top < edges.draggableBottom &&
|
this.offset.top < edges.draggableBottom &&
|
||||||
edges.bottom > ui.offset.top;
|
edges.bottom > ui.offset.top;
|
||||||
},
|
},
|
||||||
|
|
||||||
// Pointer overlaps droppable
|
// Pointer overlaps droppable
|
||||||
pointer: function( event, edges, ui ) {
|
pointer: function( event, edges, ui ) {
|
||||||
return ui.pointer.x >= this.offset.left && ui.pointer.x <= edges.right &&
|
return ui.pointer.x >= this.offset.left && ui.pointer.x <= edges.right &&
|
||||||
|
2
ui/jquery.ui.effect-transfer.js
vendored
2
ui/jquery.ui.effect-transfer.js
vendored
@ -28,7 +28,7 @@ $.effects.effect.transfer = function( o, done ) {
|
|||||||
width: target.innerWidth()
|
width: target.innerWidth()
|
||||||
},
|
},
|
||||||
startPosition = elem.offset(),
|
startPosition = elem.offset(),
|
||||||
transfer = $( '<div class="ui-effects-transfer"></div>' )
|
transfer = $( "<div class='ui-effects-transfer'></div>" )
|
||||||
.appendTo( document.body )
|
.appendTo( document.body )
|
||||||
.addClass( o.className )
|
.addClass( o.className )
|
||||||
.css({
|
.css({
|
||||||
|
2
ui/jquery.ui.effect.js
vendored
2
ui/jquery.ui.effect.js
vendored
@ -818,7 +818,7 @@ $.effects.animateClass = function( value, duration, easing, callback ) {
|
|||||||
$.each( arguments, function() {
|
$.each( arguments, function() {
|
||||||
var el = this.el;
|
var el = this.el;
|
||||||
$.each( this.diff, function(key) {
|
$.each( this.diff, function(key) {
|
||||||
el.css( key, '' );
|
el.css( key, "" );
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
20
ui/jquery.ui.menu.js
vendored
20
ui/jquery.ui.menu.js
vendored
@ -15,8 +15,6 @@
|
|||||||
*/
|
*/
|
||||||
(function( $, undefined ) {
|
(function( $, undefined ) {
|
||||||
|
|
||||||
var mouseHandled = false;
|
|
||||||
|
|
||||||
$.widget( "ui.menu", {
|
$.widget( "ui.menu", {
|
||||||
version: "@VERSION",
|
version: "@VERSION",
|
||||||
defaultElement: "<ul>",
|
defaultElement: "<ul>",
|
||||||
@ -40,6 +38,9 @@ $.widget( "ui.menu", {
|
|||||||
|
|
||||||
_create: function() {
|
_create: function() {
|
||||||
this.activeMenu = this.element;
|
this.activeMenu = this.element;
|
||||||
|
// flag used to prevent firing of the click handler
|
||||||
|
// as the event bubbles up through nested menus
|
||||||
|
this.mouseHandled = false;
|
||||||
this.element
|
this.element
|
||||||
.uniqueId()
|
.uniqueId()
|
||||||
.addClass( "ui-menu ui-widget ui-widget-content ui-corner-all" )
|
.addClass( "ui-menu ui-widget ui-widget-content ui-corner-all" )
|
||||||
@ -73,8 +74,8 @@ $.widget( "ui.menu", {
|
|||||||
},
|
},
|
||||||
"click .ui-menu-item:has(a)": function( event ) {
|
"click .ui-menu-item:has(a)": function( event ) {
|
||||||
var target = $( event.target ).closest( ".ui-menu-item" );
|
var target = $( event.target ).closest( ".ui-menu-item" );
|
||||||
if ( !mouseHandled && target.not( ".ui-state-disabled" ).length ) {
|
if ( !this.mouseHandled && target.not( ".ui-state-disabled" ).length ) {
|
||||||
mouseHandled = true;
|
this.mouseHandled = true;
|
||||||
|
|
||||||
this.select( event );
|
this.select( event );
|
||||||
// Open submenu on click
|
// Open submenu on click
|
||||||
@ -130,7 +131,7 @@ $.widget( "ui.menu", {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Reset the mouseHandled flag
|
// Reset the mouseHandled flag
|
||||||
mouseHandled = false;
|
this.mouseHandled = false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@ -343,6 +344,15 @@ $.widget( "ui.menu", {
|
|||||||
}[ this.options.role ];
|
}[ this.options.role ];
|
||||||
},
|
},
|
||||||
|
|
||||||
|
_setOption: function( key, value ) {
|
||||||
|
if ( key === "icons" ) {
|
||||||
|
this.element.find( ".ui-menu-icon" )
|
||||||
|
.removeClass( this.options.icons.submenu )
|
||||||
|
.addClass( value.submenu );
|
||||||
|
}
|
||||||
|
this._super( key, value );
|
||||||
|
},
|
||||||
|
|
||||||
focus: function( event, item ) {
|
focus: function( event, item ) {
|
||||||
var nested, focused;
|
var nested, focused;
|
||||||
this.blur( event, event && event.type === "focus" );
|
this.blur( event, event && event.type === "focus" );
|
||||||
|
30
ui/jquery.ui.mouse.js
vendored
30
ui/jquery.ui.mouse.js
vendored
@ -21,7 +21,7 @@ $( document ).mouseup( function() {
|
|||||||
$.widget("ui.mouse", {
|
$.widget("ui.mouse", {
|
||||||
version: "@VERSION",
|
version: "@VERSION",
|
||||||
options: {
|
options: {
|
||||||
cancel: 'input,textarea,button,select,option',
|
cancel: "input,textarea,button,select,option",
|
||||||
distance: 1,
|
distance: 1,
|
||||||
delay: 0
|
delay: 0
|
||||||
},
|
},
|
||||||
@ -29,12 +29,12 @@ $.widget("ui.mouse", {
|
|||||||
var that = this;
|
var that = this;
|
||||||
|
|
||||||
this.element
|
this.element
|
||||||
.bind('mousedown.'+this.widgetName, function(event) {
|
.bind("mousedown."+this.widgetName, function(event) {
|
||||||
return that._mouseDown(event);
|
return that._mouseDown(event);
|
||||||
})
|
})
|
||||||
.bind('click.'+this.widgetName, function(event) {
|
.bind("click."+this.widgetName, function(event) {
|
||||||
if (true === $.data(event.target, that.widgetName + '.preventClickEvent')) {
|
if (true === $.data(event.target, that.widgetName + ".preventClickEvent")) {
|
||||||
$.removeData(event.target, that.widgetName + '.preventClickEvent');
|
$.removeData(event.target, that.widgetName + ".preventClickEvent");
|
||||||
event.stopImmediatePropagation();
|
event.stopImmediatePropagation();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -46,11 +46,11 @@ $.widget("ui.mouse", {
|
|||||||
// TODO: make sure destroying one instance of mouse doesn't mess with
|
// TODO: make sure destroying one instance of mouse doesn't mess with
|
||||||
// other instances of mouse
|
// other instances of mouse
|
||||||
_mouseDestroy: function() {
|
_mouseDestroy: function() {
|
||||||
this.element.unbind('.'+this.widgetName);
|
this.element.unbind("."+this.widgetName);
|
||||||
if ( this._mouseMoveDelegate ) {
|
if ( this._mouseMoveDelegate ) {
|
||||||
$(document)
|
$(document)
|
||||||
.unbind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
|
.unbind("mousemove."+this.widgetName, this._mouseMoveDelegate)
|
||||||
.unbind('mouseup.'+this.widgetName, this._mouseUpDelegate);
|
.unbind("mouseup."+this.widgetName, this._mouseUpDelegate);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -88,8 +88,8 @@ $.widget("ui.mouse", {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Click event may never have fired (Gecko & Opera)
|
// Click event may never have fired (Gecko & Opera)
|
||||||
if (true === $.data(event.target, this.widgetName + '.preventClickEvent')) {
|
if (true === $.data(event.target, this.widgetName + ".preventClickEvent")) {
|
||||||
$.removeData(event.target, this.widgetName + '.preventClickEvent');
|
$.removeData(event.target, this.widgetName + ".preventClickEvent");
|
||||||
}
|
}
|
||||||
|
|
||||||
// these delegates are required to keep context
|
// these delegates are required to keep context
|
||||||
@ -100,8 +100,8 @@ $.widget("ui.mouse", {
|
|||||||
return that._mouseUp(event);
|
return that._mouseUp(event);
|
||||||
};
|
};
|
||||||
$(document)
|
$(document)
|
||||||
.bind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
|
.bind("mousemove."+this.widgetName, this._mouseMoveDelegate)
|
||||||
.bind('mouseup.'+this.widgetName, this._mouseUpDelegate);
|
.bind("mouseup."+this.widgetName, this._mouseUpDelegate);
|
||||||
|
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
||||||
@ -131,14 +131,14 @@ $.widget("ui.mouse", {
|
|||||||
|
|
||||||
_mouseUp: function(event) {
|
_mouseUp: function(event) {
|
||||||
$(document)
|
$(document)
|
||||||
.unbind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
|
.unbind("mousemove."+this.widgetName, this._mouseMoveDelegate)
|
||||||
.unbind('mouseup.'+this.widgetName, this._mouseUpDelegate);
|
.unbind("mouseup."+this.widgetName, this._mouseUpDelegate);
|
||||||
|
|
||||||
if (this._mouseStarted) {
|
if (this._mouseStarted) {
|
||||||
this._mouseStarted = false;
|
this._mouseStarted = false;
|
||||||
|
|
||||||
if (event.target === this._mouseDownEvent.target) {
|
if (event.target === this._mouseDownEvent.target) {
|
||||||
$.data(event.target, this.widgetName + '.preventClickEvent', true);
|
$.data(event.target, this.widgetName + ".preventClickEvent", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
this._mouseStop(event);
|
this._mouseStop(event);
|
||||||
|
140
ui/jquery.ui.resizable.js
vendored
140
ui/jquery.ui.resizable.js
vendored
@ -57,7 +57,7 @@ $.widget("ui.resizable", $.ui.mouse, {
|
|||||||
aspectRatio: o.aspectRatio,
|
aspectRatio: o.aspectRatio,
|
||||||
originalElement: this.element,
|
originalElement: this.element,
|
||||||
_proportionallyResizeElements: [],
|
_proportionallyResizeElements: [],
|
||||||
_helper: o.helper || o.ghost || o.animate ? o.helper || 'ui-resizable-helper' : null
|
_helper: o.helper || o.ghost || o.animate ? o.helper || "ui-resizable-helper" : null
|
||||||
});
|
});
|
||||||
|
|
||||||
//Wrap the element if it cannot hold child nodes
|
//Wrap the element if it cannot hold child nodes
|
||||||
@ -65,18 +65,18 @@ $.widget("ui.resizable", $.ui.mouse, {
|
|||||||
|
|
||||||
//Create a wrapper element and set the wrapper to the new current internal element
|
//Create a wrapper element and set the wrapper to the new current internal element
|
||||||
this.element.wrap(
|
this.element.wrap(
|
||||||
$('<div class="ui-wrapper" style="overflow: hidden;"></div>').css({
|
$("<div class='ui-wrapper' style='overflow: hidden;'></div>").css({
|
||||||
position: this.element.css('position'),
|
position: this.element.css("position"),
|
||||||
width: this.element.outerWidth(),
|
width: this.element.outerWidth(),
|
||||||
height: this.element.outerHeight(),
|
height: this.element.outerHeight(),
|
||||||
top: this.element.css('top'),
|
top: this.element.css("top"),
|
||||||
left: this.element.css('left')
|
left: this.element.css("left")
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
//Overwrite the original this.element
|
//Overwrite the original this.element
|
||||||
this.element = this.element.parent().data(
|
this.element = this.element.parent().data(
|
||||||
"ui-resizable", this.element.data('ui-resizable')
|
"ui-resizable", this.element.data("ui-resizable")
|
||||||
);
|
);
|
||||||
|
|
||||||
this.elementIsWrapper = true;
|
this.elementIsWrapper = true;
|
||||||
@ -86,25 +86,25 @@ $.widget("ui.resizable", $.ui.mouse, {
|
|||||||
this.originalElement.css({ marginLeft: 0, marginTop: 0, marginRight: 0, marginBottom: 0});
|
this.originalElement.css({ marginLeft: 0, marginTop: 0, marginRight: 0, marginBottom: 0});
|
||||||
|
|
||||||
//Prevent Safari textarea resize
|
//Prevent Safari textarea resize
|
||||||
this.originalResizeStyle = this.originalElement.css('resize');
|
this.originalResizeStyle = this.originalElement.css("resize");
|
||||||
this.originalElement.css('resize', 'none');
|
this.originalElement.css("resize", "none");
|
||||||
|
|
||||||
//Push the actual element to our proportionallyResize internal array
|
//Push the actual element to our proportionallyResize internal array
|
||||||
this._proportionallyResizeElements.push(this.originalElement.css({ position: 'static', zoom: 1, display: 'block' }));
|
this._proportionallyResizeElements.push(this.originalElement.css({ position: "static", zoom: 1, display: "block" }));
|
||||||
|
|
||||||
// avoid IE jump (hard set the margin)
|
// avoid IE jump (hard set the margin)
|
||||||
this.originalElement.css({ margin: this.originalElement.css('margin') });
|
this.originalElement.css({ margin: this.originalElement.css("margin") });
|
||||||
|
|
||||||
// fix handlers offset
|
// fix handlers offset
|
||||||
this._proportionallyResize();
|
this._proportionallyResize();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.handles = o.handles || (!$('.ui-resizable-handle', this.element).length ? "e,s,se" : { n: '.ui-resizable-n', e: '.ui-resizable-e', s: '.ui-resizable-s', w: '.ui-resizable-w', se: '.ui-resizable-se', sw: '.ui-resizable-sw', ne: '.ui-resizable-ne', nw: '.ui-resizable-nw' });
|
this.handles = o.handles || (!$(".ui-resizable-handle", this.element).length ? "e,s,se" : { n: ".ui-resizable-n", e: ".ui-resizable-e", s: ".ui-resizable-s", w: ".ui-resizable-w", se: ".ui-resizable-se", sw: ".ui-resizable-sw", ne: ".ui-resizable-ne", nw: ".ui-resizable-nw" });
|
||||||
if(this.handles.constructor === String) {
|
if(this.handles.constructor === String) {
|
||||||
|
|
||||||
if ( this.handles === 'all') {
|
if ( this.handles === "all") {
|
||||||
this.handles = 'n,e,s,w,se,sw,ne,nw';
|
this.handles = "n,e,s,w,se,sw,ne,nw";
|
||||||
}
|
}
|
||||||
|
|
||||||
n = this.handles.split(",");
|
n = this.handles.split(",");
|
||||||
@ -113,19 +113,19 @@ $.widget("ui.resizable", $.ui.mouse, {
|
|||||||
for(i = 0; i < n.length; i++) {
|
for(i = 0; i < n.length; i++) {
|
||||||
|
|
||||||
handle = $.trim(n[i]);
|
handle = $.trim(n[i]);
|
||||||
hname = 'ui-resizable-'+handle;
|
hname = "ui-resizable-"+handle;
|
||||||
axis = $('<div class="ui-resizable-handle ' + hname + '"></div>');
|
axis = $("<div class='ui-resizable-handle " + hname + "'></div>");
|
||||||
|
|
||||||
// Apply zIndex to all handles - see #7960
|
// Apply zIndex to all handles - see #7960
|
||||||
axis.css({ zIndex: o.zIndex });
|
axis.css({ zIndex: o.zIndex });
|
||||||
|
|
||||||
//TODO : What's going on here?
|
//TODO : What's going on here?
|
||||||
if ('se' === handle) {
|
if ("se" === handle) {
|
||||||
axis.addClass('ui-icon ui-icon-gripsmall-diagonal-se');
|
axis.addClass("ui-icon ui-icon-gripsmall-diagonal-se");
|
||||||
}
|
}
|
||||||
|
|
||||||
//Insert into internal handles object and append to element
|
//Insert into internal handles object and append to element
|
||||||
this.handles[handle] = '.ui-resizable-'+handle;
|
this.handles[handle] = ".ui-resizable-"+handle;
|
||||||
this.element.append(axis);
|
this.element.append(axis);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -152,10 +152,10 @@ $.widget("ui.resizable", $.ui.mouse, {
|
|||||||
padWrapper = /sw|ne|nw|se|n|s/.test(i) ? axis.outerHeight() : axis.outerWidth();
|
padWrapper = /sw|ne|nw|se|n|s/.test(i) ? axis.outerHeight() : axis.outerWidth();
|
||||||
|
|
||||||
//The padding type i have to apply...
|
//The padding type i have to apply...
|
||||||
padPos = [ 'padding',
|
padPos = [ "padding",
|
||||||
/ne|nw|n/.test(i) ? 'Top' :
|
/ne|nw|n/.test(i) ? "Top" :
|
||||||
/se|sw|s/.test(i) ? 'Bottom' :
|
/se|sw|s/.test(i) ? "Bottom" :
|
||||||
/^e$/.test(i) ? 'Right' : 'Left' ].join("");
|
/^e$/.test(i) ? "Right" : "Left" ].join("");
|
||||||
|
|
||||||
target.css(padPos, padWrapper);
|
target.css(padPos, padWrapper);
|
||||||
|
|
||||||
@ -173,7 +173,7 @@ $.widget("ui.resizable", $.ui.mouse, {
|
|||||||
//TODO: make renderAxis a prototype function
|
//TODO: make renderAxis a prototype function
|
||||||
this._renderAxis(this.element);
|
this._renderAxis(this.element);
|
||||||
|
|
||||||
this._handles = $('.ui-resizable-handle', this.element)
|
this._handles = $(".ui-resizable-handle", this.element)
|
||||||
.disableSelection();
|
.disableSelection();
|
||||||
|
|
||||||
//Matching axis name
|
//Matching axis name
|
||||||
@ -183,7 +183,7 @@ $.widget("ui.resizable", $.ui.mouse, {
|
|||||||
axis = this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i);
|
axis = this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i);
|
||||||
}
|
}
|
||||||
//Axis, default = se
|
//Axis, default = se
|
||||||
that.axis = axis && axis[1] ? axis[1] : 'se';
|
that.axis = axis && axis[1] ? axis[1] : "se";
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -222,7 +222,7 @@ $.widget("ui.resizable", $.ui.mouse, {
|
|||||||
var wrapper,
|
var wrapper,
|
||||||
_destroy = function(exp) {
|
_destroy = function(exp) {
|
||||||
$(exp).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing")
|
$(exp).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing")
|
||||||
.removeData("resizable").removeData("ui-resizable").unbind(".resizable").find('.ui-resizable-handle').remove();
|
.removeData("resizable").removeData("ui-resizable").unbind(".resizable").find(".ui-resizable-handle").remove();
|
||||||
};
|
};
|
||||||
|
|
||||||
//TODO: Unwrap at same DOM position
|
//TODO: Unwrap at same DOM position
|
||||||
@ -230,16 +230,16 @@ $.widget("ui.resizable", $.ui.mouse, {
|
|||||||
_destroy(this.element);
|
_destroy(this.element);
|
||||||
wrapper = this.element;
|
wrapper = this.element;
|
||||||
this.originalElement.css({
|
this.originalElement.css({
|
||||||
position: wrapper.css('position'),
|
position: wrapper.css("position"),
|
||||||
width: wrapper.outerWidth(),
|
width: wrapper.outerWidth(),
|
||||||
height: wrapper.outerHeight(),
|
height: wrapper.outerHeight(),
|
||||||
top: wrapper.css('top'),
|
top: wrapper.css("top"),
|
||||||
left: wrapper.css('left')
|
left: wrapper.css("left")
|
||||||
}).insertAfter( wrapper );
|
}).insertAfter( wrapper );
|
||||||
wrapper.remove();
|
wrapper.remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.originalElement.css('resize', this.originalResizeStyle);
|
this.originalElement.css("resize", this.originalResizeStyle);
|
||||||
_destroy(this.originalElement);
|
_destroy(this.originalElement);
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
@ -269,16 +269,16 @@ $.widget("ui.resizable", $.ui.mouse, {
|
|||||||
this.resizing = true;
|
this.resizing = true;
|
||||||
|
|
||||||
// bugfix for http://dev.jquery.com/ticket/1749
|
// bugfix for http://dev.jquery.com/ticket/1749
|
||||||
if ( (/absolute/).test( el.css('position') ) ) {
|
if ( (/absolute/).test( el.css("position") ) ) {
|
||||||
el.css({ position: 'absolute', top: el.css('top'), left: el.css('left') });
|
el.css({ position: "absolute", top: el.css("top"), left: el.css("left") });
|
||||||
} else if (el.is('.ui-draggable')) {
|
} else if (el.is(".ui-draggable")) {
|
||||||
el.css({ position: 'absolute', top: iniPos.top, left: iniPos.left });
|
el.css({ position: "absolute", top: iniPos.top, left: iniPos.left });
|
||||||
}
|
}
|
||||||
|
|
||||||
this._renderProxy();
|
this._renderProxy();
|
||||||
|
|
||||||
curleft = num(this.helper.css('left'));
|
curleft = num(this.helper.css("left"));
|
||||||
curtop = num(this.helper.css('top'));
|
curtop = num(this.helper.css("top"));
|
||||||
|
|
||||||
if (o.containment) {
|
if (o.containment) {
|
||||||
curleft += $(o.containment).scrollLeft() || 0;
|
curleft += $(o.containment).scrollLeft() || 0;
|
||||||
@ -295,10 +295,10 @@ $.widget("ui.resizable", $.ui.mouse, {
|
|||||||
this.originalMousePosition = { left: event.pageX, top: event.pageY };
|
this.originalMousePosition = { left: event.pageX, top: event.pageY };
|
||||||
|
|
||||||
//Aspect Ratio
|
//Aspect Ratio
|
||||||
this.aspectRatio = (typeof o.aspectRatio === 'number') ? o.aspectRatio : ((this.originalSize.width / this.originalSize.height) || 1);
|
this.aspectRatio = (typeof o.aspectRatio === "number") ? o.aspectRatio : ((this.originalSize.width / this.originalSize.height) || 1);
|
||||||
|
|
||||||
cursor = $('.ui-resizable-' + this.axis).css('cursor');
|
cursor = $(".ui-resizable-" + this.axis).css("cursor");
|
||||||
$('body').css('cursor', cursor === 'auto' ? this.axis + '-resize' : cursor);
|
$("body").css("cursor", cursor === "auto" ? this.axis + "-resize" : cursor);
|
||||||
|
|
||||||
el.addClass("ui-resizable-resizing");
|
el.addClass("ui-resizable-resizing");
|
||||||
this._propagate("start", event);
|
this._propagate("start", event);
|
||||||
@ -360,7 +360,7 @@ $.widget("ui.resizable", $.ui.mouse, {
|
|||||||
|
|
||||||
// Call the user callback if the element was resized
|
// Call the user callback if the element was resized
|
||||||
if ( ! $.isEmptyObject(props) ) {
|
if ( ! $.isEmptyObject(props) ) {
|
||||||
this._trigger('resize', event, this.ui());
|
this._trigger("resize", event, this.ui());
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -376,12 +376,12 @@ $.widget("ui.resizable", $.ui.mouse, {
|
|||||||
|
|
||||||
pr = this._proportionallyResizeElements;
|
pr = this._proportionallyResizeElements;
|
||||||
ista = pr.length && (/textarea/i).test(pr[0].nodeName);
|
ista = pr.length && (/textarea/i).test(pr[0].nodeName);
|
||||||
soffseth = ista && $.ui.hasScroll(pr[0], 'left') /* TODO - jump height */ ? 0 : that.sizeDiff.height;
|
soffseth = ista && $.ui.hasScroll(pr[0], "left") /* TODO - jump height */ ? 0 : that.sizeDiff.height;
|
||||||
soffsetw = ista ? 0 : that.sizeDiff.width;
|
soffsetw = ista ? 0 : that.sizeDiff.width;
|
||||||
|
|
||||||
s = { width: (that.helper.width() - soffsetw), height: (that.helper.height() - soffseth) };
|
s = { width: (that.helper.width() - soffsetw), height: (that.helper.height() - soffseth) };
|
||||||
left = (parseInt(that.element.css('left'), 10) + (that.position.left - that.originalPosition.left)) || null;
|
left = (parseInt(that.element.css("left"), 10) + (that.position.left - that.originalPosition.left)) || null;
|
||||||
top = (parseInt(that.element.css('top'), 10) + (that.position.top - that.originalPosition.top)) || null;
|
top = (parseInt(that.element.css("top"), 10) + (that.position.top - that.originalPosition.top)) || null;
|
||||||
|
|
||||||
if (!o.animate) {
|
if (!o.animate) {
|
||||||
this.element.css($.extend(s, { top: top, left: left }));
|
this.element.css($.extend(s, { top: top, left: left }));
|
||||||
@ -395,7 +395,7 @@ $.widget("ui.resizable", $.ui.mouse, {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$('body').css('cursor', 'auto');
|
$("body").css("cursor", "auto");
|
||||||
|
|
||||||
this.element.removeClass("ui-resizable-resizing");
|
this.element.removeClass("ui-resizable-resizing");
|
||||||
|
|
||||||
@ -472,11 +472,11 @@ $.widget("ui.resizable", $.ui.mouse, {
|
|||||||
data.height = (data.width / this.aspectRatio);
|
data.height = (data.width / this.aspectRatio);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (a === 'sw') {
|
if (a === "sw") {
|
||||||
data.left = cpos.left + (csize.width - data.width);
|
data.left = cpos.left + (csize.width - data.width);
|
||||||
data.top = null;
|
data.top = null;
|
||||||
}
|
}
|
||||||
if (a === 'nw') {
|
if (a === "nw") {
|
||||||
data.top = cpos.top + (csize.height - data.height);
|
data.top = cpos.top + (csize.height - data.height);
|
||||||
data.left = cpos.left + (csize.width - data.width);
|
data.left = cpos.left + (csize.width - data.width);
|
||||||
}
|
}
|
||||||
@ -544,8 +544,8 @@ $.widget("ui.resizable", $.ui.mouse, {
|
|||||||
|
|
||||||
if (!this.borderDif) {
|
if (!this.borderDif) {
|
||||||
this.borderDif = [];
|
this.borderDif = [];
|
||||||
borders = [prel.css('borderTopWidth'), prel.css('borderRightWidth'), prel.css('borderBottomWidth'), prel.css('borderLeftWidth')];
|
borders = [prel.css("borderTopWidth"), prel.css("borderRightWidth"), prel.css("borderBottomWidth"), prel.css("borderLeftWidth")];
|
||||||
paddings = [prel.css('paddingTop'), prel.css('paddingRight'), prel.css('paddingBottom'), prel.css('paddingLeft')];
|
paddings = [prel.css("paddingTop"), prel.css("paddingRight"), prel.css("paddingBottom"), prel.css("paddingLeft")];
|
||||||
|
|
||||||
for ( j = 0; j < borders.length; j++ ) {
|
for ( j = 0; j < borders.length; j++ ) {
|
||||||
this.borderDif[ j ] = ( parseInt( borders[ j ], 10 ) || 0 ) + ( parseInt( paddings[ j ], 10 ) || 0 );
|
this.borderDif[ j ] = ( parseInt( borders[ j ], 10 ) || 0 ) + ( parseInt( paddings[ j ], 10 ) || 0 );
|
||||||
@ -568,14 +568,14 @@ $.widget("ui.resizable", $.ui.mouse, {
|
|||||||
|
|
||||||
if(this._helper) {
|
if(this._helper) {
|
||||||
|
|
||||||
this.helper = this.helper || $('<div style="overflow:hidden;"></div>');
|
this.helper = this.helper || $("<div style='overflow:hidden;'></div>");
|
||||||
|
|
||||||
this.helper.addClass(this._helper).css({
|
this.helper.addClass(this._helper).css({
|
||||||
width: this.element.outerWidth() - 1,
|
width: this.element.outerWidth() - 1,
|
||||||
height: this.element.outerHeight() - 1,
|
height: this.element.outerHeight() - 1,
|
||||||
position: 'absolute',
|
position: "absolute",
|
||||||
left: this.elementOffset.left +'px',
|
left: this.elementOffset.left +"px",
|
||||||
top: this.elementOffset.top +'px',
|
top: this.elementOffset.top +"px",
|
||||||
zIndex: ++o.zIndex //TODO: Don't modify option
|
zIndex: ++o.zIndex //TODO: Don't modify option
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -650,11 +650,11 @@ $.ui.plugin.add("resizable", "animate", {
|
|||||||
o = that.options,
|
o = that.options,
|
||||||
pr = that._proportionallyResizeElements,
|
pr = that._proportionallyResizeElements,
|
||||||
ista = pr.length && (/textarea/i).test(pr[0].nodeName),
|
ista = pr.length && (/textarea/i).test(pr[0].nodeName),
|
||||||
soffseth = ista && $.ui.hasScroll(pr[0], 'left') /* TODO - jump height */ ? 0 : that.sizeDiff.height,
|
soffseth = ista && $.ui.hasScroll(pr[0], "left") /* TODO - jump height */ ? 0 : that.sizeDiff.height,
|
||||||
soffsetw = ista ? 0 : that.sizeDiff.width,
|
soffsetw = ista ? 0 : that.sizeDiff.width,
|
||||||
style = { width: (that.size.width - soffsetw), height: (that.size.height - soffseth) },
|
style = { width: (that.size.width - soffsetw), height: (that.size.height - soffseth) },
|
||||||
left = (parseInt(that.element.css('left'), 10) + (that.position.left - that.originalPosition.left)) || null,
|
left = (parseInt(that.element.css("left"), 10) + (that.position.left - that.originalPosition.left)) || null,
|
||||||
top = (parseInt(that.element.css('top'), 10) + (that.position.top - that.originalPosition.top)) || null;
|
top = (parseInt(that.element.css("top"), 10) + (that.position.top - that.originalPosition.top)) || null;
|
||||||
|
|
||||||
that.element.animate(
|
that.element.animate(
|
||||||
$.extend(style, top && left ? { top: top, left: left } : {}), {
|
$.extend(style, top && left ? { top: top, left: left } : {}), {
|
||||||
@ -663,10 +663,10 @@ $.ui.plugin.add("resizable", "animate", {
|
|||||||
step: function() {
|
step: function() {
|
||||||
|
|
||||||
var data = {
|
var data = {
|
||||||
width: parseInt(that.element.css('width'), 10),
|
width: parseInt(that.element.css("width"), 10),
|
||||||
height: parseInt(that.element.css('height'), 10),
|
height: parseInt(that.element.css("height"), 10),
|
||||||
top: parseInt(that.element.css('top'), 10),
|
top: parseInt(that.element.css("top"), 10),
|
||||||
left: parseInt(that.element.css('left'), 10)
|
left: parseInt(that.element.css("left"), 10)
|
||||||
};
|
};
|
||||||
|
|
||||||
if (pr && pr.length) {
|
if (pr && pr.length) {
|
||||||
@ -740,7 +740,7 @@ $.ui.plugin.add("resizable", "containment", {
|
|||||||
pRatio = that._aspectRatio || event.shiftKey,
|
pRatio = that._aspectRatio || event.shiftKey,
|
||||||
cop = { top:0, left:0 }, ce = that.containerElement;
|
cop = { top:0, left:0 }, ce = that.containerElement;
|
||||||
|
|
||||||
if (ce[0] !== document && (/static/).test(ce.css('position'))) {
|
if (ce[0] !== document && (/static/).test(ce.css("position"))) {
|
||||||
cop = co;
|
cop = co;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -767,7 +767,7 @@ $.ui.plugin.add("resizable", "containment", {
|
|||||||
hoset = Math.abs( (that._helper ? that.offset.top - cop.top : (that.offset.top - co.top)) + that.sizeDiff.height );
|
hoset = Math.abs( (that._helper ? that.offset.top - cop.top : (that.offset.top - co.top)) + that.sizeDiff.height );
|
||||||
|
|
||||||
isParent = that.containerElement.get(0) === that.element.parent().get(0);
|
isParent = that.containerElement.get(0) === that.element.parent().get(0);
|
||||||
isOffsetRelative = /relative|absolute/.test(that.containerElement.css('position'));
|
isOffsetRelative = /relative|absolute/.test(that.containerElement.css("position"));
|
||||||
|
|
||||||
if(isParent && isOffsetRelative) {
|
if(isParent && isOffsetRelative) {
|
||||||
woset -= that.parentData.left;
|
woset -= that.parentData.left;
|
||||||
@ -799,11 +799,11 @@ $.ui.plugin.add("resizable", "containment", {
|
|||||||
w = helper.outerWidth() - that.sizeDiff.width,
|
w = helper.outerWidth() - that.sizeDiff.width,
|
||||||
h = helper.outerHeight() - that.sizeDiff.height;
|
h = helper.outerHeight() - that.sizeDiff.height;
|
||||||
|
|
||||||
if (that._helper && !o.animate && (/relative/).test(ce.css('position'))) {
|
if (that._helper && !o.animate && (/relative/).test(ce.css("position"))) {
|
||||||
$(this).css({ left: ho.left - cop.left - co.left, width: w, height: h });
|
$(this).css({ left: ho.left - cop.left - co.left, width: w, height: h });
|
||||||
}
|
}
|
||||||
|
|
||||||
if (that._helper && !o.animate && (/static/).test(ce.css('position'))) {
|
if (that._helper && !o.animate && (/static/).test(ce.css("position"))) {
|
||||||
$(this).css({ left: ho.left - cop.left - co.left, width: w, height: h });
|
$(this).css({ left: ho.left - cop.left - co.left, width: w, height: h });
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -820,12 +820,12 @@ $.ui.plugin.add("resizable", "alsoResize", {
|
|||||||
var el = $(this);
|
var el = $(this);
|
||||||
el.data("ui-resizable-alsoresize", {
|
el.data("ui-resizable-alsoresize", {
|
||||||
width: parseInt(el.width(), 10), height: parseInt(el.height(), 10),
|
width: parseInt(el.width(), 10), height: parseInt(el.height(), 10),
|
||||||
left: parseInt(el.css('left'), 10), top: parseInt(el.css('top'), 10)
|
left: parseInt(el.css("left"), 10), top: parseInt(el.css("top"), 10)
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
if (typeof(o.alsoResize) === 'object' && !o.alsoResize.parentNode) {
|
if (typeof(o.alsoResize) === "object" && !o.alsoResize.parentNode) {
|
||||||
if (o.alsoResize.length) { o.alsoResize = o.alsoResize[0]; _store(o.alsoResize); }
|
if (o.alsoResize.length) { o.alsoResize = o.alsoResize[0]; _store(o.alsoResize); }
|
||||||
else { $.each(o.alsoResize, function (exp) { _store(exp); }); }
|
else { $.each(o.alsoResize, function (exp) { _store(exp); }); }
|
||||||
}else{
|
}else{
|
||||||
@ -846,7 +846,7 @@ $.ui.plugin.add("resizable", "alsoResize", {
|
|||||||
_alsoResize = function (exp, c) {
|
_alsoResize = function (exp, c) {
|
||||||
$(exp).each(function() {
|
$(exp).each(function() {
|
||||||
var el = $(this), start = $(this).data("ui-resizable-alsoresize"), style = {},
|
var el = $(this), start = $(this).data("ui-resizable-alsoresize"), style = {},
|
||||||
css = c && c.length ? c : el.parents(ui.originalElement[0]).length ? ['width', 'height'] : ['width', 'height', 'top', 'left'];
|
css = c && c.length ? c : el.parents(ui.originalElement[0]).length ? ["width", "height"] : ["width", "height", "top", "left"];
|
||||||
|
|
||||||
$.each(css, function (i, prop) {
|
$.each(css, function (i, prop) {
|
||||||
var sum = (start[prop]||0) + (delta[prop]||0);
|
var sum = (start[prop]||0) + (delta[prop]||0);
|
||||||
@ -859,7 +859,7 @@ $.ui.plugin.add("resizable", "alsoResize", {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
if (typeof(o.alsoResize) === 'object' && !o.alsoResize.nodeType) {
|
if (typeof(o.alsoResize) === "object" && !o.alsoResize.nodeType) {
|
||||||
$.each(o.alsoResize, function (exp, c) { _alsoResize(exp, c); });
|
$.each(o.alsoResize, function (exp, c) { _alsoResize(exp, c); });
|
||||||
}else{
|
}else{
|
||||||
_alsoResize(o.alsoResize);
|
_alsoResize(o.alsoResize);
|
||||||
@ -879,9 +879,9 @@ $.ui.plugin.add("resizable", "ghost", {
|
|||||||
|
|
||||||
that.ghost = that.originalElement.clone();
|
that.ghost = that.originalElement.clone();
|
||||||
that.ghost
|
that.ghost
|
||||||
.css({ opacity: 0.25, display: 'block', position: 'relative', height: cs.height, width: cs.width, margin: 0, left: 0, top: 0 })
|
.css({ opacity: 0.25, display: "block", position: "relative", height: cs.height, width: cs.width, margin: 0, left: 0, top: 0 })
|
||||||
.addClass('ui-resizable-ghost')
|
.addClass("ui-resizable-ghost")
|
||||||
.addClass(typeof o.ghost === 'string' ? o.ghost : '');
|
.addClass(typeof o.ghost === "string" ? o.ghost : "");
|
||||||
|
|
||||||
that.ghost.appendTo(that.helper);
|
that.ghost.appendTo(that.helper);
|
||||||
|
|
||||||
@ -890,7 +890,7 @@ $.ui.plugin.add("resizable", "ghost", {
|
|||||||
resize: function(){
|
resize: function(){
|
||||||
var that = $(this).data("ui-resizable");
|
var that = $(this).data("ui-resizable");
|
||||||
if (that.ghost) {
|
if (that.ghost) {
|
||||||
that.ghost.css({ position: 'relative', height: that.size.height, width: that.size.width });
|
that.ghost.css({ position: "relative", height: that.size.height, width: that.size.width });
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
54
ui/jquery.ui.selectable.js
vendored
54
ui/jquery.ui.selectable.js
vendored
@ -18,11 +18,11 @@
|
|||||||
$.widget("ui.selectable", $.ui.mouse, {
|
$.widget("ui.selectable", $.ui.mouse, {
|
||||||
version: "@VERSION",
|
version: "@VERSION",
|
||||||
options: {
|
options: {
|
||||||
appendTo: 'body',
|
appendTo: "body",
|
||||||
autoRefresh: true,
|
autoRefresh: true,
|
||||||
distance: 0,
|
distance: 0,
|
||||||
filter: '*',
|
filter: "*",
|
||||||
tolerance: 'touch'
|
tolerance: "touch"
|
||||||
},
|
},
|
||||||
_create: function() {
|
_create: function() {
|
||||||
var selectees,
|
var selectees,
|
||||||
@ -47,9 +47,9 @@ $.widget("ui.selectable", $.ui.mouse, {
|
|||||||
right: pos.left + $this.outerWidth(),
|
right: pos.left + $this.outerWidth(),
|
||||||
bottom: pos.top + $this.outerHeight(),
|
bottom: pos.top + $this.outerHeight(),
|
||||||
startselected: false,
|
startselected: false,
|
||||||
selected: $this.hasClass('ui-selected'),
|
selected: $this.hasClass("ui-selected"),
|
||||||
selecting: $this.hasClass('ui-selecting'),
|
selecting: $this.hasClass("ui-selecting"),
|
||||||
unselecting: $this.hasClass('ui-unselecting')
|
unselecting: $this.hasClass("ui-unselecting")
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@ -88,8 +88,8 @@ $.widget("ui.selectable", $.ui.mouse, {
|
|||||||
$(options.appendTo).append(this.helper);
|
$(options.appendTo).append(this.helper);
|
||||||
// position helper (lasso)
|
// position helper (lasso)
|
||||||
this.helper.css({
|
this.helper.css({
|
||||||
"left": event.clientX,
|
"left": event.pageX,
|
||||||
"top": event.clientY,
|
"top": event.pageY,
|
||||||
"width": 0,
|
"width": 0,
|
||||||
"height": 0
|
"height": 0
|
||||||
});
|
});
|
||||||
@ -98,13 +98,13 @@ $.widget("ui.selectable", $.ui.mouse, {
|
|||||||
this.refresh();
|
this.refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.selectees.filter('.ui-selected').each(function() {
|
this.selectees.filter(".ui-selected").each(function() {
|
||||||
var selectee = $.data(this, "selectable-item");
|
var selectee = $.data(this, "selectable-item");
|
||||||
selectee.startselected = true;
|
selectee.startselected = true;
|
||||||
if (!event.metaKey && !event.ctrlKey) {
|
if (!event.metaKey && !event.ctrlKey) {
|
||||||
selectee.$element.removeClass('ui-selected');
|
selectee.$element.removeClass("ui-selected");
|
||||||
selectee.selected = false;
|
selectee.selected = false;
|
||||||
selectee.$element.addClass('ui-unselecting');
|
selectee.$element.addClass("ui-unselecting");
|
||||||
selectee.unselecting = true;
|
selectee.unselecting = true;
|
||||||
// selectable UNSELECTING callback
|
// selectable UNSELECTING callback
|
||||||
that._trigger("unselecting", event, {
|
that._trigger("unselecting", event, {
|
||||||
@ -117,7 +117,7 @@ $.widget("ui.selectable", $.ui.mouse, {
|
|||||||
var doSelect,
|
var doSelect,
|
||||||
selectee = $.data(this, "selectable-item");
|
selectee = $.data(this, "selectable-item");
|
||||||
if (selectee) {
|
if (selectee) {
|
||||||
doSelect = (!event.metaKey && !event.ctrlKey) || !selectee.$element.hasClass('ui-selected');
|
doSelect = (!event.metaKey && !event.ctrlKey) || !selectee.$element.hasClass("ui-selected");
|
||||||
selectee.$element
|
selectee.$element
|
||||||
.removeClass(doSelect ? "ui-unselecting" : "ui-selected")
|
.removeClass(doSelect ? "ui-unselecting" : "ui-selected")
|
||||||
.addClass(doSelect ? "ui-selecting" : "ui-unselecting");
|
.addClass(doSelect ? "ui-selecting" : "ui-unselecting");
|
||||||
@ -169,24 +169,24 @@ $.widget("ui.selectable", $.ui.mouse, {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options.tolerance === 'touch') {
|
if (options.tolerance === "touch") {
|
||||||
hit = ( !(selectee.left > x2 || selectee.right < x1 || selectee.top > y2 || selectee.bottom < y1) );
|
hit = ( !(selectee.left > x2 || selectee.right < x1 || selectee.top > y2 || selectee.bottom < y1) );
|
||||||
} else if (options.tolerance === 'fit') {
|
} else if (options.tolerance === "fit") {
|
||||||
hit = (selectee.left > x1 && selectee.right < x2 && selectee.top > y1 && selectee.bottom < y2);
|
hit = (selectee.left > x1 && selectee.right < x2 && selectee.top > y1 && selectee.bottom < y2);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hit) {
|
if (hit) {
|
||||||
// SELECT
|
// SELECT
|
||||||
if (selectee.selected) {
|
if (selectee.selected) {
|
||||||
selectee.$element.removeClass('ui-selected');
|
selectee.$element.removeClass("ui-selected");
|
||||||
selectee.selected = false;
|
selectee.selected = false;
|
||||||
}
|
}
|
||||||
if (selectee.unselecting) {
|
if (selectee.unselecting) {
|
||||||
selectee.$element.removeClass('ui-unselecting');
|
selectee.$element.removeClass("ui-unselecting");
|
||||||
selectee.unselecting = false;
|
selectee.unselecting = false;
|
||||||
}
|
}
|
||||||
if (!selectee.selecting) {
|
if (!selectee.selecting) {
|
||||||
selectee.$element.addClass('ui-selecting');
|
selectee.$element.addClass("ui-selecting");
|
||||||
selectee.selecting = true;
|
selectee.selecting = true;
|
||||||
// selectable SELECTING callback
|
// selectable SELECTING callback
|
||||||
that._trigger("selecting", event, {
|
that._trigger("selecting", event, {
|
||||||
@ -197,15 +197,15 @@ $.widget("ui.selectable", $.ui.mouse, {
|
|||||||
// UNSELECT
|
// UNSELECT
|
||||||
if (selectee.selecting) {
|
if (selectee.selecting) {
|
||||||
if ((event.metaKey || event.ctrlKey) && selectee.startselected) {
|
if ((event.metaKey || event.ctrlKey) && selectee.startselected) {
|
||||||
selectee.$element.removeClass('ui-selecting');
|
selectee.$element.removeClass("ui-selecting");
|
||||||
selectee.selecting = false;
|
selectee.selecting = false;
|
||||||
selectee.$element.addClass('ui-selected');
|
selectee.$element.addClass("ui-selected");
|
||||||
selectee.selected = true;
|
selectee.selected = true;
|
||||||
} else {
|
} else {
|
||||||
selectee.$element.removeClass('ui-selecting');
|
selectee.$element.removeClass("ui-selecting");
|
||||||
selectee.selecting = false;
|
selectee.selecting = false;
|
||||||
if (selectee.startselected) {
|
if (selectee.startselected) {
|
||||||
selectee.$element.addClass('ui-unselecting');
|
selectee.$element.addClass("ui-unselecting");
|
||||||
selectee.unselecting = true;
|
selectee.unselecting = true;
|
||||||
}
|
}
|
||||||
// selectable UNSELECTING callback
|
// selectable UNSELECTING callback
|
||||||
@ -216,10 +216,10 @@ $.widget("ui.selectable", $.ui.mouse, {
|
|||||||
}
|
}
|
||||||
if (selectee.selected) {
|
if (selectee.selected) {
|
||||||
if (!event.metaKey && !event.ctrlKey && !selectee.startselected) {
|
if (!event.metaKey && !event.ctrlKey && !selectee.startselected) {
|
||||||
selectee.$element.removeClass('ui-selected');
|
selectee.$element.removeClass("ui-selected");
|
||||||
selectee.selected = false;
|
selectee.selected = false;
|
||||||
|
|
||||||
selectee.$element.addClass('ui-unselecting');
|
selectee.$element.addClass("ui-unselecting");
|
||||||
selectee.unselecting = true;
|
selectee.unselecting = true;
|
||||||
// selectable UNSELECTING callback
|
// selectable UNSELECTING callback
|
||||||
that._trigger("unselecting", event, {
|
that._trigger("unselecting", event, {
|
||||||
@ -238,18 +238,18 @@ $.widget("ui.selectable", $.ui.mouse, {
|
|||||||
|
|
||||||
this.dragged = false;
|
this.dragged = false;
|
||||||
|
|
||||||
$('.ui-unselecting', this.element[0]).each(function() {
|
$(".ui-unselecting", this.element[0]).each(function() {
|
||||||
var selectee = $.data(this, "selectable-item");
|
var selectee = $.data(this, "selectable-item");
|
||||||
selectee.$element.removeClass('ui-unselecting');
|
selectee.$element.removeClass("ui-unselecting");
|
||||||
selectee.unselecting = false;
|
selectee.unselecting = false;
|
||||||
selectee.startselected = false;
|
selectee.startselected = false;
|
||||||
that._trigger("unselected", event, {
|
that._trigger("unselected", event, {
|
||||||
unselected: selectee.element
|
unselected: selectee.element
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
$('.ui-selecting', this.element[0]).each(function() {
|
$(".ui-selecting", this.element[0]).each(function() {
|
||||||
var selectee = $.data(this, "selectable-item");
|
var selectee = $.data(this, "selectable-item");
|
||||||
selectee.$element.removeClass('ui-selecting').addClass('ui-selected');
|
selectee.$element.removeClass("ui-selecting").addClass("ui-selected");
|
||||||
selectee.selecting = false;
|
selectee.selecting = false;
|
||||||
selectee.selected = true;
|
selectee.selected = true;
|
||||||
selectee.startselected = true;
|
selectee.startselected = true;
|
||||||
|
20
ui/jquery.ui.sortable.js
vendored
20
ui/jquery.ui.sortable.js
vendored
@ -28,7 +28,7 @@ function copy( obj ) {
|
|||||||
$.widget( "ui.sortable", $.ui.interaction, {
|
$.widget( "ui.sortable", $.ui.interaction, {
|
||||||
version: "@VERSION",
|
version: "@VERSION",
|
||||||
widgetEventPrefix: "sort",
|
widgetEventPrefix: "sort",
|
||||||
items: 'li', // TODO: move to options when API is ready
|
items: "li", // TODO: move to options when API is ready
|
||||||
|
|
||||||
// dragEl: element being dragged (original or helper)
|
// dragEl: element being dragged (original or helper)
|
||||||
// position: final CSS position of dragEl
|
// position: final CSS position of dragEl
|
||||||
@ -100,14 +100,14 @@ $.widget( "ui.sortable", $.ui.interaction, {
|
|||||||
// Create placeholder for while element is dragging
|
// Create placeholder for while element is dragging
|
||||||
// TODO: what do we do about IDs?
|
// TODO: what do we do about IDs?
|
||||||
// TODO: possibly use CSS for visibility portion
|
// TODO: possibly use CSS for visibility portion
|
||||||
this.placeholder = this.dragEl.clone().removeAttr('id').css({
|
this.placeholder = this.dragEl.clone().removeAttr("id").css({
|
||||||
visibility : 'hidden',
|
visibility : "hidden",
|
||||||
position : this.originalCssPosition || ''
|
position : this.originalCssPosition || ""
|
||||||
});
|
});
|
||||||
|
|
||||||
this.dragEl.after( this.placeholder );
|
this.dragEl.after( this.placeholder );
|
||||||
|
|
||||||
this.dragEl.css( 'position', 'absolute' );
|
this.dragEl.css( "position", "absolute" );
|
||||||
|
|
||||||
// // _createHelper() ensures that helpers are in the correct position
|
// // _createHelper() ensures that helpers are in the correct position
|
||||||
// // in the DOM, but we need to handle appendTo when there is no helper
|
// // in the DOM, but we need to handle appendTo when there is no helper
|
||||||
@ -247,16 +247,16 @@ $.widget( "ui.sortable", $.ui.interaction, {
|
|||||||
|
|
||||||
// If there were inline styles before drag, set them back
|
// If there were inline styles before drag, set them back
|
||||||
if ( this.originalCssPosition ) {
|
if ( this.originalCssPosition ) {
|
||||||
this.dragEl.css( 'position', this.originalCssPosition );
|
this.dragEl.css( "position", this.originalCssPosition );
|
||||||
}
|
}
|
||||||
// If there were no inline styles, let CSS take over again by removing inline absolute
|
// If there were no inline styles, let CSS take over again by removing inline absolute
|
||||||
else {
|
else {
|
||||||
this.dragEl.css( 'position', '' );
|
this.dragEl.css( "position", "" );
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: should same thing be done here as is done for position or is there better way altogether
|
// TODO: should same thing be done here as is done for position or is there better way altogether
|
||||||
this.dragEl.css( 'left', '' );
|
this.dragEl.css( "left", "" );
|
||||||
this.dragEl.css( 'top', '' );
|
this.dragEl.css( "top", "" );
|
||||||
|
|
||||||
this.placeholder.remove();
|
this.placeholder.remove();
|
||||||
|
|
||||||
@ -474,4 +474,4 @@ $.widget( "ui.sortable", $.ui.interaction, {
|
|||||||
this._super();
|
this._super();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
})( jQuery );
|
})( jQuery );
|
||||||
|
18
ui/jquery.ui.spinner.js
vendored
18
ui/jquery.ui.spinner.js
vendored
@ -368,6 +368,14 @@ $.widget( "ui.spinner", {
|
|||||||
value = this._parse( value );
|
value = this._parse( value );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ( key === "icons" ) {
|
||||||
|
this.buttons.first().find( ".ui-icon" )
|
||||||
|
.removeClass( this.options.icons.up )
|
||||||
|
.addClass( value.up );
|
||||||
|
this.buttons.last().find( ".ui-icon" )
|
||||||
|
.removeClass( this.options.icons.down )
|
||||||
|
.addClass( value.down );
|
||||||
|
}
|
||||||
|
|
||||||
this._super( key, value );
|
this._super( key, value );
|
||||||
|
|
||||||
@ -445,14 +453,20 @@ $.widget( "ui.spinner", {
|
|||||||
this._stepUp( steps );
|
this._stepUp( steps );
|
||||||
}),
|
}),
|
||||||
_stepUp: function( steps ) {
|
_stepUp: function( steps ) {
|
||||||
this._spin( (steps || 1) * this.options.step );
|
if ( this._start() ) {
|
||||||
|
this._spin( (steps || 1) * this.options.step );
|
||||||
|
this._stop();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
stepDown: modifier(function( steps ) {
|
stepDown: modifier(function( steps ) {
|
||||||
this._stepDown( steps );
|
this._stepDown( steps );
|
||||||
}),
|
}),
|
||||||
_stepDown: function( steps ) {
|
_stepDown: function( steps ) {
|
||||||
this._spin( (steps || 1) * -this.options.step );
|
if ( this._start() ) {
|
||||||
|
this._spin( (steps || 1) * -this.options.step );
|
||||||
|
this._stop();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
pageUp: modifier(function( pages ) {
|
pageUp: modifier(function( pages ) {
|
||||||
|
Loading…
Reference in New Issue
Block a user