').data('test', function() {});
- shouldHaveData('data set to function');
+ el = $("
").data("test", function() {});
+ shouldHaveData("data set to function");
});
test("focusable - visible, enabled elements", function() {
expect(18);
- isNotFocusable('#formNoTabindex', 'form');
- isFocusable('#formTabindex', 'form with tabindex');
- isFocusable('#visibleAncestor-inputTypeNone', 'input, no type');
- isFocusable('#visibleAncestor-inputTypeText', 'input, type text');
- isFocusable('#visibleAncestor-inputTypeCheckbox', 'input, type checkbox');
- isFocusable('#visibleAncestor-inputTypeRadio', 'input, type radio');
- isFocusable('#visibleAncestor-inputTypeButton', 'input, type button');
- isNotFocusable('#visibleAncestor-inputTypeHidden', 'input, type hidden');
- isFocusable('#visibleAncestor-button', 'button');
- isFocusable('#visibleAncestor-select', 'select');
- isFocusable('#visibleAncestor-textarea', 'textarea');
- isFocusable('#visibleAncestor-object', 'object');
- isFocusable('#visibleAncestor-anchorWithHref', 'anchor with href');
- isNotFocusable('#visibleAncestor-anchorWithoutHref', 'anchor without href');
- isNotFocusable('#visibleAncestor-span', 'span');
- isNotFocusable('#visibleAncestor-div', 'div');
- isFocusable("#visibleAncestor-spanWithTabindex", 'span with tabindex');
- isFocusable("#visibleAncestor-divWithNegativeTabindex", 'div with tabindex');
+ isNotFocusable("#formNoTabindex", "form");
+ isFocusable("#formTabindex", "form with tabindex");
+ isFocusable("#visibleAncestor-inputTypeNone", "input, no type");
+ isFocusable("#visibleAncestor-inputTypeText", "input, type text");
+ isFocusable("#visibleAncestor-inputTypeCheckbox", "input, type checkbox");
+ isFocusable("#visibleAncestor-inputTypeRadio", "input, type radio");
+ isFocusable("#visibleAncestor-inputTypeButton", "input, type button");
+ isNotFocusable("#visibleAncestor-inputTypeHidden", "input, type hidden");
+ isFocusable("#visibleAncestor-button", "button");
+ isFocusable("#visibleAncestor-select", "select");
+ isFocusable("#visibleAncestor-textarea", "textarea");
+ isFocusable("#visibleAncestor-object", "object");
+ isFocusable("#visibleAncestor-anchorWithHref", "anchor with href");
+ isNotFocusable("#visibleAncestor-anchorWithoutHref", "anchor without href");
+ isNotFocusable("#visibleAncestor-span", "span");
+ isNotFocusable("#visibleAncestor-div", "div");
+ isFocusable("#visibleAncestor-spanWithTabindex", "span with tabindex");
+ isFocusable("#visibleAncestor-divWithNegativeTabindex", "div with tabindex");
});
test("focusable - disabled elements", function() {
expect(9);
- isNotFocusable('#disabledElement-inputTypeNone', 'input, no type');
- isNotFocusable('#disabledElement-inputTypeText', 'input, type text');
- isNotFocusable('#disabledElement-inputTypeCheckbox', 'input, type checkbox');
- isNotFocusable('#disabledElement-inputTypeRadio', 'input, type radio');
- isNotFocusable('#disabledElement-inputTypeButton', 'input, type button');
- isNotFocusable('#disabledElement-inputTypeHidden', 'input, type hidden');
- isNotFocusable('#disabledElement-button', 'button');
- isNotFocusable('#disabledElement-select', 'select');
- isNotFocusable('#disabledElement-textarea', 'textarea');
+ isNotFocusable("#disabledElement-inputTypeNone", "input, no type");
+ isNotFocusable("#disabledElement-inputTypeText", "input, type text");
+ isNotFocusable("#disabledElement-inputTypeCheckbox", "input, type checkbox");
+ isNotFocusable("#disabledElement-inputTypeRadio", "input, type radio");
+ isNotFocusable("#disabledElement-inputTypeButton", "input, type button");
+ isNotFocusable("#disabledElement-inputTypeHidden", "input, type hidden");
+ isNotFocusable("#disabledElement-button", "button");
+ isNotFocusable("#disabledElement-select", "select");
+ isNotFocusable("#disabledElement-textarea", "textarea");
});
test("focusable - hidden styles", function() {
expect(8);
- isNotFocusable('#displayNoneAncestor-input', 'input, display: none parent');
- isNotFocusable('#displayNoneAncestor-span', 'span with tabindex, display: none parent');
+ isNotFocusable("#displayNoneAncestor-input", "input, display: none parent");
+ isNotFocusable("#displayNoneAncestor-span", "span with tabindex, display: none parent");
- isNotFocusable('#visibilityHiddenAncestor-input', 'input, visibility: hidden parent');
- isNotFocusable('#visibilityHiddenAncestor-span', 'span with tabindex, visibility: hidden parent');
+ isNotFocusable("#visibilityHiddenAncestor-input", "input, visibility: hidden parent");
+ isNotFocusable("#visibilityHiddenAncestor-span", "span with tabindex, visibility: hidden parent");
- isNotFocusable('#displayNone-input', 'input, display: none');
- isNotFocusable('#visibilityHidden-input', 'input, visibility: hidden');
+ isNotFocusable("#displayNone-input", "input, display: none");
+ isNotFocusable("#visibilityHidden-input", "input, visibility: hidden");
- isNotFocusable('#displayNone-span', 'span with tabindex, display: none');
- isNotFocusable('#visibilityHidden-span', 'span with tabindex, visibility: hidden');
+ isNotFocusable("#displayNone-span", "span with tabindex, display: none");
+ isNotFocusable("#visibilityHidden-span", "span with tabindex, visibility: hidden");
});
test("focusable - natively focusable with various tabindex", function() {
expect(4);
- isFocusable('#inputTabindex0', 'input, tabindex 0');
- isFocusable('#inputTabindex10', 'input, tabindex 10');
- isFocusable('#inputTabindex-1', 'input, tabindex -1');
- isFocusable('#inputTabindex-50', 'input, tabindex -50');
+ isFocusable("#inputTabindex0", "input, tabindex 0");
+ isFocusable("#inputTabindex10", "input, tabindex 10");
+ isFocusable("#inputTabindex-1", "input, tabindex -1");
+ isFocusable("#inputTabindex-50", "input, tabindex -50");
});
test("focusable - not natively focusable with various tabindex", function() {
expect(4);
- isFocusable('#spanTabindex0', 'span, tabindex 0');
- isFocusable('#spanTabindex10', 'span, tabindex 10');
- isFocusable('#spanTabindex-1', 'span, tabindex -1');
- isFocusable('#spanTabindex-50', 'span, tabindex -50');
+ isFocusable("#spanTabindex0", "span, tabindex 0");
+ isFocusable("#spanTabindex10", "span, tabindex 10");
+ isFocusable("#spanTabindex-1", "span, tabindex -1");
+ isFocusable("#spanTabindex-50", "span, tabindex -50");
});
test("focusable - area elements", function() {
expect( 3 );
- isFocusable('#areaCoordsHref', 'coords and href');
- isFocusable('#areaNoCoordsHref', 'href but no coords');
- isNotFocusable('#areaNoImg', 'not associated with an image');
+ isFocusable("#areaCoordsHref", "coords and href");
+ isFocusable("#areaNoCoordsHref", "href but no coords");
+ isNotFocusable("#areaNoImg", "not associated with an image");
});
test( "focusable - dimensionless parent with overflow", function() {
@@ -166,80 +166,80 @@ test( "focusable - dimensionless parent with overflow", function() {
test("tabbable - visible, enabled elements", function() {
expect(18);
- isNotTabbable('#formNoTabindex', 'form');
- isTabbable('#formTabindex', 'form with tabindex');
- isTabbable('#visibleAncestor-inputTypeNone', 'input, no type');
- isTabbable('#visibleAncestor-inputTypeText', 'input, type text');
- isTabbable('#visibleAncestor-inputTypeCheckbox', 'input, type checkbox');
- isTabbable('#visibleAncestor-inputTypeRadio', 'input, type radio');
- isTabbable('#visibleAncestor-inputTypeButton', 'input, type button');
- isNotTabbable('#visibleAncestor-inputTypeHidden', 'input, type hidden');
- isTabbable('#visibleAncestor-button', 'button');
- isTabbable('#visibleAncestor-select', 'select');
- isTabbable('#visibleAncestor-textarea', 'textarea');
- isTabbable('#visibleAncestor-object', 'object');
- isTabbable('#visibleAncestor-anchorWithHref', 'anchor with href');
- isNotTabbable('#visibleAncestor-anchorWithoutHref', 'anchor without href');
- isNotTabbable('#visibleAncestor-span', 'span');
- isNotTabbable('#visibleAncestor-div', 'div');
- isTabbable("#visibleAncestor-spanWithTabindex", 'span with tabindex');
- isNotTabbable("#visibleAncestor-divWithNegativeTabindex", 'div with tabindex');
+ isNotTabbable("#formNoTabindex", "form");
+ isTabbable("#formTabindex", "form with tabindex");
+ isTabbable("#visibleAncestor-inputTypeNone", "input, no type");
+ isTabbable("#visibleAncestor-inputTypeText", "input, type text");
+ isTabbable("#visibleAncestor-inputTypeCheckbox", "input, type checkbox");
+ isTabbable("#visibleAncestor-inputTypeRadio", "input, type radio");
+ isTabbable("#visibleAncestor-inputTypeButton", "input, type button");
+ isNotTabbable("#visibleAncestor-inputTypeHidden", "input, type hidden");
+ isTabbable("#visibleAncestor-button", "button");
+ isTabbable("#visibleAncestor-select", "select");
+ isTabbable("#visibleAncestor-textarea", "textarea");
+ isTabbable("#visibleAncestor-object", "object");
+ isTabbable("#visibleAncestor-anchorWithHref", "anchor with href");
+ isNotTabbable("#visibleAncestor-anchorWithoutHref", "anchor without href");
+ isNotTabbable("#visibleAncestor-span", "span");
+ isNotTabbable("#visibleAncestor-div", "div");
+ isTabbable("#visibleAncestor-spanWithTabindex", "span with tabindex");
+ isNotTabbable("#visibleAncestor-divWithNegativeTabindex", "div with tabindex");
});
test("tabbable - disabled elements", function() {
expect(9);
- isNotTabbable('#disabledElement-inputTypeNone', 'input, no type');
- isNotTabbable('#disabledElement-inputTypeText', 'input, type text');
- isNotTabbable('#disabledElement-inputTypeCheckbox', 'input, type checkbox');
- isNotTabbable('#disabledElement-inputTypeRadio', 'input, type radio');
- isNotTabbable('#disabledElement-inputTypeButton', 'input, type button');
- isNotTabbable('#disabledElement-inputTypeHidden', 'input, type hidden');
- isNotTabbable('#disabledElement-button', 'button');
- isNotTabbable('#disabledElement-select', 'select');
- isNotTabbable('#disabledElement-textarea', 'textarea');
+ isNotTabbable("#disabledElement-inputTypeNone", "input, no type");
+ isNotTabbable("#disabledElement-inputTypeText", "input, type text");
+ isNotTabbable("#disabledElement-inputTypeCheckbox", "input, type checkbox");
+ isNotTabbable("#disabledElement-inputTypeRadio", "input, type radio");
+ isNotTabbable("#disabledElement-inputTypeButton", "input, type button");
+ isNotTabbable("#disabledElement-inputTypeHidden", "input, type hidden");
+ isNotTabbable("#disabledElement-button", "button");
+ isNotTabbable("#disabledElement-select", "select");
+ isNotTabbable("#disabledElement-textarea", "textarea");
});
test("tabbable - hidden styles", function() {
expect(8);
- isNotTabbable('#displayNoneAncestor-input', 'input, display: none parent');
- isNotTabbable('#displayNoneAncestor-span', 'span with tabindex, display: none parent');
+ isNotTabbable("#displayNoneAncestor-input", "input, display: none parent");
+ isNotTabbable("#displayNoneAncestor-span", "span with tabindex, display: none parent");
- isNotTabbable('#visibilityHiddenAncestor-input', 'input, visibility: hidden parent');
- isNotTabbable('#visibilityHiddenAncestor-span', 'span with tabindex, visibility: hidden parent');
+ isNotTabbable("#visibilityHiddenAncestor-input", "input, visibility: hidden parent");
+ isNotTabbable("#visibilityHiddenAncestor-span", "span with tabindex, visibility: hidden parent");
- isNotTabbable('#displayNone-input', 'input, display: none');
- isNotTabbable('#visibilityHidden-input', 'input, visibility: hidden');
+ isNotTabbable("#displayNone-input", "input, display: none");
+ isNotTabbable("#visibilityHidden-input", "input, visibility: hidden");
- isNotTabbable('#displayNone-span', 'span with tabindex, display: none');
- isNotTabbable('#visibilityHidden-span', 'span with tabindex, visibility: hidden');
+ isNotTabbable("#displayNone-span", "span with tabindex, display: none");
+ isNotTabbable("#visibilityHidden-span", "span with tabindex, visibility: hidden");
});
test("tabbable - natively tabbable with various tabindex", function() {
expect(4);
- isTabbable('#inputTabindex0', 'input, tabindex 0');
- isTabbable('#inputTabindex10', 'input, tabindex 10');
- isNotTabbable('#inputTabindex-1', 'input, tabindex -1');
- isNotTabbable('#inputTabindex-50', 'input, tabindex -50');
+ isTabbable("#inputTabindex0", "input, tabindex 0");
+ isTabbable("#inputTabindex10", "input, tabindex 10");
+ isNotTabbable("#inputTabindex-1", "input, tabindex -1");
+ isNotTabbable("#inputTabindex-50", "input, tabindex -50");
});
test("tabbable - not natively tabbable with various tabindex", function() {
expect(4);
- isTabbable('#spanTabindex0', 'span, tabindex 0');
- isTabbable('#spanTabindex10', 'span, tabindex 10');
- isNotTabbable('#spanTabindex-1', 'span, tabindex -1');
- isNotTabbable('#spanTabindex-50', 'span, tabindex -50');
+ isTabbable("#spanTabindex0", "span, tabindex 0");
+ isTabbable("#spanTabindex10", "span, tabindex 10");
+ isNotTabbable("#spanTabindex-1", "span, tabindex -1");
+ isNotTabbable("#spanTabindex-50", "span, tabindex -50");
});
test("tabbable - area elements", function() {
expect( 3 );
- isTabbable('#areaCoordsHref', 'coords and href');
- isTabbable('#areaNoCoordsHref', 'href but no coords');
- isNotTabbable('#areaNoImg', 'not associated with an image');
+ isTabbable("#areaCoordsHref", "coords and href");
+ isTabbable("#areaNoCoordsHref", "href but no coords");
+ isNotTabbable("#areaNoImg", "not associated with an image");
});
test( "tabbable - dimensionless parent with overflow", function() {
diff --git a/tests/unit/datepicker/datepicker_core.js b/tests/unit/datepicker/datepicker_core.js
index 1388f9222..befda3b2a 100644
--- a/tests/unit/datepicker/datepicker_core.js
+++ b/tests/unit/datepicker/datepicker_core.js
@@ -10,12 +10,12 @@ TestHelpers.testJshint( "datepicker" );
test("initialization - Reinitialization after body had been emptied.", function() {
expect( 1 );
- var bodyContent = $('body').children(), inp = $("#inp");
+ var bodyContent = $("body").children(), inp = $("#inp");
$("#inp").datepicker();
- $('body').empty().append(inp);
+ $("body").empty().append(inp);
$("#inp").datepicker();
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() {
@@ -30,46 +30,46 @@ test("widget method", function() {
deepEqual($("body > #ui-datepicker-div:last-child")[0], actual);
});
-asyncTest('baseStructure', function() {
+asyncTest("baseStructure", function() {
expect( 58 );
var header, title, table, thead, week, panel, inl, child,
- inp = TestHelpers.datepicker.init('#inp'),
- dp = $('#ui-datepicker-div');
+ inp = TestHelpers.datepicker.init("#inp"),
+ dp = $("#ui-datepicker-div");
function step1() {
inp[0].focus();
setTimeout(function() {
- ok(dp.is(':visible'), 'Structure - datepicker visible');
- ok(!dp.is('.ui-datepicker-rtl'), 'Structure - not right-to-left');
- ok(!dp.is('.ui-datepicker-multi'), 'Structure - not multi-month');
- equal(dp.children().length, 2, 'Structure - child count');
+ ok(dp.is(":visible"), "Structure - datepicker visible");
+ ok(!dp.is(".ui-datepicker-rtl"), "Structure - not right-to-left");
+ ok(!dp.is(".ui-datepicker-multi"), "Structure - not multi-month");
+ equal(dp.children().length, 2, "Structure - child count");
- header = dp.children(':first');
- ok(header.is('div.ui-datepicker-header'), 'Structure - header division');
- 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(':eq(1)').is('a.ui-datepicker-next') && header.children(':eq(1)').html() !== '', 'Structure - next link');
+ header = dp.children(":first");
+ ok(header.is("div.ui-datepicker-header"), "Structure - header division");
+ 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(":eq(1)").is("a.ui-datepicker-next") && header.children(":eq(1)").html() !== "", "Structure - next link");
- title = header.children(':last');
- ok(title.is('div.ui-datepicker-title') && title.html() !== '','Structure - title division');
- 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(':last').is('span.ui-datepicker-year') && title.children(':last').text() !== '', 'Structure - year text');
+ title = header.children(":last");
+ ok(title.is("div.ui-datepicker-title") && title.html() !== "","Structure - title division");
+ 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(":last").is("span.ui-datepicker-year") && title.children(":last").text() !== "", "Structure - year text");
- table = dp.children(':eq(1)');
- ok(table.is('table.ui-datepicker-calendar'), 'Structure - month table');
- ok(table.children(':first').is('thead'), 'Structure - month table thead');
- thead = table.children(':first').children(':first');
- ok(thead.is('tr'), 'Structure - month table title row');
- 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)').children('tr').length >= 4, 'Structure - month table week count');
- week = table.children(':eq(1)').children(':first');
- ok(week.is('tr'), 'Structure - month table week row');
- 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(':last').is('td.ui-datepicker-week-end'), 'Structure - month table second day cell');
- inp.datepicker('hide').datepicker('destroy');
+ table = dp.children(":eq(1)");
+ ok(table.is("table.ui-datepicker-calendar"), "Structure - month table");
+ ok(table.children(":first").is("thead"), "Structure - month table thead");
+ thead = table.children(":first").children(":first");
+ ok(thead.is("tr"), "Structure - month table title row");
+ 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)").children("tr").length >= 4, "Structure - month table week count");
+ week = table.children(":eq(1)").children(":first");
+ ok(week.is("tr"), "Structure - month table week row");
+ 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(":last").is("td.ui-datepicker-week-end"), "Structure - month table second day cell");
+ inp.datepicker("hide").datepicker("destroy");
step2();
});
@@ -77,19 +77,19 @@ asyncTest('baseStructure', function() {
function step2() {
// 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();
setTimeout(function() {
- title = dp.find('div.ui-datepicker-title');
- ok(title.children(':first').is('select.ui-datepicker-month'), 'Structure - month selector');
- ok(title.children(':last').is('select.ui-datepicker-year'), 'Structure - year selector');
+ title = dp.find("div.ui-datepicker-title");
+ ok(title.children(":first").is("select.ui-datepicker-month"), "Structure - month selector");
+ ok(title.children(":last").is("select.ui-datepicker-year"), "Structure - year selector");
- panel = dp.children(':last');
- ok(panel.is('div.ui-datepicker-buttonpane'), 'Structure - button panel division');
- 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(':last').is('button.ui-datepicker-close'), 'Structure - close button');
- inp.datepicker('hide').datepicker('destroy');
+ panel = dp.children(":last");
+ ok(panel.is("div.ui-datepicker-buttonpane"), "Structure - button panel division");
+ 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(":last").is("button.ui-datepicker-close"), "Structure - close button");
+ inp.datepicker("hide").datepicker("destroy");
step3();
});
@@ -97,19 +97,19 @@ asyncTest('baseStructure', function() {
function step3() {
// Multi-month 2
- inp = TestHelpers.datepicker.init('#inp', {numberOfMonths: 2});
+ inp = TestHelpers.datepicker.init("#inp", {numberOfMonths: 2});
inp.focus();
setTimeout(function() {
- ok(dp.is('.ui-datepicker-multi'), 'Structure multi [2] - multi-month');
- equal(dp.children().length, 3, 'Structure multi [2] - child count');
- child = dp.children(':first');
- 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)');
- 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)');
- 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');
- inp.datepicker('hide').datepicker('destroy');
+ ok(dp.is(".ui-datepicker-multi"), "Structure multi [2] - multi-month");
+ equal(dp.children().length, 3, "Structure multi [2] - child count");
+ child = dp.children(":first");
+ 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)");
+ 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)");
+ 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");
+ inp.datepicker("hide").datepicker("destroy");
step4();
});
@@ -117,12 +117,12 @@ asyncTest('baseStructure', function() {
function step4() {
// Multi-month 3
- inp = TestHelpers.datepicker.init('#inp', {numberOfMonths: 3});
+ inp = TestHelpers.datepicker.init("#inp", {numberOfMonths: 3});
inp.focus();
setTimeout(function() {
- ok(dp.is('.ui-datepicker-multi-3'), 'Structure multi [3] - multi-3');
- ok(! dp.is('.ui-datepicker-multi-2'), 'Structure multi [3] - Trac #6704');
- inp.datepicker('hide').datepicker('destroy');
+ ok(dp.is(".ui-datepicker-multi-3"), "Structure multi [3] - multi-3");
+ ok(! dp.is(".ui-datepicker-multi-2"), "Structure multi [3] - Trac #6704");
+ inp.datepicker("hide").datepicker("destroy");
step5();
});
@@ -130,53 +130,53 @@ asyncTest('baseStructure', function() {
function step5() {
// Multi-month [2, 2]
- inp = TestHelpers.datepicker.init('#inp', {numberOfMonths: [2, 2]});
+ inp = TestHelpers.datepicker.init("#inp", {numberOfMonths: [2, 2]});
inp.focus();
setTimeout(function() {
- ok(dp.is('.ui-datepicker-multi'), 'Structure multi - multi-month');
- equal(dp.children().length, 6, 'Structure multi [2,2] - child count');
- 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');
- 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');
- child = dp.children(':eq(2)');
- ok(child.is('div.ui-datepicker-row-break'), 'Structure multi [2,2] - row break');
- 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');
- 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');
- child = dp.children(':eq(5)');
- ok(child.is('div.ui-datepicker-row-break'), 'Structure multi [2,2] - row break');
- inp.datepicker('hide').datepicker('destroy');
+ ok(dp.is(".ui-datepicker-multi"), "Structure multi - multi-month");
+ equal(dp.children().length, 6, "Structure multi [2,2] - child count");
+ 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");
+ 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");
+ child = dp.children(":eq(2)");
+ ok(child.is("div.ui-datepicker-row-break"), "Structure multi [2,2] - row break");
+ 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");
+ 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");
+ child = dp.children(":eq(5)");
+ ok(child.is("div.ui-datepicker-row-break"), "Structure multi [2,2] - row break");
+ inp.datepicker("hide").datepicker("destroy");
// Inline
- inl = TestHelpers.datepicker.init('#inl');
+ inl = TestHelpers.datepicker.init("#inl");
dp = inl.children();
- 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-multi'), 'Structure inline - not multi-month');
- equal(dp.children().length, 2, 'Structure inline - child count');
- header = dp.children(':first');
- ok(header.is('div.ui-datepicker-header'), 'Structure inline - header division');
- equal(header.children().length, 3, 'Structure inline - header child count');
- table = dp.children(':eq(1)');
- 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(':eq(1)').is('tbody'), 'Structure inline - month table body');
- inl.datepicker('destroy');
+ 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-multi"), "Structure inline - not multi-month");
+ equal(dp.children().length, 2, "Structure inline - child count");
+ header = dp.children(":first");
+ ok(header.is("div.ui-datepicker-header"), "Structure inline - header division");
+ equal(header.children().length, 3, "Structure inline - header child count");
+ table = dp.children(":eq(1)");
+ 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(":eq(1)").is("tbody"), "Structure inline - month table body");
+ inl.datepicker("destroy");
// Inline multi-month
- inl = TestHelpers.datepicker.init('#inl', {numberOfMonths: 2});
+ inl = TestHelpers.datepicker.init("#inl", {numberOfMonths: 2});
dp = inl.children();
- 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');
- child = dp.children(':first');
- 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)');
- 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)');
- ok(child.is('div.ui-datepicker-row-break'), 'Structure inline multi - row break');
- inl.datepicker('destroy');
+ 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");
+ child = dp.children(":first");
+ 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)");
+ 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)");
+ ok(child.is("div.ui-datepicker-row-break"), "Structure inline multi - row break");
+ inl.datepicker("destroy");
start();
});
@@ -185,279 +185,279 @@ asyncTest('baseStructure', function() {
step1();
});
-test('customStructure', function() {
+test("customStructure", function() {
expect( 20 );
var header, panel, title, thead,
- dp = $('#ui-datepicker-div'),
+ dp = $("#ui-datepicker-div"),
// Check right-to-left localisation
- inp = TestHelpers.datepicker.init('#inp', $.datepicker.regional.he);
- inp.datepicker( 'option', 'showButtonPanel', true);
+ inp = TestHelpers.datepicker.init("#inp", $.datepicker.regional.he);
+ inp.datepicker( "option", "showButtonPanel", true);
inp.focus();
- ok(dp.is('.ui-datepicker-rtl'), 'Structure RTL - right-to-left');
- header = dp.children(':first');
- ok(header.is('div.ui-datepicker-header'), 'Structure RTL - header division');
- 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(':eq(1)').is('a.ui-datepicker-prev'), 'Structure RTL - next link');
- panel = dp.children(':last');
- ok(panel.is('div.ui-datepicker-buttonpane'), 'Structure RTL - button division');
- 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(':last').is('button.ui-datepicker-current'), 'Structure RTL - today button');
- inp.datepicker('hide').datepicker('destroy');
+ ok(dp.is(".ui-datepicker-rtl"), "Structure RTL - right-to-left");
+ header = dp.children(":first");
+ ok(header.is("div.ui-datepicker-header"), "Structure RTL - header division");
+ 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(":eq(1)").is("a.ui-datepicker-prev"), "Structure RTL - next link");
+ panel = dp.children(":last");
+ ok(panel.is("div.ui-datepicker-buttonpane"), "Structure RTL - button division");
+ 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(":last").is("button.ui-datepicker-current"), "Structure RTL - today button");
+ inp.datepicker("hide").datepicker("destroy");
// 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.val('02/10/2008').focus();
- header = dp.children(':first');
- 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');
- ok(header.children(':first').is('div.ui-datepicker-title'), 'Structure hide prev/next - title division');
- inp.datepicker('hide').datepicker('destroy');
+ 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();
+ header = dp.children(":first");
+ 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");
+ ok(header.children(":first").is("div.ui-datepicker-title"), "Structure hide prev/next - title division");
+ inp.datepicker("hide").datepicker("destroy");
// Changeable Month with read-only year
- inp = TestHelpers.datepicker.init('#inp', {changeMonth: true});
+ inp = TestHelpers.datepicker.init("#inp", {changeMonth: true});
inp.focus();
- title = dp.children(':first').children(':last');
- 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(':last').is('span.ui-datepicker-year'), 'Structure changeable month - read-only year');
- inp.datepicker('hide').datepicker('destroy');
+ title = dp.children(":first").children(":last");
+ 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(":last").is("span.ui-datepicker-year"), "Structure changeable month - read-only year");
+ inp.datepicker("hide").datepicker("destroy");
// Changeable year with read-only month
- inp = TestHelpers.datepicker.init('#inp', {changeYear: true});
+ inp = TestHelpers.datepicker.init("#inp", {changeYear: true});
inp.focus();
- title = dp.children(':first').children(':last');
- 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(':last').is('select.ui-datepicker-year'), 'Structure changeable year - year selector');
- inp.datepicker('hide').datepicker('destroy');
+ title = dp.children(":first").children(":last");
+ 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(":last").is("select.ui-datepicker-year"), "Structure changeable year - year selector");
+ inp.datepicker("hide").datepicker("destroy");
// Read-only first day of week
- inp = TestHelpers.datepicker.init('#inp', {changeFirstDay: false});
+ inp = TestHelpers.datepicker.init("#inp", {changeFirstDay: false});
inp.focus();
- thead = dp.find('.ui-datepicker-calendar thead tr');
- 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');
- inp.datepicker('hide').datepicker('destroy');
+ thead = dp.find(".ui-datepicker-calendar thead tr");
+ 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");
+ inp.datepicker("hide").datepicker("destroy");
});
-test('keystrokes', function() {
+test("keystrokes", function() {
expect( 26 );
- var inp = TestHelpers.datepicker.init('#inp'),
+ var inp = TestHelpers.datepicker.init("#inp"),
date = new Date();
- inp.val('').datepicker('show').
- simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
- TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), date, 'Keystroke enter');
- inp.val('02/04/2008').datepicker('show').
- simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
- TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), new Date(2008, 2 - 1, 4),
- 'Keystroke enter - preset');
- inp.val('02/04/2008').datepicker('show').
- simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.HOME}).
- simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
- TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), date, 'Keystroke ctrl+home');
- inp.val('02/04/2008').datepicker('show').
- simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.END});
- ok(inp.datepicker('getDate') == null, 'Keystroke ctrl+end');
- inp.val('').datepicker('show').
- simulate('keydown', {keyCode: $.ui.keyCode.ESCAPE});
- ok(inp.datepicker('getDate') == null, 'Keystroke esc');
- inp.val('02/04/2008').datepicker('show').
- simulate('keydown', {keyCode: $.ui.keyCode.ESCAPE});
- TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), new Date(2008, 2 - 1, 4),
- 'Keystroke esc - preset');
- inp.val('02/04/2008').datepicker('show').
- simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_UP}).
- simulate('keydown', {keyCode: $.ui.keyCode.ESCAPE});
- TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), new Date(2008, 2 - 1, 4),
- 'Keystroke esc - abandoned');
+ inp.val("").datepicker("show").
+ simulate("keydown", {keyCode: $.ui.keyCode.ENTER});
+ TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), date, "Keystroke enter");
+ inp.val("02/04/2008").datepicker("show").
+ simulate("keydown", {keyCode: $.ui.keyCode.ENTER});
+ TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), new Date(2008, 2 - 1, 4),
+ "Keystroke enter - preset");
+ inp.val("02/04/2008").datepicker("show").
+ simulate("keydown", {ctrlKey: true, keyCode: $.ui.keyCode.HOME}).
+ simulate("keydown", {keyCode: $.ui.keyCode.ENTER});
+ TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), date, "Keystroke ctrl+home");
+ inp.val("02/04/2008").datepicker("show").
+ simulate("keydown", {ctrlKey: true, keyCode: $.ui.keyCode.END});
+ ok(inp.datepicker("getDate") == null, "Keystroke ctrl+end");
+ inp.val("").datepicker("show").
+ simulate("keydown", {keyCode: $.ui.keyCode.ESCAPE});
+ ok(inp.datepicker("getDate") == null, "Keystroke esc");
+ inp.val("02/04/2008").datepicker("show").
+ simulate("keydown", {keyCode: $.ui.keyCode.ESCAPE});
+ TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), new Date(2008, 2 - 1, 4),
+ "Keystroke esc - preset");
+ inp.val("02/04/2008").datepicker("show").
+ simulate("keydown", {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_UP}).
+ simulate("keydown", {keyCode: $.ui.keyCode.ESCAPE});
+ TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), new Date(2008, 2 - 1, 4),
+ "Keystroke esc - abandoned");
// Moving by day or week
- inp.val('').datepicker('show').
- simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.LEFT}).
- simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
+ inp.val("").datepicker("show").
+ simulate("keydown", {ctrlKey: true, keyCode: $.ui.keyCode.LEFT}).
+ simulate("keydown", {keyCode: $.ui.keyCode.ENTER});
date.setDate(date.getDate() - 1);
- TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), date, 'Keystroke ctrl+left');
- inp.val('').datepicker('show').
- simulate('keydown', {keyCode: $.ui.keyCode.LEFT}).
- simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
+ TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), date, "Keystroke ctrl+left");
+ inp.val("").datepicker("show").
+ simulate("keydown", {keyCode: $.ui.keyCode.LEFT}).
+ simulate("keydown", {keyCode: $.ui.keyCode.ENTER});
date.setDate(date.getDate() + 1);
- TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), date, 'Keystroke left');
- inp.val('').datepicker('show').
- simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.RIGHT}).
- simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
+ TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), date, "Keystroke left");
+ inp.val("").datepicker("show").
+ simulate("keydown", {ctrlKey: true, keyCode: $.ui.keyCode.RIGHT}).
+ simulate("keydown", {keyCode: $.ui.keyCode.ENTER});
date.setDate(date.getDate() + 1);
- TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), date, 'Keystroke ctrl+right');
- inp.val('').datepicker('show').
- simulate('keydown', {keyCode: $.ui.keyCode.RIGHT}).
- simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
+ TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), date, "Keystroke ctrl+right");
+ inp.val("").datepicker("show").
+ simulate("keydown", {keyCode: $.ui.keyCode.RIGHT}).
+ simulate("keydown", {keyCode: $.ui.keyCode.ENTER});
date.setDate(date.getDate() - 1);
- TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), date, 'Keystroke right');
- inp.val('').datepicker('show').
- simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.UP}).
- simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
+ TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), date, "Keystroke right");
+ inp.val("").datepicker("show").
+ simulate("keydown", {ctrlKey: true, keyCode: $.ui.keyCode.UP}).
+ simulate("keydown", {keyCode: $.ui.keyCode.ENTER});
date.setDate(date.getDate() - 7);
- TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), date, 'Keystroke ctrl+up');
- inp.val('').datepicker('show').
- simulate('keydown', {keyCode: $.ui.keyCode.UP}).
- simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
+ TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), date, "Keystroke ctrl+up");
+ inp.val("").datepicker("show").
+ simulate("keydown", {keyCode: $.ui.keyCode.UP}).
+ simulate("keydown", {keyCode: $.ui.keyCode.ENTER});
date.setDate(date.getDate() + 7);
- TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), date, 'Keystroke up');
- inp.val('').datepicker('show').
- simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.DOWN}).
- simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
+ TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), date, "Keystroke up");
+ inp.val("").datepicker("show").
+ simulate("keydown", {ctrlKey: true, keyCode: $.ui.keyCode.DOWN}).
+ simulate("keydown", {keyCode: $.ui.keyCode.ENTER});
date.setDate(date.getDate() + 7);
- TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), date, 'Keystroke ctrl+down');
- inp.val('').datepicker('show').
- simulate('keydown', {keyCode: $.ui.keyCode.DOWN}).
- simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
+ TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), date, "Keystroke ctrl+down");
+ inp.val("").datepicker("show").
+ simulate("keydown", {keyCode: $.ui.keyCode.DOWN}).
+ simulate("keydown", {keyCode: $.ui.keyCode.ENTER});
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
- inp.val('02/04/2008').datepicker('show').
- simulate('keydown', {keyCode: $.ui.keyCode.PAGE_UP}).
- simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
- TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), new Date(2008, 1 - 1, 4),
- 'Keystroke pgup');
- inp.val('02/04/2008').datepicker('show').
- simulate('keydown', {keyCode: $.ui.keyCode.PAGE_DOWN}).
- simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
- TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), new Date(2008, 3 - 1, 4),
- 'Keystroke pgdn');
- inp.val('02/04/2008').datepicker('show').
- simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_UP}).
- simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
- TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), new Date(2007, 2 - 1, 4),
- 'Keystroke ctrl+pgup');
- inp.val('02/04/2008').datepicker('show').
- simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_DOWN}).
- simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
- TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), new Date(2009, 2 - 1, 4),
- 'Keystroke ctrl+pgdn');
+ inp.val("02/04/2008").datepicker("show").
+ simulate("keydown", {keyCode: $.ui.keyCode.PAGE_UP}).
+ simulate("keydown", {keyCode: $.ui.keyCode.ENTER});
+ TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), new Date(2008, 1 - 1, 4),
+ "Keystroke pgup");
+ inp.val("02/04/2008").datepicker("show").
+ simulate("keydown", {keyCode: $.ui.keyCode.PAGE_DOWN}).
+ simulate("keydown", {keyCode: $.ui.keyCode.ENTER});
+ TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), new Date(2008, 3 - 1, 4),
+ "Keystroke pgdn");
+ inp.val("02/04/2008").datepicker("show").
+ simulate("keydown", {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_UP}).
+ simulate("keydown", {keyCode: $.ui.keyCode.ENTER});
+ TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), new Date(2007, 2 - 1, 4),
+ "Keystroke ctrl+pgup");
+ inp.val("02/04/2008").datepicker("show").
+ simulate("keydown", {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_DOWN}).
+ simulate("keydown", {keyCode: $.ui.keyCode.ENTER});
+ TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), new Date(2009, 2 - 1, 4),
+ "Keystroke ctrl+pgdn");
// Check for moving to short months
- inp.val('03/31/2008').datepicker('show').
- simulate('keydown', {keyCode: $.ui.keyCode.PAGE_UP}).
- simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
- TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), new Date(2008, 2 - 1, 29),
- 'Keystroke pgup - Feb');
- inp.val('01/30/2008').datepicker('show').
- simulate('keydown', {keyCode: $.ui.keyCode.PAGE_DOWN}).
- simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
- TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), new Date(2008, 2 - 1, 29),
- 'Keystroke pgdn - Feb');
- inp.val('02/29/2008').datepicker('show').
- simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_UP}).
- simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
- TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), new Date(2007, 2 - 1, 28),
- 'Keystroke ctrl+pgup - Feb');
- inp.val('02/29/2008').datepicker('show').
- simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_DOWN}).
- simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
- TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), new Date(2009, 2 - 1, 28),
- 'Keystroke ctrl+pgdn - Feb');
+ inp.val("03/31/2008").datepicker("show").
+ simulate("keydown", {keyCode: $.ui.keyCode.PAGE_UP}).
+ simulate("keydown", {keyCode: $.ui.keyCode.ENTER});
+ TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), new Date(2008, 2 - 1, 29),
+ "Keystroke pgup - Feb");
+ inp.val("01/30/2008").datepicker("show").
+ simulate("keydown", {keyCode: $.ui.keyCode.PAGE_DOWN}).
+ simulate("keydown", {keyCode: $.ui.keyCode.ENTER});
+ TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), new Date(2008, 2 - 1, 29),
+ "Keystroke pgdn - Feb");
+ inp.val("02/29/2008").datepicker("show").
+ simulate("keydown", {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_UP}).
+ simulate("keydown", {keyCode: $.ui.keyCode.ENTER});
+ TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), new Date(2007, 2 - 1, 28),
+ "Keystroke ctrl+pgup - Feb");
+ inp.val("02/29/2008").datepicker("show").
+ simulate("keydown", {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_DOWN}).
+ simulate("keydown", {keyCode: $.ui.keyCode.ENTER});
+ TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), new Date(2009, 2 - 1, 28),
+ "Keystroke ctrl+pgdn - Feb");
// Goto current
- inp.datepicker('option', {gotoCurrent: true}).
- datepicker('hide').val('02/04/2008').datepicker('show').
- simulate('keydown', {keyCode: $.ui.keyCode.PAGE_DOWN}).
- simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.HOME}).
- simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
- TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), new Date(2008, 2 - 1, 4),
- 'Keystroke ctrl+home');
+ inp.datepicker("option", {gotoCurrent: true}).
+ datepicker("hide").val("02/04/2008").datepicker("show").
+ simulate("keydown", {keyCode: $.ui.keyCode.PAGE_DOWN}).
+ simulate("keydown", {ctrlKey: true, keyCode: $.ui.keyCode.HOME}).
+ simulate("keydown", {keyCode: $.ui.keyCode.ENTER});
+ TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), new Date(2008, 2 - 1, 4),
+ "Keystroke ctrl+home");
// Change steps
- inp.datepicker('option', {stepMonths: 2, gotoCurrent: false}).
- datepicker('hide').val('02/04/2008').datepicker('show').
- simulate('keydown', {keyCode: $.ui.keyCode.PAGE_UP}).
- simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
- TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), new Date(2007, 12 - 1, 4),
- 'Keystroke pgup step 2');
- inp.val('02/04/2008').datepicker('show').
- simulate('keydown', {keyCode: $.ui.keyCode.PAGE_DOWN}).
- simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
- TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), new Date(2008, 4 - 1, 4),
- 'Keystroke pgdn step 2');
+ inp.datepicker("option", {stepMonths: 2, gotoCurrent: false}).
+ datepicker("hide").val("02/04/2008").datepicker("show").
+ simulate("keydown", {keyCode: $.ui.keyCode.PAGE_UP}).
+ simulate("keydown", {keyCode: $.ui.keyCode.ENTER});
+ TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), new Date(2007, 12 - 1, 4),
+ "Keystroke pgup step 2");
+ inp.val("02/04/2008").datepicker("show").
+ simulate("keydown", {keyCode: $.ui.keyCode.PAGE_DOWN}).
+ simulate("keydown", {keyCode: $.ui.keyCode.ENTER});
+ TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), new Date(2008, 4 - 1, 4),
+ "Keystroke pgdn step 2");
});
-test('mouse', function() {
+test("mouse", function() {
expect( 15 );
var inl,
- inp = TestHelpers.datepicker.init('#inp'),
- dp = $('#ui-datepicker-div'),
+ inp = TestHelpers.datepicker.init("#inp"),
+ dp = $("#ui-datepicker-div"),
date = new Date();
- inp.val('').datepicker('show');
- $('.ui-datepicker-calendar tbody a:contains(10)', dp).simulate('click', {});
+ inp.val("").datepicker("show");
+ $(".ui-datepicker-calendar tbody a:contains(10)", dp).simulate("click", {});
date.setDate(10);
- TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), date, 'Mouse click');
- inp.val('02/04/2008').datepicker('show');
- $('.ui-datepicker-calendar tbody a:contains(12)', dp).simulate('click', {});
- TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), new Date(2008, 2 - 1, 12),
- 'Mouse click - preset');
- inp.val('02/04/2008').datepicker('show');
- inp.val('').datepicker('show');
- $('button.ui-datepicker-close', dp).simulate('click', {});
- ok(inp.datepicker('getDate') == null, 'Mouse click - close');
- inp.val('02/04/2008').datepicker('show');
- $('button.ui-datepicker-close', dp).simulate('click', {});
- TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), new Date(2008, 2 - 1, 4),
- 'Mouse click - close + preset');
- inp.val('02/04/2008').datepicker('show');
- $('a.ui-datepicker-prev', dp).simulate('click', {});
- $('button.ui-datepicker-close', dp).simulate('click', {});
- TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), new Date(2008, 2 - 1, 4),
- 'Mouse click - abandoned');
+ TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), date, "Mouse click");
+ inp.val("02/04/2008").datepicker("show");
+ $(".ui-datepicker-calendar tbody a:contains(12)", dp).simulate("click", {});
+ TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), new Date(2008, 2 - 1, 12),
+ "Mouse click - preset");
+ inp.val("02/04/2008").datepicker("show");
+ inp.val("").datepicker("show");
+ $("button.ui-datepicker-close", dp).simulate("click", {});
+ ok(inp.datepicker("getDate") == null, "Mouse click - close");
+ inp.val("02/04/2008").datepicker("show");
+ $("button.ui-datepicker-close", dp).simulate("click", {});
+ TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), new Date(2008, 2 - 1, 4),
+ "Mouse click - close + preset");
+ inp.val("02/04/2008").datepicker("show");
+ $("a.ui-datepicker-prev", dp).simulate("click", {});
+ $("button.ui-datepicker-close", dp).simulate("click", {});
+ TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), new Date(2008, 2 - 1, 4),
+ "Mouse click - abandoned");
// Current/previous/next
- inp.val('02/04/2008').datepicker('option', {showButtonPanel: true}).datepicker('show');
- $('.ui-datepicker-current', dp).simulate('click', {});
- $('.ui-datepicker-calendar tbody a:contains(14)', dp).simulate('click', {});
+ inp.val("02/04/2008").datepicker("option", {showButtonPanel: true}).datepicker("show");
+ $(".ui-datepicker-current", dp).simulate("click", {});
+ $(".ui-datepicker-calendar tbody a:contains(14)", dp).simulate("click", {});
date.setDate(14);
- TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), date, 'Mouse click - current');
- inp.val('02/04/2008').datepicker('show');
- $('.ui-datepicker-prev', 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),
- 'Mouse click - previous');
- inp.val('02/04/2008').datepicker('show');
- $('.ui-datepicker-next', 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),
- 'Mouse click - next');
+ TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), date, "Mouse click - current");
+ inp.val("02/04/2008").datepicker("show");
+ $(".ui-datepicker-prev", 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),
+ "Mouse click - previous");
+ inp.val("02/04/2008").datepicker("show");
+ $(".ui-datepicker-next", 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),
+ "Mouse click - next");
// Previous/next with minimum/maximum
- inp.datepicker('option', {minDate: new Date(2008, 2 - 1, 2),
- maxDate: new Date(2008, 2 - 1, 26)}).val('02/04/2008').datepicker('show');
- $('.ui-datepicker-prev', 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),
- 'Mouse click - previous + min/max');
- inp.val('02/04/2008').datepicker('show');
- $('.ui-datepicker-next', 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),
- 'Mouse click - next + min/max');
+ inp.datepicker("option", {minDate: new Date(2008, 2 - 1, 2),
+ maxDate: new Date(2008, 2 - 1, 26)}).val("02/04/2008").datepicker("show");
+ $(".ui-datepicker-prev", 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),
+ "Mouse click - previous + min/max");
+ inp.val("02/04/2008").datepicker("show");
+ $(".ui-datepicker-next", 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),
+ "Mouse click - next + min/max");
// Inline
- inl = TestHelpers.datepicker.init('#inl');
- dp = $('.ui-datepicker-inline', inl);
+ inl = TestHelpers.datepicker.init("#inl");
+ dp = $(".ui-datepicker-inline", inl);
date = new Date();
- inl.datepicker('setDate', date);
- $('.ui-datepicker-calendar tbody a:contains(10)', dp).simulate('click', {});
+ inl.datepicker("setDate", date);
+ $(".ui-datepicker-calendar tbody a:contains(10)", dp).simulate("click", {});
date.setDate(10);
- TestHelpers.datepicker.equalsDate(inl.datepicker('getDate'), date, 'Mouse click inline');
- inl.datepicker('option', {showButtonPanel: true}).datepicker('setDate', new Date(2008, 2 - 1, 4));
- $('.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');
- inl.datepicker('option', {showButtonPanel: true});
- $('.ui-datepicker-current', dp).simulate('click', {});
- $('.ui-datepicker-calendar tbody a:contains(14)', dp).simulate('click', {});
+ TestHelpers.datepicker.equalsDate(inl.datepicker("getDate"), date, "Mouse click inline");
+ inl.datepicker("option", {showButtonPanel: true}).datepicker("setDate", new Date(2008, 2 - 1, 4));
+ $(".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");
+ inl.datepicker("option", {showButtonPanel: true});
+ $(".ui-datepicker-current", dp).simulate("click", {});
+ $(".ui-datepicker-calendar tbody a:contains(14)", dp).simulate("click", {});
date.setDate(14);
- TestHelpers.datepicker.equalsDate(inl.datepicker('getDate'), date, 'Mouse click inline - current');
- inl.datepicker('setDate', new Date(2008, 2 - 1, 4));
- $('.ui-datepicker-prev', 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),
- 'Mouse click inline - previous');
- inl.datepicker('setDate', new Date(2008, 2 - 1, 4));
- $('.ui-datepicker-next', 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),
- 'Mouse click inline - next');
+ TestHelpers.datepicker.equalsDate(inl.datepicker("getDate"), date, "Mouse click inline - current");
+ inl.datepicker("setDate", new Date(2008, 2 - 1, 4));
+ $(".ui-datepicker-prev", 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),
+ "Mouse click inline - previous");
+ inl.datepicker("setDate", new Date(2008, 2 - 1, 4));
+ $(".ui-datepicker-next", 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),
+ "Mouse click inline - next");
});
})(jQuery);
diff --git a/tests/unit/datepicker/datepicker_events.js b/tests/unit/datepicker/datepicker_events.js
index 43b0a4b23..dfc42ccf9 100644
--- a/tests/unit/datepicker/datepicker_events.js
+++ b/tests/unit/datepicker/datepicker_events.js
@@ -17,137 +17,137 @@ function callback(date, inst) {
function callback2(year, month, inst) {
selectedThis = this;
- selectedDate = year + '/' + month;
+ selectedDate = year + "/" + month;
selectedInst = inst;
}
-test('events', function() {
+test("events", function() {
expect( 26 );
var dateStr, newMonthYear, inp2,
- inp = TestHelpers.datepicker.init('#inp', {onSelect: callback}),
+ inp = TestHelpers.datepicker.init("#inp", {onSelect: callback}),
date = new Date();
// onSelect
- inp.val('').datepicker('show').
- simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
- equal(selectedThis, inp[0], 'Callback selected this');
- equal(selectedInst, $.data(inp[0], TestHelpers.datepicker.PROP_NAME), 'Callback selected inst');
- equal(selectedDate, $.datepicker.formatDate('mm/dd/yy', date),
- 'Callback selected date');
- inp.val('').datepicker('show').
- simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.DOWN}).
- simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
+ inp.val("").datepicker("show").
+ simulate("keydown", {keyCode: $.ui.keyCode.ENTER});
+ equal(selectedThis, inp[0], "Callback selected this");
+ equal(selectedInst, $.data(inp[0], TestHelpers.datepicker.PROP_NAME), "Callback selected inst");
+ equal(selectedDate, $.datepicker.formatDate("mm/dd/yy", date),
+ "Callback selected date");
+ inp.val("").datepicker("show").
+ simulate("keydown", {ctrlKey: true, keyCode: $.ui.keyCode.DOWN}).
+ simulate("keydown", {keyCode: $.ui.keyCode.ENTER});
date.setDate(date.getDate() + 7);
- equal(selectedDate, $.datepicker.formatDate('mm/dd/yy', date),
- 'Callback selected date - ctrl+down');
- inp.val('').datepicker('show').
- simulate('keydown', {keyCode: $.ui.keyCode.ESCAPE});
- equal(selectedDate, $.datepicker.formatDate('mm/dd/yy', date),
- 'Callback selected date - esc');
- dateStr = '02/04/2008';
- inp.val(dateStr).datepicker('show').
- simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
+ equal(selectedDate, $.datepicker.formatDate("mm/dd/yy", date),
+ "Callback selected date - ctrl+down");
+ inp.val("").datepicker("show").
+ simulate("keydown", {keyCode: $.ui.keyCode.ESCAPE});
+ equal(selectedDate, $.datepicker.formatDate("mm/dd/yy", date),
+ "Callback selected date - esc");
+ dateStr = "02/04/2008";
+ inp.val(dateStr).datepicker("show").
+ simulate("keydown", {keyCode: $.ui.keyCode.ENTER});
equal(dateStr, selectedDate,
- 'onSelect is called after enter keydown');
+ "onSelect is called after enter keydown");
// onChangeMonthYear
- inp.datepicker('option', {onChangeMonthYear: callback2, onSelect: null}).
- val('').datepicker('show');
+ inp.datepicker("option", {onChangeMonthYear: callback2, onSelect: null}).
+ val("").datepicker("show");
newMonthYear = function(date) {
- return date.getFullYear() + '/' + (date.getMonth() + 1);
+ return date.getFullYear() + "/" + (date.getMonth() + 1);
};
date = new Date();
date.setDate(1);
- inp.simulate('keydown', {keyCode: $.ui.keyCode.PAGE_UP});
+ inp.simulate("keydown", {keyCode: $.ui.keyCode.PAGE_UP});
date.setMonth(date.getMonth() - 1);
- equal(selectedThis, inp[0], 'Callback change month/year this');
- equal(selectedInst, $.data(inp[0], TestHelpers.datepicker.PROP_NAME), 'Callback change month/year inst');
+ equal(selectedThis, inp[0], "Callback change month/year this");
+ equal(selectedInst, $.data(inp[0], TestHelpers.datepicker.PROP_NAME), "Callback change month/year inst");
equal(selectedDate, newMonthYear(date),
- 'Callback change month/year date - pgup');
- inp.simulate('keydown', {keyCode: $.ui.keyCode.PAGE_DOWN});
+ "Callback change month/year date - pgup");
+ inp.simulate("keydown", {keyCode: $.ui.keyCode.PAGE_DOWN});
date.setMonth(date.getMonth() + 1);
equal(selectedDate, newMonthYear(date),
- 'Callback change month/year date - pgdn');
- inp.simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_UP});
+ "Callback change month/year date - pgdn");
+ inp.simulate("keydown", {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_UP});
date.setFullYear(date.getFullYear() - 1);
equal(selectedDate, newMonthYear(date),
- 'Callback change month/year date - ctrl+pgup');
- inp.simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.HOME});
+ "Callback change month/year date - ctrl+pgup");
+ inp.simulate("keydown", {ctrlKey: true, keyCode: $.ui.keyCode.HOME});
date.setFullYear(date.getFullYear() + 1);
equal(selectedDate, newMonthYear(date),
- 'Callback change month/year date - ctrl+home');
- inp.simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_DOWN});
+ "Callback change month/year date - ctrl+home");
+ inp.simulate("keydown", {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_DOWN});
date.setFullYear(date.getFullYear() + 1);
equal(selectedDate, newMonthYear(date),
- 'Callback change month/year date - ctrl+pgdn');
- inp.datepicker('setDate', new Date(2007, 1 - 1, 26));
- equal(selectedDate, '2007/1', 'Callback change month/year date - setDate');
+ "Callback change month/year date - ctrl+pgdn");
+ inp.datepicker("setDate", new Date(2007, 1 - 1, 26));
+ equal(selectedDate, "2007/1", "Callback change month/year date - setDate");
selectedDate = null;
- inp.datepicker('setDate', new Date(2007, 1 - 1, 12));
- ok(selectedDate == null, 'Callback change month/year date - setDate no change');
+ inp.datepicker("setDate", new Date(2007, 1 - 1, 12));
+ ok(selectedDate == null, "Callback change month/year date - setDate no change");
// onChangeMonthYear step by 2
- inp.datepicker('option', {stepMonths: 2}).
- datepicker('hide').val('').datepicker('show').
- simulate('keydown', {keyCode: $.ui.keyCode.PAGE_UP});
+ inp.datepicker("option", {stepMonths: 2}).
+ datepicker("hide").val("").datepicker("show").
+ simulate("keydown", {keyCode: $.ui.keyCode.PAGE_UP});
date.setMonth(date.getMonth() - 14);
equal(selectedDate, newMonthYear(date),
- 'Callback change month/year by 2 date - pgup');
- inp.simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_UP});
+ "Callback change month/year by 2 date - pgup");
+ inp.simulate("keydown", {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_UP});
date.setMonth(date.getMonth() - 12);
equal(selectedDate, newMonthYear(date),
- 'Callback change month/year by 2 date - ctrl+pgup');
- inp.simulate('keydown', {keyCode: $.ui.keyCode.PAGE_DOWN});
+ "Callback change month/year by 2 date - ctrl+pgup");
+ inp.simulate("keydown", {keyCode: $.ui.keyCode.PAGE_DOWN});
date.setMonth(date.getMonth() + 2);
equal(selectedDate, newMonthYear(date),
- 'Callback change month/year by 2 date - pgdn');
- inp.simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_DOWN});
+ "Callback change month/year by 2 date - pgdn");
+ inp.simulate("keydown", {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_DOWN});
date.setMonth(date.getMonth() + 12);
equal(selectedDate, newMonthYear(date),
- 'Callback change month/year by 2 date - ctrl+pgdn');
+ "Callback change month/year by 2 date - ctrl+pgdn");
// onClose
- inp.datepicker('option', {onClose: callback, onChangeMonthYear: null, stepMonths: 1}).
- val('').datepicker('show').
- simulate('keydown', {keyCode: $.ui.keyCode.ESCAPE});
- equal(selectedThis, inp[0], 'Callback close this');
- equal(selectedInst, $.data(inp[0], TestHelpers.datepicker.PROP_NAME), 'Callback close inst');
- equal(selectedDate, '', 'Callback close date - esc');
- inp.val('').datepicker('show').
- simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
- equal(selectedDate, $.datepicker.formatDate('mm/dd/yy', new Date()),
- 'Callback close date - enter');
- inp.val('02/04/2008').datepicker('show').
- simulate('keydown', {keyCode: $.ui.keyCode.ESCAPE});
- equal(selectedDate, '02/04/2008', 'Callback close date - preset');
- inp.val('02/04/2008').datepicker('show').
- simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.END});
- equal(selectedDate, '', 'Callback close date - ctrl+end');
+ inp.datepicker("option", {onClose: callback, onChangeMonthYear: null, stepMonths: 1}).
+ val("").datepicker("show").
+ simulate("keydown", {keyCode: $.ui.keyCode.ESCAPE});
+ equal(selectedThis, inp[0], "Callback close this");
+ equal(selectedInst, $.data(inp[0], TestHelpers.datepicker.PROP_NAME), "Callback close inst");
+ equal(selectedDate, "", "Callback close date - esc");
+ inp.val("").datepicker("show").
+ simulate("keydown", {keyCode: $.ui.keyCode.ENTER});
+ equal(selectedDate, $.datepicker.formatDate("mm/dd/yy", new Date()),
+ "Callback close date - enter");
+ inp.val("02/04/2008").datepicker("show").
+ simulate("keydown", {keyCode: $.ui.keyCode.ESCAPE});
+ equal(selectedDate, "02/04/2008", "Callback close date - preset");
+ inp.val("02/04/2008").datepicker("show").
+ simulate("keydown", {ctrlKey: true, keyCode: $.ui.keyCode.END});
+ equal(selectedDate, "", "Callback close date - ctrl+end");
- inp2 = TestHelpers.datepicker.init('#inp2');
- inp2.datepicker().datepicker('option', {onClose: callback}).datepicker('show');
- inp.datepicker('show');
- equal(selectedThis, inp2[0], 'Callback close this');
+ inp2 = TestHelpers.datepicker.init("#inp2");
+ inp2.datepicker().datepicker("option", {onClose: callback}).datepicker("show");
+ inp.datepicker("show");
+ equal(selectedThis, inp2[0], "Callback close this");
});
-test('beforeShowDay-getDate', function() {
+test("beforeShowDay-getDate", function() {
expect( 3 );
- var inp = TestHelpers.datepicker.init('#inp', {beforeShowDay: function() { inp.datepicker('getDate'); return [true, '']; }}),
- dp = $('#ui-datepicker-div');
- inp.val('01/01/2010').datepicker('show');
+ var inp = TestHelpers.datepicker.init("#inp", {beforeShowDay: function() { inp.datepicker("getDate"); return [true, ""]; }}),
+ dp = $("#ui-datepicker-div");
+ inp.val("01/01/2010").datepicker("show");
// contains non-breaking space
- equal($('div.ui-datepicker-title').text(),
+ equal($("div.ui-datepicker-title").text(),
// support: IE <9, jQuery <1.8
// In IE7/8 with jQuery <1.8, encoded spaces behave in strange ways
- $( "
January 2010 " ).text(), 'Initial month');
- $('a.ui-datepicker-next', dp).click();
- $('a.ui-datepicker-next', dp).click();
+ $( "
January 2010 " ).text(), "Initial month");
+ $("a.ui-datepicker-next", dp).click();
+ $("a.ui-datepicker-next", dp).click();
// contains non-breaking space
- equal($('div.ui-datepicker-title').text(),
- $( "
March 2010 " ).text(), 'After next clicks');
- inp.datepicker('hide').datepicker('show');
- $('a.ui-datepicker-prev', dp).click();
- $('a.ui-datepicker-prev', dp).click();
+ equal($("div.ui-datepicker-title").text(),
+ $( "
March 2010 " ).text(), "After next clicks");
+ inp.datepicker("hide").datepicker("show");
+ $("a.ui-datepicker-prev", dp).click();
+ $("a.ui-datepicker-prev", dp).click();
// contains non-breaking space
- equal($('div.ui-datepicker-title').text(),
- $( "
November 2009 " ).text(), 'After prev clicks');
- inp.datepicker('hide');
+ equal($("div.ui-datepicker-title").text(),
+ $( "
November 2009 " ).text(), "After prev clicks");
+ inp.datepicker("hide");
});
})(jQuery);
diff --git a/tests/unit/datepicker/datepicker_methods.js b/tests/unit/datepicker/datepicker_methods.js
index d2964a266..77217e449 100644
--- a/tests/unit/datepicker/datepicker_methods.js
+++ b/tests/unit/datepicker/datepicker_methods.js
@@ -5,121 +5,121 @@
module("datepicker: methods");
-test('destroy', function() {
+test("destroy", function() {
expect( 33 );
var inl,
- inp = TestHelpers.datepicker.init('#inp');
- ok(inp.is('.hasDatepicker'), 'Default - marker class set');
- ok($.data(inp[0], TestHelpers.datepicker.PROP_NAME), 'Default - instance present');
- ok(inp.next().is('#alt'), 'Default - button absent');
- inp.datepicker('destroy');
- inp = $('#inp');
- ok(!inp.is('.hasDatepicker'), 'Default - marker class cleared');
- ok(!$.data(inp[0], TestHelpers.datepicker.PROP_NAME), 'Default - instance absent');
- ok(inp.next().is('#alt'), 'Default - button absent');
+ inp = TestHelpers.datepicker.init("#inp");
+ ok(inp.is(".hasDatepicker"), "Default - marker class set");
+ ok($.data(inp[0], TestHelpers.datepicker.PROP_NAME), "Default - instance present");
+ ok(inp.next().is("#alt"), "Default - button absent");
+ inp.datepicker("destroy");
+ inp = $("#inp");
+ ok(!inp.is(".hasDatepicker"), "Default - marker class cleared");
+ ok(!$.data(inp[0], TestHelpers.datepicker.PROP_NAME), "Default - instance absent");
+ ok(inp.next().is("#alt"), "Default - button absent");
// With button
- inp= TestHelpers.datepicker.init('#inp', {showOn: 'both'});
- ok(inp.is('.hasDatepicker'), 'Button - marker class set');
- ok($.data(inp[0], TestHelpers.datepicker.PROP_NAME), 'Button - instance present');
- ok(inp.next().text() === '...', 'Button - button added');
- inp.datepicker('destroy');
- inp = $('#inp');
- ok(!inp.is('.hasDatepicker'), 'Button - marker class cleared');
- ok(!$.data(inp[0], TestHelpers.datepicker.PROP_NAME), 'Button - instance absent');
- ok(inp.next().is('#alt'), 'Button - button removed');
+ inp= TestHelpers.datepicker.init("#inp", {showOn: "both"});
+ ok(inp.is(".hasDatepicker"), "Button - marker class set");
+ ok($.data(inp[0], TestHelpers.datepicker.PROP_NAME), "Button - instance present");
+ ok(inp.next().text() === "...", "Button - button added");
+ inp.datepicker("destroy");
+ inp = $("#inp");
+ ok(!inp.is(".hasDatepicker"), "Button - marker class cleared");
+ ok(!$.data(inp[0], TestHelpers.datepicker.PROP_NAME), "Button - instance absent");
+ ok(inp.next().is("#alt"), "Button - button removed");
// With append text
- inp = TestHelpers.datepicker.init('#inp', {appendText: 'Testing'});
- ok(inp.is('.hasDatepicker'), 'Append - marker class set');
- ok($.data(inp[0], TestHelpers.datepicker.PROP_NAME), 'Append - instance present');
- ok(inp.next().text() === 'Testing', 'Append - append text added');
- inp.datepicker('destroy');
- inp = $('#inp');
- ok(!inp.is('.hasDatepicker'), 'Append - marker class cleared');
- ok(!$.data(inp[0], TestHelpers.datepicker.PROP_NAME), 'Append - instance absent');
- ok(inp.next().is('#alt'), 'Append - append text removed');
+ inp = TestHelpers.datepicker.init("#inp", {appendText: "Testing"});
+ ok(inp.is(".hasDatepicker"), "Append - marker class set");
+ ok($.data(inp[0], TestHelpers.datepicker.PROP_NAME), "Append - instance present");
+ ok(inp.next().text() === "Testing", "Append - append text added");
+ inp.datepicker("destroy");
+ inp = $("#inp");
+ ok(!inp.is(".hasDatepicker"), "Append - marker class cleared");
+ ok(!$.data(inp[0], TestHelpers.datepicker.PROP_NAME), "Append - instance absent");
+ ok(inp.next().is("#alt"), "Append - append text removed");
// With both
- inp= TestHelpers.datepicker.init('#inp', {showOn: 'both', buttonImageOnly: true,
- buttonImage: 'img/calendar.gif', appendText: 'Testing'});
- ok(inp.is('.hasDatepicker'), 'Both - marker class set');
- ok($.data(inp[0], TestHelpers.datepicker.PROP_NAME), 'Both - instance present');
- ok(inp.next()[0].nodeName.toLowerCase() === 'img', 'Both - button added');
- ok(inp.next().next().text() === 'Testing', 'Both - append text added');
- inp.datepicker('destroy');
- inp = $('#inp');
- ok(!inp.is('.hasDatepicker'), 'Both - marker class cleared');
- ok(!$.data(inp[0], TestHelpers.datepicker.PROP_NAME), 'Both - instance absent');
- ok(inp.next().is('#alt'), 'Both - button and append text absent');
+ inp= TestHelpers.datepicker.init("#inp", {showOn: "both", buttonImageOnly: true,
+ buttonImage: "img/calendar.gif", appendText: "Testing"});
+ ok(inp.is(".hasDatepicker"), "Both - marker class set");
+ ok($.data(inp[0], TestHelpers.datepicker.PROP_NAME), "Both - instance present");
+ ok(inp.next()[0].nodeName.toLowerCase() === "img", "Both - button added");
+ ok(inp.next().next().text() === "Testing", "Both - append text added");
+ inp.datepicker("destroy");
+ inp = $("#inp");
+ ok(!inp.is(".hasDatepicker"), "Both - marker class cleared");
+ ok(!$.data(inp[0], TestHelpers.datepicker.PROP_NAME), "Both - instance absent");
+ ok(inp.next().is("#alt"), "Both - button and append text absent");
// Inline
- inl = TestHelpers.datepicker.init('#inl');
- ok(inl.is('.hasDatepicker'), 'Inline - marker class set');
- ok(inl.html() !== '', 'Inline - datepicker present');
- ok($.data(inl[0], TestHelpers.datepicker.PROP_NAME), 'Inline - instance present');
- ok(inl.next().length === 0 || inl.next().is('p'), 'Inline - button absent');
- inl.datepicker('destroy');
- inl = $('#inl');
- ok(!inl.is('.hasDatepicker'), 'Inline - marker class cleared');
- ok(inl.html() === '', 'Inline - datepicker absent');
- ok(!$.data(inl[0], TestHelpers.datepicker.PROP_NAME), 'Inline - instance absent');
- ok(inl.next().length === 0 || inl.next().is('p'), 'Inline - button absent');
+ inl = TestHelpers.datepicker.init("#inl");
+ ok(inl.is(".hasDatepicker"), "Inline - marker class set");
+ ok(inl.html() !== "", "Inline - datepicker present");
+ ok($.data(inl[0], TestHelpers.datepicker.PROP_NAME), "Inline - instance present");
+ ok(inl.next().length === 0 || inl.next().is("p"), "Inline - button absent");
+ inl.datepicker("destroy");
+ inl = $("#inl");
+ ok(!inl.is(".hasDatepicker"), "Inline - marker class cleared");
+ ok(inl.html() === "", "Inline - datepicker absent");
+ ok(!$.data(inl[0], TestHelpers.datepicker.PROP_NAME), "Inline - instance absent");
+ ok(inl.next().length === 0 || inl.next().is("p"), "Inline - button absent");
});
-test('enableDisable', function() {
+test("enableDisable", function() {
expect( 33 );
var inl, dp,
- inp = TestHelpers.datepicker.init('#inp');
- ok(!inp.datepicker('isDisabled'), 'Enable/disable - initially marked as enabled');
- ok(!inp[0].disabled, 'Enable/disable - field initially enabled');
- inp.datepicker('disable');
- ok(inp.datepicker('isDisabled'), 'Enable/disable - now marked as disabled');
- ok(inp[0].disabled, 'Enable/disable - field now disabled');
- inp.datepicker('enable');
- ok(!inp.datepicker('isDisabled'), 'Enable/disable - now marked as enabled');
- ok(!inp[0].disabled, 'Enable/disable - field now enabled');
- inp.datepicker('destroy');
+ inp = TestHelpers.datepicker.init("#inp");
+ ok(!inp.datepicker("isDisabled"), "Enable/disable - initially marked as enabled");
+ ok(!inp[0].disabled, "Enable/disable - field initially enabled");
+ inp.datepicker("disable");
+ ok(inp.datepicker("isDisabled"), "Enable/disable - now marked as disabled");
+ ok(inp[0].disabled, "Enable/disable - field now disabled");
+ inp.datepicker("enable");
+ ok(!inp.datepicker("isDisabled"), "Enable/disable - now marked as enabled");
+ ok(!inp[0].disabled, "Enable/disable - field now enabled");
+ inp.datepicker("destroy");
// With a button
- inp = TestHelpers.datepicker.init('#inp', {showOn: 'button'});
- ok(!inp.datepicker('isDisabled'), 'Enable/disable button - initially marked as enabled');
- ok(!inp[0].disabled, 'Enable/disable button - field initially enabled');
- ok(!inp.next('button')[0].disabled, 'Enable/disable button - button initially enabled');
- inp.datepicker('disable');
- ok(inp.datepicker('isDisabled'), 'Enable/disable button - now marked as disabled');
- ok(inp[0].disabled, 'Enable/disable button - field now disabled');
- ok(inp.next('button')[0].disabled, 'Enable/disable button - button now disabled');
- inp.datepicker('enable');
- ok(!inp.datepicker('isDisabled'), 'Enable/disable button - now marked as enabled');
- ok(!inp[0].disabled, 'Enable/disable button - field now enabled');
- ok(!inp.next('button')[0].disabled, 'Enable/disable button - button now enabled');
- inp.datepicker('destroy');
+ inp = TestHelpers.datepicker.init("#inp", {showOn: "button"});
+ ok(!inp.datepicker("isDisabled"), "Enable/disable button - initially marked as enabled");
+ ok(!inp[0].disabled, "Enable/disable button - field initially enabled");
+ ok(!inp.next("button")[0].disabled, "Enable/disable button - button initially enabled");
+ inp.datepicker("disable");
+ ok(inp.datepicker("isDisabled"), "Enable/disable button - now marked as disabled");
+ ok(inp[0].disabled, "Enable/disable button - field now disabled");
+ ok(inp.next("button")[0].disabled, "Enable/disable button - button now disabled");
+ inp.datepicker("enable");
+ ok(!inp.datepicker("isDisabled"), "Enable/disable button - now marked as enabled");
+ ok(!inp[0].disabled, "Enable/disable button - field now enabled");
+ ok(!inp.next("button")[0].disabled, "Enable/disable button - button now enabled");
+ inp.datepicker("destroy");
// With an image button
- inp = TestHelpers.datepicker.init('#inp', {showOn: 'button', buttonImageOnly: true,
- buttonImage: 'img/calendar.gif'});
- ok(!inp.datepicker('isDisabled'), 'Enable/disable image - initially marked as 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');
- inp.datepicker('disable');
- ok(inp.datepicker('isDisabled'), 'Enable/disable image - now marked as 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');
- inp.datepicker('enable');
- ok(!inp.datepicker('isDisabled'), 'Enable/disable image - now marked as 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');
- inp.datepicker('destroy');
+ inp = TestHelpers.datepicker.init("#inp", {showOn: "button", buttonImageOnly: true,
+ buttonImage: "img/calendar.gif"});
+ ok(!inp.datepicker("isDisabled"), "Enable/disable image - initially marked as 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");
+ inp.datepicker("disable");
+ ok(inp.datepicker("isDisabled"), "Enable/disable image - now marked as 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");
+ inp.datepicker("enable");
+ ok(!inp.datepicker("isDisabled"), "Enable/disable image - now marked as 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");
+ inp.datepicker("destroy");
// Inline
- inl = TestHelpers.datepicker.init('#inl', {changeYear: true});
- dp = $('.ui-datepicker-inline', inl);
- 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.find('select').prop('disabled'), 'Enable/disable inline - form element enabled initially');
- inl.datepicker('disable');
- 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.find('select').prop('disabled'), 'Enable/disable inline - form element disabled');
- inl.datepicker('enable');
- 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.find('select').prop('disabled'), 'Enable/disable inline - form element enabled');
- inl.datepicker('destroy');
+ inl = TestHelpers.datepicker.init("#inl", {changeYear: true});
+ dp = $(".ui-datepicker-inline", inl);
+ 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.find("select").prop("disabled"), "Enable/disable inline - form element enabled initially");
+ inl.datepicker("disable");
+ 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.find("select").prop("disabled"), "Enable/disable inline - form element disabled");
+ inl.datepicker("enable");
+ 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.find("select").prop("disabled"), "Enable/disable inline - form element enabled");
+ inl.datepicker("destroy");
});
})(jQuery);
diff --git a/tests/unit/datepicker/datepicker_options.js b/tests/unit/datepicker/datepicker_options.js
index c5e53b85e..5603dc87b 100644
--- a/tests/unit/datepicker/datepicker_options.js
+++ b/tests/unit/datepicker/datepicker_options.js
@@ -6,113 +6,113 @@
module("datepicker: options");
-test('setDefaults', function() {
+test("setDefaults", function() {
expect( 3 );
- TestHelpers.datepicker.init('#inp');
- equal($.datepicker._defaults.showOn, 'focus', 'Initial showOn');
- $.datepicker.setDefaults({showOn: 'button'});
- equal($.datepicker._defaults.showOn, 'button', 'Change default showOn');
- $.datepicker.setDefaults({showOn: 'focus'});
- equal($.datepicker._defaults.showOn, 'focus', 'Restore showOn');
+ TestHelpers.datepicker.init("#inp");
+ equal($.datepicker._defaults.showOn, "focus", "Initial showOn");
+ $.datepicker.setDefaults({showOn: "button"});
+ equal($.datepicker._defaults.showOn, "button", "Change default showOn");
+ $.datepicker.setDefaults({showOn: "focus"});
+ equal($.datepicker._defaults.showOn, "focus", "Restore showOn");
});
-test('option', function() {
+test("option", function() {
expect( 17 );
- var inp = TestHelpers.datepicker.init('#inp'),
+ var inp = TestHelpers.datepicker.init("#inp"),
inst = $.data(inp[0], TestHelpers.datepicker.PROP_NAME);
// Set option
- equal(inst.settings.showOn, null, 'Initial setting showOn');
- equal($.datepicker._get(inst, 'showOn'), 'focus', 'Initial instance showOn');
- equal($.datepicker._defaults.showOn, 'focus', 'Initial default showOn');
- inp.datepicker('option', 'showOn', 'button');
- equal(inst.settings.showOn, 'button', 'Change setting showOn');
- equal($.datepicker._get(inst, 'showOn'), 'button', 'Change instance showOn');
- equal($.datepicker._defaults.showOn, 'focus', 'Retain default showOn');
- inp.datepicker('option', {showOn: 'both'});
- equal(inst.settings.showOn, 'both', 'Change setting showOn');
- equal($.datepicker._get(inst, 'showOn'), 'both', 'Change instance showOn');
- equal($.datepicker._defaults.showOn, 'focus', 'Retain default showOn');
- inp.datepicker('option', 'showOn', undefined);
- equal(inst.settings.showOn, null, 'Clear setting showOn');
- equal($.datepicker._get(inst, 'showOn'), 'focus', 'Restore instance showOn');
- equal($.datepicker._defaults.showOn, 'focus', 'Retain default showOn');
+ equal(inst.settings.showOn, null, "Initial setting showOn");
+ equal($.datepicker._get(inst, "showOn"), "focus", "Initial instance showOn");
+ equal($.datepicker._defaults.showOn, "focus", "Initial default showOn");
+ inp.datepicker("option", "showOn", "button");
+ equal(inst.settings.showOn, "button", "Change setting showOn");
+ equal($.datepicker._get(inst, "showOn"), "button", "Change instance showOn");
+ equal($.datepicker._defaults.showOn, "focus", "Retain default showOn");
+ inp.datepicker("option", {showOn: "both"});
+ equal(inst.settings.showOn, "both", "Change setting showOn");
+ equal($.datepicker._get(inst, "showOn"), "both", "Change instance showOn");
+ equal($.datepicker._defaults.showOn, "focus", "Retain default showOn");
+ inp.datepicker("option", "showOn", undefined);
+ equal(inst.settings.showOn, null, "Clear setting showOn");
+ equal($.datepicker._get(inst, "showOn"), "focus", "Restore instance showOn");
+ equal($.datepicker._defaults.showOn, "focus", "Retain default showOn");
// Get option
- inp = TestHelpers.datepicker.init('#inp');
- equal(inp.datepicker('option', 'showOn'), 'focus', 'Initial setting showOn');
- inp.datepicker('option', 'showOn', 'button');
- equal(inp.datepicker('option', 'showOn'), 'button', 'Change instance showOn');
- inp.datepicker('option', 'showOn', undefined);
- equal(inp.datepicker('option', 'showOn'), 'focus', 'Reset instance showOn');
- deepEqual(inp.datepicker('option', 'all'), {showAnim: ''}, 'Get instance settings');
- deepEqual(inp.datepicker('option', 'defaults'), $.datepicker._defaults,
- 'Get default settings');
+ inp = TestHelpers.datepicker.init("#inp");
+ equal(inp.datepicker("option", "showOn"), "focus", "Initial setting showOn");
+ inp.datepicker("option", "showOn", "button");
+ equal(inp.datepicker("option", "showOn"), "button", "Change instance showOn");
+ inp.datepicker("option", "showOn", undefined);
+ equal(inp.datepicker("option", "showOn"), "focus", "Reset instance showOn");
+ deepEqual(inp.datepicker("option", "all"), {showAnim: ""}, "Get instance settings");
+ deepEqual(inp.datepicker("option", "defaults"), $.datepicker._defaults,
+ "Get default settings");
});
test( "disabled", function() {
expect(8);
- var inp = TestHelpers.datepicker.init('#inp');
- ok(!inp.datepicker('isDisabled'), 'Initially marked as enabled');
- ok(!inp[0].disabled, 'Field initially enabled');
- inp.datepicker('option', 'disabled', true);
- ok(inp.datepicker('isDisabled'), 'Marked as disabled');
- ok(inp[0].disabled, 'Field now disabled');
- inp.datepicker('option', 'disabled', false);
- ok(!inp.datepicker('isDisabled'), 'Marked as enabled');
- ok(!inp[0].disabled, 'Field now enabled');
- inp.datepicker('destroy');
+ var inp = TestHelpers.datepicker.init("#inp");
+ ok(!inp.datepicker("isDisabled"), "Initially marked as enabled");
+ ok(!inp[0].disabled, "Field initially enabled");
+ inp.datepicker("option", "disabled", true);
+ ok(inp.datepicker("isDisabled"), "Marked as disabled");
+ ok(inp[0].disabled, "Field now disabled");
+ inp.datepicker("option", "disabled", false);
+ ok(!inp.datepicker("isDisabled"), "Marked as enabled");
+ ok(!inp[0].disabled, "Field now enabled");
+ inp.datepicker("destroy");
- inp = TestHelpers.datepicker.init('#inp', { disabled: true });
- ok(inp.datepicker('isDisabled'), 'Initially marked as disabled');
- ok(inp[0].disabled, 'Field initially disabled');
+ inp = TestHelpers.datepicker.init("#inp", { disabled: true });
+ ok(inp.datepicker("isDisabled"), "Initially marked as disabled");
+ ok(inp[0].disabled, "Field initially disabled");
});
-test('change', function() {
+test("change", function() {
expect( 12 );
- var inp = TestHelpers.datepicker.init('#inp'),
+ var inp = TestHelpers.datepicker.init("#inp"),
inst = $.data(inp[0], TestHelpers.datepicker.PROP_NAME);
- equal(inst.settings.showOn, null, 'Initial setting showOn');
- equal($.datepicker._get(inst, 'showOn'), 'focus', 'Initial instance showOn');
- equal($.datepicker._defaults.showOn, 'focus', 'Initial default showOn');
- inp.datepicker('change', 'showOn', 'button');
- equal(inst.settings.showOn, 'button', 'Change setting showOn');
- equal($.datepicker._get(inst, 'showOn'), 'button', 'Change instance showOn');
- equal($.datepicker._defaults.showOn, 'focus', 'Retain default showOn');
- inp.datepicker('change', {showOn: 'both'});
- equal(inst.settings.showOn, 'both', 'Change setting showOn');
- equal($.datepicker._get(inst, 'showOn'), 'both', 'Change instance showOn');
- equal($.datepicker._defaults.showOn, 'focus', 'Retain default showOn');
- inp.datepicker('change', 'showOn', undefined);
- equal(inst.settings.showOn, null, 'Clear setting showOn');
- equal($.datepicker._get(inst, 'showOn'), 'focus', 'Restore instance showOn');
- equal($.datepicker._defaults.showOn, 'focus', 'Retain default showOn');
+ equal(inst.settings.showOn, null, "Initial setting showOn");
+ equal($.datepicker._get(inst, "showOn"), "focus", "Initial instance showOn");
+ equal($.datepicker._defaults.showOn, "focus", "Initial default showOn");
+ inp.datepicker("change", "showOn", "button");
+ equal(inst.settings.showOn, "button", "Change setting showOn");
+ equal($.datepicker._get(inst, "showOn"), "button", "Change instance showOn");
+ equal($.datepicker._defaults.showOn, "focus", "Retain default showOn");
+ inp.datepicker("change", {showOn: "both"});
+ equal(inst.settings.showOn, "both", "Change setting showOn");
+ equal($.datepicker._get(inst, "showOn"), "both", "Change instance showOn");
+ equal($.datepicker._defaults.showOn, "focus", "Retain default showOn");
+ inp.datepicker("change", "showOn", undefined);
+ equal(inst.settings.showOn, null, "Clear setting showOn");
+ equal($.datepicker._get(inst, "showOn"), "focus", "Restore instance showOn");
+ equal($.datepicker._defaults.showOn, "focus", "Retain default showOn");
});
-asyncTest('invocation', function() {
+asyncTest("invocation", function() {
expect( 29 );
var button, image,
- inp = TestHelpers.datepicker.init('#inp'),
- dp = $('#ui-datepicker-div'),
- body = $('body');
+ inp = TestHelpers.datepicker.init("#inp"),
+ dp = $("#ui-datepicker-div"),
+ body = $("body");
function step1() {
// On focus
- button = inp.siblings('button');
- ok(button.length === 0, 'Focus - button absent');
- image = inp.siblings('img');
- ok(image.length === 0, 'Focus - image absent');
+ button = inp.siblings("button");
+ ok(button.length === 0, "Focus - button absent");
+ image = inp.siblings("img");
+ ok(image.length === 0, "Focus - image absent");
inp[0].focus();
setTimeout(function() {
- ok(dp.is(':visible'), 'Focus - rendered on focus');
- inp.simulate('keydown', {keyCode: $.ui.keyCode.ESCAPE});
- ok(!dp.is(':visible'), 'Focus - hidden on exit');
+ ok(dp.is(":visible"), "Focus - rendered on focus");
+ inp.simulate("keydown", {keyCode: $.ui.keyCode.ESCAPE});
+ ok(!dp.is(":visible"), "Focus - hidden on exit");
inp[0].blur();
setTimeout(function() {
inp[0].focus();
setTimeout(function() {
- ok(dp.is(':visible'), 'Focus - rendered on focus');
- body.simulate('mousedown', {});
- ok(!dp.is(':visible'), 'Focus - hidden on external click');
- inp.datepicker('hide').datepicker('destroy');
+ ok(dp.is(":visible"), "Focus - rendered on focus");
+ body.simulate("mousedown", {});
+ ok(!dp.is(":visible"), "Focus - hidden on external click");
+ inp.datepicker("hide").datepicker("destroy");
step2();
});
@@ -122,21 +122,21 @@ asyncTest('invocation', function() {
function step2() {
// On button
- inp = TestHelpers.datepicker.init('#inp', {showOn: 'button', buttonText: 'Popup'});
- ok(!dp.is(':visible'), 'Button - initially hidden');
- button = inp.siblings('button');
- image = inp.siblings('img');
- ok(button.length === 1, 'Button - button present');
- ok(image.length === 0, 'Button - image absent');
- equal(button.text(), 'Popup', 'Button - button text');
+ inp = TestHelpers.datepicker.init("#inp", {showOn: "button", buttonText: "Popup"});
+ ok(!dp.is(":visible"), "Button - initially hidden");
+ button = inp.siblings("button");
+ image = inp.siblings("img");
+ ok(button.length === 1, "Button - button present");
+ ok(image.length === 0, "Button - image absent");
+ equal(button.text(), "Popup", "Button - button text");
inp[0].focus();
setTimeout(function() {
- ok(!dp.is(':visible'), 'Button - not rendered on focus');
+ ok(!dp.is(":visible"), "Button - not rendered on focus");
button.click();
- ok(dp.is(':visible'), 'Button - rendered on button click');
+ ok(dp.is(":visible"), "Button - rendered on button click");
button.click();
- ok(!dp.is(':visible'), 'Button - hidden on second button click');
- inp.datepicker('hide').datepicker('destroy');
+ ok(!dp.is(":visible"), "Button - hidden on second button click");
+ inp.datepicker("hide").datepicker("destroy");
step3();
});
@@ -144,23 +144,23 @@ asyncTest('invocation', function() {
function step3() {
// On image button
- inp = TestHelpers.datepicker.init('#inp', {showOn: 'button', buttonImageOnly: true,
- buttonImage: 'img/calendar.gif', buttonText: 'Cal'});
- ok(!dp.is(':visible'), 'Image button - initially hidden');
- button = inp.siblings('button');
- ok(button.length === 0, 'Image button - button absent');
- image = inp.siblings('img');
- ok(image.length === 1, 'Image button - image present');
- equal(image.attr('src'), 'img/calendar.gif', 'Image button - image source');
- equal(image.attr('title'), 'Cal', 'Image button - image text');
+ inp = TestHelpers.datepicker.init("#inp", {showOn: "button", buttonImageOnly: true,
+ buttonImage: "img/calendar.gif", buttonText: "Cal"});
+ ok(!dp.is(":visible"), "Image button - initially hidden");
+ button = inp.siblings("button");
+ ok(button.length === 0, "Image button - button absent");
+ image = inp.siblings("img");
+ ok(image.length === 1, "Image button - image present");
+ equal(image.attr("src"), "img/calendar.gif", "Image button - image source");
+ equal(image.attr("title"), "Cal", "Image button - image text");
inp[0].focus();
setTimeout(function() {
- ok(!dp.is(':visible'), 'Image button - not rendered on focus');
+ ok(!dp.is(":visible"), "Image button - not rendered on focus");
image.click();
- ok(dp.is(':visible'), 'Image button - rendered on image click');
+ ok(dp.is(":visible"), "Image button - rendered on image click");
image.click();
- ok(!dp.is(':visible'), 'Image button - hidden on second image click');
- inp.datepicker('hide').datepicker('destroy');
+ ok(!dp.is(":visible"), "Image button - hidden on second image click");
+ inp.datepicker("hide").datepicker("destroy");
step4();
});
@@ -168,26 +168,26 @@ asyncTest('invocation', function() {
function step4() {
// On both
- inp = TestHelpers.datepicker.init('#inp', {showOn: 'both', buttonImage: 'img/calendar.gif'});
- ok(!dp.is(':visible'), 'Both - initially hidden');
- button = inp.siblings('button');
- ok(button.length === 1, 'Both - button present');
- image = inp.siblings('img');
- ok(image.length === 0, 'Both - image absent');
- image = button.children('img');
- ok(image.length === 1, 'Both - button image present');
+ inp = TestHelpers.datepicker.init("#inp", {showOn: "both", buttonImage: "img/calendar.gif"});
+ ok(!dp.is(":visible"), "Both - initially hidden");
+ button = inp.siblings("button");
+ ok(button.length === 1, "Both - button present");
+ image = inp.siblings("img");
+ ok(image.length === 0, "Both - image absent");
+ image = button.children("img");
+ ok(image.length === 1, "Both - button image present");
inp[0].blur();
setTimeout(function() {
inp[0].focus();
setTimeout(function() {
- ok(dp.is(':visible'), 'Both - rendered on focus');
- body.simulate('mousedown', {});
- ok(!dp.is(':visible'), 'Both - hidden on external click');
+ ok(dp.is(":visible"), "Both - rendered on focus");
+ body.simulate("mousedown", {});
+ ok(!dp.is(":visible"), "Both - hidden on external click");
button.click();
- ok(dp.is(':visible'), 'Both - rendered on button click');
+ ok(dp.is(":visible"), "Both - rendered on button click");
button.click();
- ok(!dp.is(':visible'), 'Both - hidden on second button click');
- inp.datepicker('hide').datepicker('destroy');
+ ok(!dp.is(":visible"), "Both - hidden on second button click");
+ inp.datepicker("hide").datepicker("destroy");
start();
});
@@ -197,521 +197,521 @@ asyncTest('invocation', function() {
step1();
});
-test('otherMonths', function() {
+test("otherMonths", function() {
expect( 8 );
- var inp = TestHelpers.datepicker.init('#inp'),
- pop = $('#ui-datepicker-div');
- inp.val('06/01/2009').datepicker('show');
- equal(pop.find('tbody').text(),
+ var inp = TestHelpers.datepicker.init("#inp"),
+ pop = $("#ui-datepicker-div");
+ inp.val("06/01/2009").datepicker("show");
+ equal(pop.find("tbody").text(),
// support: IE <9, jQuery <1.8
// In IE7/8 with jQuery <1.8, encoded spaces behave in strange ways
$( "
\u00a0123456789101112131415161718192021222324252627282930\u00a0\u00a0\u00a0\u00a0 " ).text(),
- 'Other months - none');
- ok(pop.find('td:last *').length === 0, 'Other months - no content');
- inp.datepicker('hide').datepicker('option', 'showOtherMonths', true).datepicker('show');
- equal(pop.find('tbody').text(), '311234567891011121314151617181920212223242526272829301234',
- 'Other months - show');
- ok(pop.find('td:last span').length === 1, 'Other months - span content');
- inp.datepicker('hide').datepicker('option', 'selectOtherMonths', true).datepicker('show');
- equal(pop.find('tbody').text(), '311234567891011121314151617181920212223242526272829301234',
- 'Other months - select');
- ok(pop.find('td:last a').length === 1, 'Other months - link content');
- inp.datepicker('hide').datepicker('option', 'showOtherMonths', false).datepicker('show');
- equal(pop.find('tbody').text(),
+ "Other months - none");
+ ok(pop.find("td:last *").length === 0, "Other months - no content");
+ inp.datepicker("hide").datepicker("option", "showOtherMonths", true).datepicker("show");
+ equal(pop.find("tbody").text(), "311234567891011121314151617181920212223242526272829301234",
+ "Other months - show");
+ ok(pop.find("td:last span").length === 1, "Other months - span content");
+ inp.datepicker("hide").datepicker("option", "selectOtherMonths", true).datepicker("show");
+ equal(pop.find("tbody").text(), "311234567891011121314151617181920212223242526272829301234",
+ "Other months - select");
+ ok(pop.find("td:last a").length === 1, "Other months - link content");
+ inp.datepicker("hide").datepicker("option", "showOtherMonths", false).datepicker("show");
+ equal(pop.find("tbody").text(),
// support: IE <9, jQuery <1.8
// In IE7/8 with jQuery <1.8, encoded spaces behave in strange ways
$( "
\u00a0123456789101112131415161718192021222324252627282930\u00a0\u00a0\u00a0\u00a0 " ).text(),
- 'Other months - none');
- ok(pop.find('td:last *').length === 0, 'Other months - no content');
+ "Other months - none");
+ ok(pop.find("td:last *").length === 0, "Other months - no content");
});
-test('defaultDate', function() {
+test("defaultDate", function() {
expect( 16 );
- var inp = TestHelpers.datepicker.init('#inp'),
+ var inp = TestHelpers.datepicker.init("#inp"),
date = new Date();
- inp.val('').datepicker('show').
- simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
- TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), date, 'Default date null');
+ inp.val("").datepicker("show").
+ simulate("keydown", {keyCode: $.ui.keyCode.ENTER});
+ TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), date, "Default date null");
// Numeric values
- inp.datepicker('option', {defaultDate: -2}).
- datepicker('hide').val('').datepicker('show').
- simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
+ inp.datepicker("option", {defaultDate: -2}).
+ datepicker("hide").val("").datepicker("show").
+ simulate("keydown", {keyCode: $.ui.keyCode.ENTER});
date.setDate(date.getDate() - 2);
- TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), date, 'Default date -2');
+ TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), date, "Default date -2");
date = new Date();
- inp.datepicker('option', {defaultDate: 3}).
- datepicker('hide').val('').datepicker('show').
- simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
+ inp.datepicker("option", {defaultDate: 3}).
+ datepicker("hide").val("").datepicker("show").
+ simulate("keydown", {keyCode: $.ui.keyCode.ENTER});
date.setDate(date.getDate() + 3);
- TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), date, 'Default date 3');
+ TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), date, "Default date 3");
date = new Date();
- inp.datepicker('option', {defaultDate: 1 / 'a'}).
- datepicker('hide').val('').datepicker('show').
- simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
- TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), date, 'Default date NaN');
+ inp.datepicker("option", {defaultDate: 1 / "a"}).
+ datepicker("hide").val("").datepicker("show").
+ simulate("keydown", {keyCode: $.ui.keyCode.ENTER});
+ TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), date, "Default date NaN");
// String offset values
- inp.datepicker('option', {defaultDate: '-1d'}).
- datepicker('hide').val('').datepicker('show').
- simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
+ inp.datepicker("option", {defaultDate: "-1d"}).
+ datepicker("hide").val("").datepicker("show").
+ simulate("keydown", {keyCode: $.ui.keyCode.ENTER});
date.setDate(date.getDate() - 1);
- TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), date, 'Default date -1d');
- inp.datepicker('option', {defaultDate: '+3D'}).
- datepicker('hide').val('').datepicker('show').
- simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
+ TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), date, "Default date -1d");
+ inp.datepicker("option", {defaultDate: "+3D"}).
+ datepicker("hide").val("").datepicker("show").
+ simulate("keydown", {keyCode: $.ui.keyCode.ENTER});
date.setDate(date.getDate() + 4);
- TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), date, 'Default date +3D');
- inp.datepicker('option', {defaultDate: ' -2 w '}).
- datepicker('hide').val('').datepicker('show').
- simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
+ TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), date, "Default date +3D");
+ inp.datepicker("option", {defaultDate: " -2 w "}).
+ datepicker("hide").val("").datepicker("show").
+ simulate("keydown", {keyCode: $.ui.keyCode.ENTER});
date = new Date();
date.setDate(date.getDate() - 14);
- TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), date, 'Default date -2 w');
- inp.datepicker('option', {defaultDate: '+1 W'}).
- datepicker('hide').val('').datepicker('show').
- simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
+ TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), date, "Default date -2 w");
+ inp.datepicker("option", {defaultDate: "+1 W"}).
+ datepicker("hide").val("").datepicker("show").
+ simulate("keydown", {keyCode: $.ui.keyCode.ENTER});
date.setDate(date.getDate() + 21);
- TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), date, 'Default date +1 W');
- inp.datepicker('option', {defaultDate: ' -1 m '}).
- datepicker('hide').val('').datepicker('show').
- simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
+ TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), date, "Default date +1 W");
+ inp.datepicker("option", {defaultDate: " -1 m "}).
+ datepicker("hide").val("").datepicker("show").
+ simulate("keydown", {keyCode: $.ui.keyCode.ENTER});
date = TestHelpers.datepicker.addMonths(new Date(), -1);
- TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), date, 'Default date -1 m');
- inp.datepicker('option', {defaultDate: '+2M'}).
- datepicker('hide').val('').datepicker('show').
- simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
+ TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), date, "Default date -1 m");
+ inp.datepicker("option", {defaultDate: "+2M"}).
+ datepicker("hide").val("").datepicker("show").
+ simulate("keydown", {keyCode: $.ui.keyCode.ENTER});
date = TestHelpers.datepicker.addMonths(new Date(), 2);
- TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), date, 'Default date +2M');
- inp.datepicker('option', {defaultDate: '-2y'}).
- datepicker('hide').val('').datepicker('show').
- simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
+ TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), date, "Default date +2M");
+ inp.datepicker("option", {defaultDate: "-2y"}).
+ datepicker("hide").val("").datepicker("show").
+ simulate("keydown", {keyCode: $.ui.keyCode.ENTER});
date = new Date();
date.setFullYear(date.getFullYear() - 2);
- TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), date, 'Default date -2y');
- inp.datepicker('option', {defaultDate: '+1 Y '}).
- datepicker('hide').val('').datepicker('show').
- simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
+ TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), date, "Default date -2y");
+ inp.datepicker("option", {defaultDate: "+1 Y "}).
+ datepicker("hide").val("").datepicker("show").
+ simulate("keydown", {keyCode: $.ui.keyCode.ENTER});
date.setFullYear(date.getFullYear() + 3);
- TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), date, 'Default date +1 Y');
- inp.datepicker('option', {defaultDate: '+1M +10d'}).
- datepicker('hide').val('').datepicker('show').
- simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
+ TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), date, "Default date +1 Y");
+ inp.datepicker("option", {defaultDate: "+1M +10d"}).
+ datepicker("hide").val("").datepicker("show").
+ simulate("keydown", {keyCode: $.ui.keyCode.ENTER});
date = TestHelpers.datepicker.addMonths(new Date(), 1);
date.setDate(date.getDate() + 10);
- TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), date, 'Default date +1M +10d');
+ TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), date, "Default date +1M +10d");
// String date values
- inp.datepicker('option', {defaultDate: '07/04/2007'}).
- datepicker('hide').val('').datepicker('show').
- simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
+ inp.datepicker("option", {defaultDate: "07/04/2007"}).
+ datepicker("hide").val("").datepicker("show").
+ simulate("keydown", {keyCode: $.ui.keyCode.ENTER});
date = new Date(2007, 7 - 1, 4);
- TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), date, 'Default date 07/04/2007');
- inp.datepicker('option', {dateFormat: 'yy-mm-dd', defaultDate: '2007-04-02'}).
- datepicker('hide').val('').datepicker('show').
- simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
+ TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), date, "Default date 07/04/2007");
+ inp.datepicker("option", {dateFormat: "yy-mm-dd", defaultDate: "2007-04-02"}).
+ datepicker("hide").val("").datepicker("show").
+ simulate("keydown", {keyCode: $.ui.keyCode.ENTER});
date = new Date(2007, 4 - 1, 2);
- TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), date, 'Default date 2007-04-02');
+ TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), date, "Default date 2007-04-02");
// Date value
date = new Date(2007, 1 - 1, 26);
- inp.datepicker('option', {dateFormat: 'mm/dd/yy', defaultDate: date}).
- datepicker('hide').val('').datepicker('show').
- simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
- TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), date, 'Default date 01/26/2007');
+ inp.datepicker("option", {dateFormat: "mm/dd/yy", defaultDate: date}).
+ datepicker("hide").val("").datepicker("show").
+ simulate("keydown", {keyCode: $.ui.keyCode.ENTER});
+ TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), date, "Default date 01/26/2007");
});
-test('miscellaneous', function() {
+test("miscellaneous", function() {
expect( 19 );
var curYear, longNames, shortNames, date,
- dp = $('#ui-datepicker-div'),
- inp = TestHelpers.datepicker.init('#inp');
+ dp = $("#ui-datepicker-div"),
+ inp = TestHelpers.datepicker.init("#inp");
// Year range
function genRange(start, offset) {
var i = start,
- range = '';
+ range = "";
for (; i < start + offset; i++) {
range += i;
}
return range;
}
curYear = new Date().getFullYear();
- inp.val('02/04/2008').datepicker('show');
- equal(dp.find('.ui-datepicker-year').text(), '2008', 'Year range - read-only default');
- inp.datepicker('hide').datepicker('option', {changeYear: true}).datepicker('show');
- equal(dp.find('.ui-datepicker-year').text(), genRange(2008 - 10, 21), 'Year range - changeable default');
- inp.datepicker('hide').datepicker('option', {yearRange: 'c-6:c+2', changeYear: true}).datepicker('show');
- equal(dp.find('.ui-datepicker-year').text(), genRange(2008 - 6, 9), 'Year range - c-6:c+2');
- inp.datepicker('hide').datepicker('option', {yearRange: '2000:2010', changeYear: true}).datepicker('show');
- equal(dp.find('.ui-datepicker-year').text(), genRange(2000, 11), 'Year range - 2000:2010');
- inp.datepicker('hide').datepicker('option', {yearRange: '-5:+3', changeYear: true}).datepicker('show');
- equal(dp.find('.ui-datepicker-year').text(), genRange(curYear - 5, 9), 'Year range - -5:+3');
- inp.datepicker('hide').datepicker('option', {yearRange: '2000:-5', changeYear: true}).datepicker('show');
- equal(dp.find('.ui-datepicker-year').text(), genRange(2000, curYear - 2004), 'Year range - 2000:-5');
- inp.datepicker('hide').datepicker('option', {yearRange: '', changeYear: true}).datepicker('show');
- equal(dp.find('.ui-datepicker-year').text(), genRange(curYear, 1), 'Year range - -6:+2');
+ inp.val("02/04/2008").datepicker("show");
+ equal(dp.find(".ui-datepicker-year").text(), "2008", "Year range - read-only default");
+ inp.datepicker("hide").datepicker("option", {changeYear: true}).datepicker("show");
+ equal(dp.find(".ui-datepicker-year").text(), genRange(2008 - 10, 21), "Year range - changeable default");
+ inp.datepicker("hide").datepicker("option", {yearRange: "c-6:c+2", changeYear: true}).datepicker("show");
+ equal(dp.find(".ui-datepicker-year").text(), genRange(2008 - 6, 9), "Year range - c-6:c+2");
+ inp.datepicker("hide").datepicker("option", {yearRange: "2000:2010", changeYear: true}).datepicker("show");
+ equal(dp.find(".ui-datepicker-year").text(), genRange(2000, 11), "Year range - 2000:2010");
+ inp.datepicker("hide").datepicker("option", {yearRange: "-5:+3", changeYear: true}).datepicker("show");
+ equal(dp.find(".ui-datepicker-year").text(), genRange(curYear - 5, 9), "Year range - -5:+3");
+ inp.datepicker("hide").datepicker("option", {yearRange: "2000:-5", changeYear: true}).datepicker("show");
+ equal(dp.find(".ui-datepicker-year").text(), genRange(2000, curYear - 2004), "Year range - 2000:-5");
+ inp.datepicker("hide").datepicker("option", {yearRange: "", changeYear: true}).datepicker("show");
+ equal(dp.find(".ui-datepicker-year").text(), genRange(curYear, 1), "Year range - -6:+2");
// Navigation as date format
- inp.datepicker('option', {showButtonPanel: true});
- equal(dp.find('.ui-datepicker-prev').text(), 'Prev', 'Navigation prev - default');
- equal(dp.find('.ui-datepicker-current').text(), 'Today', 'Navigation current - default');
- equal(dp.find('.ui-datepicker-next').text(), 'Next', 'Navigation next - default');
- inp.datepicker('hide').datepicker('option', {navigationAsDateFormat: true, prevText: '< M', currentText: 'MM', nextText: 'M >'}).
- val('02/04/2008').datepicker('show');
- longNames = $.datepicker.regional[''].monthNames;
- shortNames = $.datepicker.regional[''].monthNamesShort;
+ inp.datepicker("option", {showButtonPanel: true});
+ equal(dp.find(".ui-datepicker-prev").text(), "Prev", "Navigation prev - default");
+ equal(dp.find(".ui-datepicker-current").text(), "Today", "Navigation current - default");
+ equal(dp.find(".ui-datepicker-next").text(), "Next", "Navigation next - default");
+ inp.datepicker("hide").datepicker("option", {navigationAsDateFormat: true, prevText: "< M", currentText: "MM", nextText: "M >"}).
+ val("02/04/2008").datepicker("show");
+ longNames = $.datepicker.regional[""].monthNames;
+ shortNames = $.datepicker.regional[""].monthNamesShort;
date = new Date();
- equal(dp.find('.ui-datepicker-prev').text(), '< ' + shortNames[0], 'Navigation prev - as date format');
- equal(dp.find('.ui-datepicker-current').text(),
- longNames[date.getMonth()], 'Navigation current - as date format');
- equal(dp.find('.ui-datepicker-next').text(),
- shortNames[2] + ' >', 'Navigation next - as date format');
- inp.simulate('keydown', {keyCode: $.ui.keyCode.PAGE_DOWN});
- equal(dp.find('.ui-datepicker-prev').text(),
- '< ' + shortNames[1], 'Navigation prev - as date format + pgdn');
- equal(dp.find('.ui-datepicker-current').text(),
- longNames[date.getMonth()], 'Navigation current - as date format + pgdn');
- equal(dp.find('.ui-datepicker-next').text(),
- shortNames[3] + ' >', 'Navigation next - as date format + pgdn');
- inp.datepicker('hide').datepicker('option', {gotoCurrent: true}).
- val('02/04/2008').datepicker('show');
- equal(dp.find('.ui-datepicker-prev').text(),
- '< ' + shortNames[0], 'Navigation prev - as date format + goto current');
- equal(dp.find('.ui-datepicker-current').text(),
- longNames[1], 'Navigation current - as date format + goto current');
- equal(dp.find('.ui-datepicker-next').text(),
- shortNames[2] + ' >', 'Navigation next - as date format + goto current');
+ equal(dp.find(".ui-datepicker-prev").text(), "< " + shortNames[0], "Navigation prev - as date format");
+ equal(dp.find(".ui-datepicker-current").text(),
+ longNames[date.getMonth()], "Navigation current - as date format");
+ equal(dp.find(".ui-datepicker-next").text(),
+ shortNames[2] + " >", "Navigation next - as date format");
+ inp.simulate("keydown", {keyCode: $.ui.keyCode.PAGE_DOWN});
+ equal(dp.find(".ui-datepicker-prev").text(),
+ "< " + shortNames[1], "Navigation prev - as date format + pgdn");
+ equal(dp.find(".ui-datepicker-current").text(),
+ longNames[date.getMonth()], "Navigation current - as date format + pgdn");
+ equal(dp.find(".ui-datepicker-next").text(),
+ shortNames[3] + " >", "Navigation next - as date format + pgdn");
+ inp.datepicker("hide").datepicker("option", {gotoCurrent: true}).
+ val("02/04/2008").datepicker("show");
+ equal(dp.find(".ui-datepicker-prev").text(),
+ "< " + shortNames[0], "Navigation prev - as date format + goto current");
+ equal(dp.find(".ui-datepicker-current").text(),
+ longNames[1], "Navigation current - as date format + goto current");
+ equal(dp.find(".ui-datepicker-next").text(),
+ shortNames[2] + " >", "Navigation next - as date format + goto current");
});
-test('minMax', function() {
+test("minMax", function() {
expect( 19 );
var date,
- inp = TestHelpers.datepicker.init('#inp'),
- dp = $('#ui-datepicker-div'),
+ inp = TestHelpers.datepicker.init("#inp"),
+ dp = $("#ui-datepicker-div"),
lastYear = new Date(2007, 6 - 1, 4),
nextYear = new Date(2009, 6 - 1, 4),
minDate = new Date(2008, 2 - 1, 29),
maxDate = new Date(2008, 12 - 1, 7);
- inp.val('06/04/2008').datepicker('show');
- inp.simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_UP}).
- simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
- TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), lastYear,
- 'Min/max - null, null - ctrl+pgup');
- inp.val('06/04/2008').datepicker('show');
- inp.simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_DOWN}).
- simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
- TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), nextYear,
- 'Min/max - null, null - ctrl+pgdn');
- inp.datepicker('option', {minDate: minDate}).
- datepicker('hide').val('06/04/2008').datepicker('show');
- inp.simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_UP}).
- simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
- TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), minDate,
- 'Min/max - 02/29/2008, null - ctrl+pgup');
- inp.val('06/04/2008').datepicker('show');
- inp.simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_DOWN}).
- simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
- TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), nextYear,
- 'Min/max - 02/29/2008, null - ctrl+pgdn');
- inp.datepicker('option', {maxDate: maxDate}).
- datepicker('hide').val('06/04/2008').datepicker('show');
- inp.simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_UP}).
- simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
- TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), minDate,
- 'Min/max - 02/29/2008, 12/07/2008 - ctrl+pgup');
- inp.val('06/04/2008').datepicker('show');
- inp.simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_DOWN}).
- simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
- TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), maxDate,
- 'Min/max - 02/29/2008, 12/07/2008 - ctrl+pgdn');
- inp.datepicker('option', {minDate: null}).
- datepicker('hide').val('06/04/2008').datepicker('show');
- inp.simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_UP}).
- simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
- TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), lastYear,
- 'Min/max - null, 12/07/2008 - ctrl+pgup');
- inp.val('06/04/2008').datepicker('show');
- inp.simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_DOWN}).
- simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
- TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), maxDate,
- 'Min/max - null, 12/07/2008 - ctrl+pgdn');
+ inp.val("06/04/2008").datepicker("show");
+ inp.simulate("keydown", {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_UP}).
+ simulate("keydown", {keyCode: $.ui.keyCode.ENTER});
+ TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), lastYear,
+ "Min/max - null, null - ctrl+pgup");
+ inp.val("06/04/2008").datepicker("show");
+ inp.simulate("keydown", {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_DOWN}).
+ simulate("keydown", {keyCode: $.ui.keyCode.ENTER});
+ TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), nextYear,
+ "Min/max - null, null - ctrl+pgdn");
+ inp.datepicker("option", {minDate: minDate}).
+ datepicker("hide").val("06/04/2008").datepicker("show");
+ inp.simulate("keydown", {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_UP}).
+ simulate("keydown", {keyCode: $.ui.keyCode.ENTER});
+ TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), minDate,
+ "Min/max - 02/29/2008, null - ctrl+pgup");
+ inp.val("06/04/2008").datepicker("show");
+ inp.simulate("keydown", {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_DOWN}).
+ simulate("keydown", {keyCode: $.ui.keyCode.ENTER});
+ TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), nextYear,
+ "Min/max - 02/29/2008, null - ctrl+pgdn");
+ inp.datepicker("option", {maxDate: maxDate}).
+ datepicker("hide").val("06/04/2008").datepicker("show");
+ inp.simulate("keydown", {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_UP}).
+ simulate("keydown", {keyCode: $.ui.keyCode.ENTER});
+ TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), minDate,
+ "Min/max - 02/29/2008, 12/07/2008 - ctrl+pgup");
+ inp.val("06/04/2008").datepicker("show");
+ inp.simulate("keydown", {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_DOWN}).
+ simulate("keydown", {keyCode: $.ui.keyCode.ENTER});
+ TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), maxDate,
+ "Min/max - 02/29/2008, 12/07/2008 - ctrl+pgdn");
+ inp.datepicker("option", {minDate: null}).
+ datepicker("hide").val("06/04/2008").datepicker("show");
+ inp.simulate("keydown", {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_UP}).
+ simulate("keydown", {keyCode: $.ui.keyCode.ENTER});
+ TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), lastYear,
+ "Min/max - null, 12/07/2008 - ctrl+pgup");
+ inp.val("06/04/2008").datepicker("show");
+ inp.simulate("keydown", {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_DOWN}).
+ simulate("keydown", {keyCode: $.ui.keyCode.ENTER});
+ TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), maxDate,
+ "Min/max - null, 12/07/2008 - ctrl+pgdn");
// Relative dates
date = new Date();
date.setDate(date.getDate() - 7);
- inp.datepicker('option', {minDate: '-1w', maxDate: '+1 M +10 D '}).
- datepicker('hide').val('').datepicker('show');
- inp.simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_UP}).
- simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
- TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), date,
- 'Min/max - -1w, +1 M +10 D - ctrl+pgup');
+ inp.datepicker("option", {minDate: "-1w", maxDate: "+1 M +10 D "}).
+ datepicker("hide").val("").datepicker("show");
+ inp.simulate("keydown", {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_UP}).
+ simulate("keydown", {keyCode: $.ui.keyCode.ENTER});
+ TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), date,
+ "Min/max - -1w, +1 M +10 D - ctrl+pgup");
date = TestHelpers.datepicker.addMonths(new Date(), 1);
date.setDate(date.getDate() + 10);
- inp.val('').datepicker('show');
- inp.simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_DOWN}).
- simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
- TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), date,
- 'Min/max - -1w, +1 M +10 D - ctrl+pgdn');
+ inp.val("").datepicker("show");
+ inp.simulate("keydown", {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_DOWN}).
+ simulate("keydown", {keyCode: $.ui.keyCode.ENTER});
+ TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), date,
+ "Min/max - -1w, +1 M +10 D - ctrl+pgdn");
// With existing date
- inp = TestHelpers.datepicker.init('#inp');
- inp.val('06/04/2008').datepicker('option', {minDate: minDate});
- TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), new Date(2008, 6 - 1, 4), 'Min/max - setDate > min');
- inp.datepicker('option', {minDate: null}).val('01/04/2008').datepicker('option', {minDate: minDate});
- TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), minDate, 'Min/max - setDate < min');
- inp.datepicker('option', {minDate: null}).val('06/04/2008').datepicker('option', {maxDate: maxDate});
- TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), new Date(2008, 6 - 1, 4), 'Min/max - setDate < max');
- inp.datepicker('option', {maxDate: null}).val('01/04/2009').datepicker('option', {maxDate: maxDate});
- TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), maxDate, 'Min/max - setDate > max');
- inp.datepicker('option', {maxDate: null}).val('01/04/2008').datepicker('option', {minDate: minDate, maxDate: maxDate});
- TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), minDate, 'Min/max - setDate < min');
- inp.datepicker('option', {maxDate: null}).val('06/04/2008').datepicker('option', {minDate: minDate, maxDate: maxDate});
- TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), new Date(2008, 6 - 1, 4), 'Min/max - setDate > min, < max');
- inp.datepicker('option', {maxDate: null}).val('01/04/2009').datepicker('option', {minDate: minDate, maxDate: maxDate});
- TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), maxDate, 'Min/max - setDate > max');
+ inp = TestHelpers.datepicker.init("#inp");
+ inp.val("06/04/2008").datepicker("option", {minDate: minDate});
+ TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), new Date(2008, 6 - 1, 4), "Min/max - setDate > min");
+ inp.datepicker("option", {minDate: null}).val("01/04/2008").datepicker("option", {minDate: minDate});
+ TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), minDate, "Min/max - setDate < min");
+ inp.datepicker("option", {minDate: null}).val("06/04/2008").datepicker("option", {maxDate: maxDate});
+ TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), new Date(2008, 6 - 1, 4), "Min/max - setDate < max");
+ inp.datepicker("option", {maxDate: null}).val("01/04/2009").datepicker("option", {maxDate: maxDate});
+ TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), maxDate, "Min/max - setDate > max");
+ inp.datepicker("option", {maxDate: null}).val("01/04/2008").datepicker("option", {minDate: minDate, maxDate: maxDate});
+ TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), minDate, "Min/max - setDate < min");
+ inp.datepicker("option", {maxDate: null}).val("06/04/2008").datepicker("option", {minDate: minDate, maxDate: maxDate});
+ TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), new Date(2008, 6 - 1, 4), "Min/max - setDate > min, < max");
+ inp.datepicker("option", {maxDate: null}).val("01/04/2009").datepicker("option", {minDate: minDate, maxDate: maxDate});
+ TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), maxDate, "Min/max - setDate > max");
- inp.datepicker('option', {yearRange: '-0:+1'}).val('01/01/' + new Date().getFullYear());
+ inp.datepicker("option", {yearRange: "-0:+1"}).val("01/01/" + new Date().getFullYear());
ok(dp.find(".ui-datepicker-prev").hasClass("ui-state-disabled"), "Year Range Test - previous button disabled at 1/1/minYear");
inp.datepicker("setDate", "12/30/" + new Date().getFullYear());
ok(dp.find(".ui-datepicker-next").hasClass("ui-state-disabled"), "Year Range Test - next button disabled at 12/30/maxYear");
});
-test('setDate', function() {
+test("setDate", function() {
expect( 24 );
var inl, alt, minDate, maxDate, dateAndTimeToSet, dateAndTimeClone,
- inp = TestHelpers.datepicker.init('#inp'),
+ inp = TestHelpers.datepicker.init("#inp"),
date1 = new Date(2008, 6 - 1, 4),
date2 = new Date();
- ok(inp.datepicker('getDate') == null, 'Set date - default');
- inp.datepicker('setDate', date1);
- TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), date1, 'Set date - 2008-06-04');
+ ok(inp.datepicker("getDate") == null, "Set date - default");
+ inp.datepicker("setDate", date1);
+ TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), date1, "Set date - 2008-06-04");
date1 = new Date();
date1.setDate(date1.getDate() + 7);
- inp.datepicker('setDate', +7);
- TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), date1, 'Set date - +7');
+ inp.datepicker("setDate", +7);
+ TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), date1, "Set date - +7");
date2.setFullYear(date2.getFullYear() + 2);
- inp.datepicker('setDate', '+2y');
- TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), date2, 'Set date - +2y');
- inp.datepicker('setDate', date1, date2);
- TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), date1, 'Set date - two dates');
- inp.datepicker('setDate');
- ok(inp.datepicker('getDate') == null, 'Set date - null');
+ inp.datepicker("setDate", "+2y");
+ TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), date2, "Set date - +2y");
+ inp.datepicker("setDate", date1, date2);
+ TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), date1, "Set date - two dates");
+ inp.datepicker("setDate");
+ ok(inp.datepicker("getDate") == null, "Set date - null");
// Relative to current date
date1 = new Date();
date1.setDate(date1.getDate() + 7);
- inp.datepicker('setDate', 'c +7');
- TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), date1, 'Set date - c +7');
+ inp.datepicker("setDate", "c +7");
+ TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), date1, "Set date - c +7");
date1.setDate(date1.getDate() + 7);
- inp.datepicker('setDate', 'c+7');
- TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), date1, 'Set date - c+7');
+ inp.datepicker("setDate", "c+7");
+ TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), date1, "Set date - c+7");
date1.setDate(date1.getDate() - 21);
- inp.datepicker('setDate', 'c -3 w');
- TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), date1, 'Set date - c -3 w');
+ inp.datepicker("setDate", "c -3 w");
+ TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), date1, "Set date - c -3 w");
// Inline
- inl = TestHelpers.datepicker.init('#inl');
+ inl = TestHelpers.datepicker.init("#inl");
date1 = new Date(2008, 6 - 1, 4);
date2 = new Date();
- TestHelpers.datepicker.equalsDate(inl.datepicker('getDate'), date2, 'Set date inline - default');
- inl.datepicker('setDate', date1);
- TestHelpers.datepicker.equalsDate(inl.datepicker('getDate'), date1, 'Set date inline - 2008-06-04');
+ TestHelpers.datepicker.equalsDate(inl.datepicker("getDate"), date2, "Set date inline - default");
+ inl.datepicker("setDate", date1);
+ TestHelpers.datepicker.equalsDate(inl.datepicker("getDate"), date1, "Set date inline - 2008-06-04");
date1 = new Date();
date1.setDate(date1.getDate() + 7);
- inl.datepicker('setDate', +7);
- TestHelpers.datepicker.equalsDate(inl.datepicker('getDate'), date1, 'Set date inline - +7');
+ inl.datepicker("setDate", +7);
+ TestHelpers.datepicker.equalsDate(inl.datepicker("getDate"), date1, "Set date inline - +7");
date2.setFullYear(date2.getFullYear() + 2);
- inl.datepicker('setDate', '+2y');
- TestHelpers.datepicker.equalsDate(inl.datepicker('getDate'), date2, 'Set date inline - +2y');
- inl.datepicker('setDate', date1, date2);
- TestHelpers.datepicker.equalsDate(inl.datepicker('getDate'), date1, 'Set date inline - two dates');
- inl.datepicker('setDate');
- ok(inl.datepicker('getDate') == null, 'Set date inline - null');
+ inl.datepicker("setDate", "+2y");
+ TestHelpers.datepicker.equalsDate(inl.datepicker("getDate"), date2, "Set date inline - +2y");
+ inl.datepicker("setDate", date1, date2);
+ TestHelpers.datepicker.equalsDate(inl.datepicker("getDate"), date1, "Set date inline - two dates");
+ inl.datepicker("setDate");
+ ok(inl.datepicker("getDate") == null, "Set date inline - null");
// Alternate field
- alt = $('#alt');
- inp.datepicker('option', {altField: '#alt', altFormat: 'yy-mm-dd'});
+ alt = $("#alt");
+ inp.datepicker("option", {altField: "#alt", altFormat: "yy-mm-dd"});
date1 = new Date(2008, 6 - 1, 4);
- inp.datepicker('setDate', date1);
- equal(inp.val(), '06/04/2008', 'Set date alternate - 06/04/2008');
- equal(alt.val(), '2008-06-04', 'Set date alternate - 2008-06-04');
+ inp.datepicker("setDate", date1);
+ equal(inp.val(), "06/04/2008", "Set date alternate - 06/04/2008");
+ equal(alt.val(), "2008-06-04", "Set date alternate - 2008-06-04");
// With minimum/maximum
- inp = TestHelpers.datepicker.init('#inp');
+ inp = TestHelpers.datepicker.init("#inp");
date1 = new Date(2008, 1 - 1, 4);
date2 = new Date(2008, 6 - 1, 4);
minDate = new Date(2008, 2 - 1, 29);
maxDate = new Date(2008, 3 - 1, 28);
- inp.val('').datepicker('option', {minDate: minDate}).datepicker('setDate', date2);
- TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), date2, 'Set date min/max - setDate > min');
- inp.datepicker('setDate', date1);
- TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), minDate, 'Set date min/max - setDate < min');
- inp.val('').datepicker('option', {maxDate: maxDate, minDate: null}).datepicker('setDate', date1);
- TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), date1, 'Set date min/max - setDate < max');
- inp.datepicker('setDate', date2);
- TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), maxDate, 'Set date min/max - setDate > max');
- inp.val('').datepicker('option', {minDate: minDate}).datepicker('setDate', date1);
- TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), minDate, 'Set date min/max - setDate < min');
- inp.datepicker('setDate', date2);
- TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), maxDate, 'Set date min/max - setDate > max');
+ inp.val("").datepicker("option", {minDate: minDate}).datepicker("setDate", date2);
+ TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), date2, "Set date min/max - setDate > min");
+ inp.datepicker("setDate", date1);
+ TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), minDate, "Set date min/max - setDate < min");
+ inp.val("").datepicker("option", {maxDate: maxDate, minDate: null}).datepicker("setDate", date1);
+ TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), date1, "Set date min/max - setDate < max");
+ inp.datepicker("setDate", date2);
+ TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), maxDate, "Set date min/max - setDate > max");
+ inp.val("").datepicker("option", {minDate: minDate}).datepicker("setDate", date1);
+ TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), minDate, "Set date min/max - setDate < min");
+ inp.datepicker("setDate", date2);
+ TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), maxDate, "Set date min/max - setDate > max");
dateAndTimeToSet = new Date(2008, 3 - 1, 28, 1, 11, 0);
dateAndTimeClone = new Date(2008, 3 - 1, 28, 1, 11, 0);
- inp.datepicker('setDate', dateAndTimeToSet);
- equal(dateAndTimeToSet.getTime(), dateAndTimeClone.getTime(), 'Date object passed should not be changed by setDate');
+ inp.datepicker("setDate", dateAndTimeToSet);
+ equal(dateAndTimeToSet.getTime(), dateAndTimeClone.getTime(), "Date object passed should not be changed by setDate");
});
-test('altField', function() {
+test("altField", function() {
expect( 10 );
- var inp = TestHelpers.datepicker.init('#inp'),
- alt = $('#alt');
+ var inp = TestHelpers.datepicker.init("#inp"),
+ alt = $("#alt");
// No alternate field set
- alt.val('');
- inp.val('06/04/2008').datepicker('show');
- inp.simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
- equal(inp.val(), '06/04/2008', 'Alt field - dp - enter');
- equal(alt.val(), '', 'Alt field - alt not set');
+ alt.val("");
+ inp.val("06/04/2008").datepicker("show");
+ inp.simulate("keydown", {keyCode: $.ui.keyCode.ENTER});
+ equal(inp.val(), "06/04/2008", "Alt field - dp - enter");
+ equal(alt.val(), "", "Alt field - alt not set");
// Alternate field set
- alt.val('');
- inp.datepicker('option', {altField: '#alt', altFormat: 'yy-mm-dd'}).
- val('06/04/2008').datepicker('show');
- inp.simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
- equal(inp.val(), '06/04/2008', 'Alt field - dp - enter');
- equal(alt.val(), '2008-06-04', 'Alt field - alt - enter');
+ alt.val("");
+ inp.datepicker("option", {altField: "#alt", altFormat: "yy-mm-dd"}).
+ val("06/04/2008").datepicker("show");
+ inp.simulate("keydown", {keyCode: $.ui.keyCode.ENTER});
+ equal(inp.val(), "06/04/2008", "Alt field - dp - enter");
+ equal(alt.val(), "2008-06-04", "Alt field - alt - enter");
// Move from initial date
- alt.val('');
- inp.val('06/04/2008').datepicker('show');
- inp.simulate('keydown', {keyCode: $.ui.keyCode.PAGE_DOWN}).
- simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
- equal(inp.val(), '07/04/2008', 'Alt field - dp - pgdn');
- equal(alt.val(), '2008-07-04', 'Alt field - alt - pgdn');
+ alt.val("");
+ inp.val("06/04/2008").datepicker("show");
+ inp.simulate("keydown", {keyCode: $.ui.keyCode.PAGE_DOWN}).
+ simulate("keydown", {keyCode: $.ui.keyCode.ENTER});
+ equal(inp.val(), "07/04/2008", "Alt field - dp - pgdn");
+ equal(alt.val(), "2008-07-04", "Alt field - alt - pgdn");
// Alternate field set - closed
- alt.val('');
- inp.val('06/04/2008').datepicker('show');
- inp.simulate('keydown', {keyCode: $.ui.keyCode.PAGE_DOWN}).
- simulate('keydown', {keyCode: $.ui.keyCode.ESCAPE});
- equal(inp.val(), '06/04/2008', 'Alt field - dp - pgdn/esc');
- equal(alt.val(), '', 'Alt field - alt - pgdn/esc');
+ alt.val("");
+ inp.val("06/04/2008").datepicker("show");
+ inp.simulate("keydown", {keyCode: $.ui.keyCode.PAGE_DOWN}).
+ simulate("keydown", {keyCode: $.ui.keyCode.ESCAPE});
+ equal(inp.val(), "06/04/2008", "Alt field - dp - pgdn/esc");
+ equal(alt.val(), "", "Alt field - alt - pgdn/esc");
// Clear date and alternate
- alt.val('');
- inp.val('06/04/2008').datepicker('show');
- inp.simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.END});
- equal(inp.val(), '', 'Alt field - dp - ctrl+end');
- equal(alt.val(), '', 'Alt field - alt - ctrl+end');
+ alt.val("");
+ inp.val("06/04/2008").datepicker("show");
+ inp.simulate("keydown", {ctrlKey: true, keyCode: $.ui.keyCode.END});
+ equal(inp.val(), "", "Alt field - dp - ctrl+end");
+ equal(alt.val(), "", "Alt field - alt - ctrl+end");
});
-test('autoSize', function() {
+test("autoSize", function() {
expect( 15 );
- var inp = TestHelpers.datepicker.init('#inp');
- equal(inp.prop('size'), 20, 'Auto size - default');
- inp.datepicker('option', 'autoSize', true);
- equal(inp.prop('size'), 10, 'Auto size - mm/dd/yy');
- inp.datepicker('option', 'dateFormat', 'm/d/yy');
- equal(inp.prop('size'), 10, 'Auto size - m/d/yy');
- inp.datepicker('option', 'dateFormat', 'D M d yy');
- equal(inp.prop('size'), 15, 'Auto size - D M d yy');
- inp.datepicker('option', 'dateFormat', 'DD, MM dd, yy');
- equal(inp.prop('size'), 29, 'Auto size - DD, MM dd, yy');
+ var inp = TestHelpers.datepicker.init("#inp");
+ equal(inp.prop("size"), 20, "Auto size - default");
+ inp.datepicker("option", "autoSize", true);
+ equal(inp.prop("size"), 10, "Auto size - mm/dd/yy");
+ inp.datepicker("option", "dateFormat", "m/d/yy");
+ equal(inp.prop("size"), 10, "Auto size - m/d/yy");
+ inp.datepicker("option", "dateFormat", "D M d yy");
+ equal(inp.prop("size"), 15, "Auto size - D M d yy");
+ inp.datepicker("option", "dateFormat", "DD, MM dd, yy");
+ equal(inp.prop("size"), 29, "Auto size - DD, MM dd, yy");
// French
- inp.datepicker('option', $.extend({autoSize: false}, $.datepicker.regional.fr));
- equal(inp.prop('size'), 29, 'Auto size - fr - default');
- inp.datepicker('option', 'autoSize', true);
- equal(inp.prop('size'), 10, 'Auto size - fr - dd/mm/yy');
- inp.datepicker('option', 'dateFormat', 'm/d/yy');
- equal(inp.prop('size'), 10, 'Auto size - fr - m/d/yy');
- inp.datepicker('option', 'dateFormat', 'D M d yy');
- equal(inp.prop('size'), 18, 'Auto size - fr - D M d yy');
- inp.datepicker('option', 'dateFormat', 'DD, MM dd, yy');
- equal(inp.prop('size'), 28, 'Auto size - fr - DD, MM dd, yy');
+ inp.datepicker("option", $.extend({autoSize: false}, $.datepicker.regional.fr));
+ equal(inp.prop("size"), 29, "Auto size - fr - default");
+ inp.datepicker("option", "autoSize", true);
+ equal(inp.prop("size"), 10, "Auto size - fr - dd/mm/yy");
+ inp.datepicker("option", "dateFormat", "m/d/yy");
+ equal(inp.prop("size"), 10, "Auto size - fr - m/d/yy");
+ inp.datepicker("option", "dateFormat", "D M d yy");
+ equal(inp.prop("size"), 18, "Auto size - fr - D M d yy");
+ inp.datepicker("option", "dateFormat", "DD, MM dd, yy");
+ equal(inp.prop("size"), 28, "Auto size - fr - DD, MM dd, yy");
// Hebrew
- inp.datepicker('option', $.extend({autoSize: false}, $.datepicker.regional.he));
- equal(inp.prop('size'), 28, 'Auto size - he - default');
- inp.datepicker('option', 'autoSize', true);
- equal(inp.prop('size'), 10, 'Auto size - he - dd/mm/yy');
- inp.datepicker('option', 'dateFormat', 'm/d/yy');
- equal(inp.prop('size'), 10, 'Auto size - he - m/d/yy');
- inp.datepicker('option', 'dateFormat', 'D M d yy');
- equal(inp.prop('size'), 16, 'Auto size - he - D M d yy');
- inp.datepicker('option', 'dateFormat', 'DD, MM dd, yy');
- equal(inp.prop('size'), 23, 'Auto size - he - DD, MM dd, yy');
+ inp.datepicker("option", $.extend({autoSize: false}, $.datepicker.regional.he));
+ equal(inp.prop("size"), 28, "Auto size - he - default");
+ inp.datepicker("option", "autoSize", true);
+ equal(inp.prop("size"), 10, "Auto size - he - dd/mm/yy");
+ inp.datepicker("option", "dateFormat", "m/d/yy");
+ equal(inp.prop("size"), 10, "Auto size - he - m/d/yy");
+ inp.datepicker("option", "dateFormat", "D M d yy");
+ equal(inp.prop("size"), 16, "Auto size - he - D M d yy");
+ inp.datepicker("option", "dateFormat", "DD, MM dd, yy");
+ equal(inp.prop("size"), 23, "Auto size - he - DD, MM dd, yy");
});
-test('daylightSaving', function() {
+test("daylightSaving", function() {
expect( 25 );
- var inp = TestHelpers.datepicker.init('#inp'),
- dp = $('#ui-datepicker-div');
- ok(true, 'Daylight saving - ' + new Date());
+ var inp = TestHelpers.datepicker.init("#inp"),
+ dp = $("#ui-datepicker-div");
+ ok(true, "Daylight saving - " + new Date());
// Australia, Sydney - AM change, southern hemisphere
- inp.val('04/01/2008').datepicker('show');
- $('.ui-datepicker-calendar td:eq(6) a', dp).simulate('click');
- equal(inp.val(), '04/05/2008', 'Daylight saving - Australia 04/05/2008');
- inp.val('04/01/2008').datepicker('show');
- $('.ui-datepicker-calendar td:eq(7) a', dp).simulate('click');
- equal(inp.val(), '04/06/2008', 'Daylight saving - Australia 04/06/2008');
- inp.val('04/01/2008').datepicker('show');
- $('.ui-datepicker-calendar td:eq(8) a', dp).simulate('click');
- equal(inp.val(), '04/07/2008', 'Daylight saving - Australia 04/07/2008');
- inp.val('10/01/2008').datepicker('show');
- $('.ui-datepicker-calendar td:eq(6) a', dp).simulate('click');
- equal(inp.val(), '10/04/2008', 'Daylight saving - Australia 10/04/2008');
- inp.val('10/01/2008').datepicker('show');
- $('.ui-datepicker-calendar td:eq(7) a', dp).simulate('click');
- equal(inp.val(), '10/05/2008', 'Daylight saving - Australia 10/05/2008');
- inp.val('10/01/2008').datepicker('show');
- $('.ui-datepicker-calendar td:eq(8) a', dp).simulate('click');
- equal(inp.val(), '10/06/2008', 'Daylight saving - Australia 10/06/2008');
+ inp.val("04/01/2008").datepicker("show");
+ $(".ui-datepicker-calendar td:eq(6) a", dp).simulate("click");
+ equal(inp.val(), "04/05/2008", "Daylight saving - Australia 04/05/2008");
+ inp.val("04/01/2008").datepicker("show");
+ $(".ui-datepicker-calendar td:eq(7) a", dp).simulate("click");
+ equal(inp.val(), "04/06/2008", "Daylight saving - Australia 04/06/2008");
+ inp.val("04/01/2008").datepicker("show");
+ $(".ui-datepicker-calendar td:eq(8) a", dp).simulate("click");
+ equal(inp.val(), "04/07/2008", "Daylight saving - Australia 04/07/2008");
+ inp.val("10/01/2008").datepicker("show");
+ $(".ui-datepicker-calendar td:eq(6) a", dp).simulate("click");
+ equal(inp.val(), "10/04/2008", "Daylight saving - Australia 10/04/2008");
+ inp.val("10/01/2008").datepicker("show");
+ $(".ui-datepicker-calendar td:eq(7) a", dp).simulate("click");
+ equal(inp.val(), "10/05/2008", "Daylight saving - Australia 10/05/2008");
+ inp.val("10/01/2008").datepicker("show");
+ $(".ui-datepicker-calendar td:eq(8) a", dp).simulate("click");
+ equal(inp.val(), "10/06/2008", "Daylight saving - Australia 10/06/2008");
// Brasil, Brasilia - midnight change, southern hemisphere
- inp.val('02/01/2008').datepicker('show');
- $('.ui-datepicker-calendar td:eq(20) a', dp).simulate('click');
- equal(inp.val(), '02/16/2008', 'Daylight saving - Brasil 02/16/2008');
- inp.val('02/01/2008').datepicker('show');
- $('.ui-datepicker-calendar td:eq(21) a', dp).simulate('click');
- equal(inp.val(), '02/17/2008', 'Daylight saving - Brasil 02/17/2008');
- inp.val('02/01/2008').datepicker('show');
- $('.ui-datepicker-calendar td:eq(22) a', dp).simulate('click');
- equal(inp.val(), '02/18/2008', 'Daylight saving - Brasil 02/18/2008');
- inp.val('10/01/2008').datepicker('show');
- $('.ui-datepicker-calendar td:eq(13) a', dp).simulate('click');
- equal(inp.val(), '10/11/2008', 'Daylight saving - Brasil 10/11/2008');
- inp.val('10/01/2008').datepicker('show');
- $('.ui-datepicker-calendar td:eq(14) a', dp).simulate('click');
- equal(inp.val(), '10/12/2008', 'Daylight saving - Brasil 10/12/2008');
- inp.val('10/01/2008').datepicker('show');
- $('.ui-datepicker-calendar td:eq(15) a', dp).simulate('click');
- equal(inp.val(), '10/13/2008', 'Daylight saving - Brasil 10/13/2008');
+ inp.val("02/01/2008").datepicker("show");
+ $(".ui-datepicker-calendar td:eq(20) a", dp).simulate("click");
+ equal(inp.val(), "02/16/2008", "Daylight saving - Brasil 02/16/2008");
+ inp.val("02/01/2008").datepicker("show");
+ $(".ui-datepicker-calendar td:eq(21) a", dp).simulate("click");
+ equal(inp.val(), "02/17/2008", "Daylight saving - Brasil 02/17/2008");
+ inp.val("02/01/2008").datepicker("show");
+ $(".ui-datepicker-calendar td:eq(22) a", dp).simulate("click");
+ equal(inp.val(), "02/18/2008", "Daylight saving - Brasil 02/18/2008");
+ inp.val("10/01/2008").datepicker("show");
+ $(".ui-datepicker-calendar td:eq(13) a", dp).simulate("click");
+ equal(inp.val(), "10/11/2008", "Daylight saving - Brasil 10/11/2008");
+ inp.val("10/01/2008").datepicker("show");
+ $(".ui-datepicker-calendar td:eq(14) a", dp).simulate("click");
+ equal(inp.val(), "10/12/2008", "Daylight saving - Brasil 10/12/2008");
+ inp.val("10/01/2008").datepicker("show");
+ $(".ui-datepicker-calendar td:eq(15) a", dp).simulate("click");
+ equal(inp.val(), "10/13/2008", "Daylight saving - Brasil 10/13/2008");
// Lebanon, Beirut - midnight change, northern hemisphere
- inp.val('03/01/2008').datepicker('show');
- $('.ui-datepicker-calendar td:eq(34) a', dp).simulate('click');
- equal(inp.val(), '03/29/2008', 'Daylight saving - Lebanon 03/29/2008');
- inp.val('03/01/2008').datepicker('show');
- $('.ui-datepicker-calendar td:eq(35) a', dp).simulate('click');
- equal(inp.val(), '03/30/2008', 'Daylight saving - Lebanon 03/30/2008');
- inp.val('03/01/2008').datepicker('show');
- $('.ui-datepicker-calendar td:eq(36) a', dp).simulate('click');
- equal(inp.val(), '03/31/2008', 'Daylight saving - Lebanon 03/31/2008');
- inp.val('10/01/2008').datepicker('show');
- $('.ui-datepicker-calendar td:eq(27) a', dp).simulate('click');
- equal(inp.val(), '10/25/2008', 'Daylight saving - Lebanon 10/25/2008');
- inp.val('10/01/2008').datepicker('show');
- $('.ui-datepicker-calendar td:eq(28) a', dp).simulate('click');
- equal(inp.val(), '10/26/2008', 'Daylight saving - Lebanon 10/26/2008');
- inp.val('10/01/2008').datepicker('show');
- $('.ui-datepicker-calendar td:eq(29) a', dp).simulate('click');
- equal(inp.val(), '10/27/2008', 'Daylight saving - Lebanon 10/27/2008');
+ inp.val("03/01/2008").datepicker("show");
+ $(".ui-datepicker-calendar td:eq(34) a", dp).simulate("click");
+ equal(inp.val(), "03/29/2008", "Daylight saving - Lebanon 03/29/2008");
+ inp.val("03/01/2008").datepicker("show");
+ $(".ui-datepicker-calendar td:eq(35) a", dp).simulate("click");
+ equal(inp.val(), "03/30/2008", "Daylight saving - Lebanon 03/30/2008");
+ inp.val("03/01/2008").datepicker("show");
+ $(".ui-datepicker-calendar td:eq(36) a", dp).simulate("click");
+ equal(inp.val(), "03/31/2008", "Daylight saving - Lebanon 03/31/2008");
+ inp.val("10/01/2008").datepicker("show");
+ $(".ui-datepicker-calendar td:eq(27) a", dp).simulate("click");
+ equal(inp.val(), "10/25/2008", "Daylight saving - Lebanon 10/25/2008");
+ inp.val("10/01/2008").datepicker("show");
+ $(".ui-datepicker-calendar td:eq(28) a", dp).simulate("click");
+ equal(inp.val(), "10/26/2008", "Daylight saving - Lebanon 10/26/2008");
+ inp.val("10/01/2008").datepicker("show");
+ $(".ui-datepicker-calendar td:eq(29) a", dp).simulate("click");
+ equal(inp.val(), "10/27/2008", "Daylight saving - Lebanon 10/27/2008");
// US, Eastern - AM change, northern hemisphere
- inp.val('03/01/2008').datepicker('show');
- $('.ui-datepicker-calendar td:eq(13) a', dp).simulate('click');
- equal(inp.val(), '03/08/2008', 'Daylight saving - US 03/08/2008');
- inp.val('03/01/2008').datepicker('show');
- $('.ui-datepicker-calendar td:eq(14) a', dp).simulate('click');
- equal(inp.val(), '03/09/2008', 'Daylight saving - US 03/09/2008');
- inp.val('03/01/2008').datepicker('show');
- $('.ui-datepicker-calendar td:eq(15) a', dp).simulate('click');
- equal(inp.val(), '03/10/2008', 'Daylight saving - US 03/10/2008');
- inp.val('11/01/2008').datepicker('show');
- $('.ui-datepicker-calendar td:eq(6) a', dp).simulate('click');
- equal(inp.val(), '11/01/2008', 'Daylight saving - US 11/01/2008');
- inp.val('11/01/2008').datepicker('show');
- $('.ui-datepicker-calendar td:eq(7) a', dp).simulate('click');
- equal(inp.val(), '11/02/2008', 'Daylight saving - US 11/02/2008');
- inp.val('11/01/2008').datepicker('show');
- $('.ui-datepicker-calendar td:eq(8) a', dp).simulate('click');
- equal(inp.val(), '11/03/2008', 'Daylight saving - US 11/03/2008');
+ inp.val("03/01/2008").datepicker("show");
+ $(".ui-datepicker-calendar td:eq(13) a", dp).simulate("click");
+ equal(inp.val(), "03/08/2008", "Daylight saving - US 03/08/2008");
+ inp.val("03/01/2008").datepicker("show");
+ $(".ui-datepicker-calendar td:eq(14) a", dp).simulate("click");
+ equal(inp.val(), "03/09/2008", "Daylight saving - US 03/09/2008");
+ inp.val("03/01/2008").datepicker("show");
+ $(".ui-datepicker-calendar td:eq(15) a", dp).simulate("click");
+ equal(inp.val(), "03/10/2008", "Daylight saving - US 03/10/2008");
+ inp.val("11/01/2008").datepicker("show");
+ $(".ui-datepicker-calendar td:eq(6) a", dp).simulate("click");
+ equal(inp.val(), "11/01/2008", "Daylight saving - US 11/01/2008");
+ inp.val("11/01/2008").datepicker("show");
+ $(".ui-datepicker-calendar td:eq(7) a", dp).simulate("click");
+ equal(inp.val(), "11/02/2008", "Daylight saving - US 11/02/2008");
+ inp.val("11/01/2008").datepicker("show");
+ $(".ui-datepicker-calendar td:eq(8) a", dp).simulate("click");
+ equal(inp.val(), "11/03/2008", "Daylight saving - US 11/03/2008");
});
var beforeShowThis = null,
@@ -725,245 +725,245 @@ function beforeAll(input, inst) {
beforeShowThis = this;
beforeShowInput = input;
beforeShowInst = inst;
- return {currentText: 'Current'};
+ return {currentText: "Current"};
}
function beforeDay(date) {
beforeShowDayThis = this;
beforeShowDayOK &= (date > new Date(2008, 1 - 1, 26) &&
date < new Date(2008, 3 - 1, 6));
- return [(date.getDate() % 2 === 0), (date.getDate() % 10 === 0 ? 'day10' : ''),
- (date.getDate() % 3 === 0 ? 'Divisble by 3' : '')];
+ return [(date.getDate() % 2 === 0), (date.getDate() % 10 === 0 ? "day10" : ""),
+ (date.getDate() % 3 === 0 ? "Divisble by 3" : "")];
}
-test('callbacks', function() {
+test("callbacks", function() {
expect( 13 );
// Before show
var dp, day20, day21,
- inp = TestHelpers.datepicker.init('#inp', {beforeShow: beforeAll}),
- inst = $.data(inp[0], 'datepicker');
- equal($.datepicker._get(inst, 'currentText'), 'Today', 'Before show - initial');
- inp.val('02/04/2008').datepicker('show');
- equal($.datepicker._get(inst, 'currentText'), 'Current', 'Before show - changed');
- ok(beforeShowThis.id === inp[0].id, 'Before show - this OK');
- ok(beforeShowInput.id === inp[0].id, 'Before show - input OK');
- deepEqual(beforeShowInst, inst, 'Before show - inst OK');
- inp.datepicker('hide').datepicker('destroy');
+ inp = TestHelpers.datepicker.init("#inp", {beforeShow: beforeAll}),
+ inst = $.data(inp[0], "datepicker");
+ equal($.datepicker._get(inst, "currentText"), "Today", "Before show - initial");
+ inp.val("02/04/2008").datepicker("show");
+ equal($.datepicker._get(inst, "currentText"), "Current", "Before show - changed");
+ ok(beforeShowThis.id === inp[0].id, "Before show - this OK");
+ ok(beforeShowInput.id === inp[0].id, "Before show - input OK");
+ deepEqual(beforeShowInst, inst, "Before show - inst OK");
+ inp.datepicker("hide").datepicker("destroy");
// Before show day
- inp = TestHelpers.datepicker.init('#inp', {beforeShowDay: beforeDay});
- dp = $('#ui-datepicker-div');
- inp.val('02/04/2008').datepicker('show');
- ok(beforeShowDayThis.id === inp[0].id, 'Before show day - this OK');
- ok(beforeShowDayOK, 'Before show day - dates OK');
- day20 = dp.find('.ui-datepicker-calendar td:contains("20")');
- day21 = dp.find('.ui-datepicker-calendar td:contains("21")');
- ok(!day20.is('.ui-datepicker-unselectable'), 'Before show day - unselectable 20');
- ok(day21.is('.ui-datepicker-unselectable'), 'Before show day - unselectable 21');
- ok(day20.is('.day10'), 'Before show day - CSS 20');
- ok(!day21.is('.day10'), 'Before show day - CSS 21');
- ok(!day20.attr('title'), 'Before show day - title 20');
- ok(day21.attr('title') === 'Divisble by 3', 'Before show day - title 21');
- inp.datepicker('hide').datepicker('destroy');
+ inp = TestHelpers.datepicker.init("#inp", {beforeShowDay: beforeDay});
+ dp = $("#ui-datepicker-div");
+ inp.val("02/04/2008").datepicker("show");
+ ok(beforeShowDayThis.id === inp[0].id, "Before show day - this OK");
+ ok(beforeShowDayOK, "Before show day - dates OK");
+ day20 = dp.find(".ui-datepicker-calendar td:contains('20')");
+ day21 = dp.find(".ui-datepicker-calendar td:contains('21')");
+ ok(!day20.is(".ui-datepicker-unselectable"), "Before show day - unselectable 20");
+ ok(day21.is(".ui-datepicker-unselectable"), "Before show day - unselectable 21");
+ ok(day20.is(".day10"), "Before show day - CSS 20");
+ ok(!day21.is(".day10"), "Before show day - CSS 21");
+ ok(!day20.attr("title"), "Before show day - title 20");
+ ok(day21.attr("title") === "Divisble by 3", "Before show day - title 21");
+ inp.datepicker("hide").datepicker("destroy");
});
-test('localisation', function() {
+test("localisation", function() {
expect( 24 );
var dp, month, day, date,
- inp = TestHelpers.datepicker.init('#inp', $.datepicker.regional.fr);
- inp.datepicker('option', {dateFormat: 'DD, d MM yy', showButtonPanel:true, changeMonth:true, changeYear:true}).val('').datepicker('show');
- dp = $('#ui-datepicker-div');
- equal($('.ui-datepicker-close', dp).text(), 'Fermer', 'Localisation - close');
- $('.ui-datepicker-close', dp).simulate('mouseover');
- equal($('.ui-datepicker-prev', dp).text(), 'Précédent', 'Localisation - previous');
- equal($('.ui-datepicker-current', dp).text(), 'Aujourd\'hui', 'Localisation - current');
- equal($('.ui-datepicker-next', dp).text(), 'Suivant', 'Localisation - next');
+ inp = TestHelpers.datepicker.init("#inp", $.datepicker.regional.fr);
+ inp.datepicker("option", {dateFormat: "DD, d MM yy", showButtonPanel:true, changeMonth:true, changeYear:true}).val("").datepicker("show");
+ dp = $("#ui-datepicker-div");
+ equal($(".ui-datepicker-close", dp).text(), "Fermer", "Localisation - close");
+ $(".ui-datepicker-close", dp).simulate("mouseover");
+ equal($(".ui-datepicker-prev", dp).text(), "Précédent", "Localisation - previous");
+ equal($(".ui-datepicker-current", dp).text(), "Aujourd'hui", "Localisation - current");
+ equal($(".ui-datepicker-next", dp).text(), "Suivant", "Localisation - next");
month = 0;
- $('.ui-datepicker-month option', dp).each(function() {
+ $(".ui-datepicker-month option", dp).each(function() {
equal($(this).text(), $.datepicker.regional.fr.monthNamesShort[month],
- 'Localisation - month ' + month);
+ "Localisation - month " + month);
month++;
});
day = 1;
- $('.ui-datepicker-calendar th', dp).each(function() {
+ $(".ui-datepicker-calendar th", dp).each(function() {
equal($(this).text(), $.datepicker.regional.fr.dayNamesMin[day],
- 'Localisation - day ' + day);
+ "Localisation - day " + day);
day = (day + 1) % 7;
});
- inp.simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
+ inp.simulate("keydown", {keyCode: $.ui.keyCode.ENTER});
date = new Date();
- equal(inp.val(), $.datepicker.regional.fr.dayNames[date.getDay()] + ', ' +
- date.getDate() + ' ' + $.datepicker.regional.fr.monthNames[date.getMonth()] +
- ' ' + date.getFullYear(), 'Localisation - formatting');
+ equal(inp.val(), $.datepicker.regional.fr.dayNames[date.getDay()] + ", " +
+ date.getDate() + " " + $.datepicker.regional.fr.monthNames[date.getMonth()] +
+ " " + date.getFullYear(), "Localisation - formatting");
});
-test('noWeekends', function() {
+test("noWeekends", function() {
expect( 31 );
var i, date;
for (i = 1; i <= 31; i++) {
date = new Date(2001, 1 - 1, i);
- deepEqual($.datepicker.noWeekends(date), [(i + 1) % 7 >= 2, ''],
- 'No weekends ' + date);
+ deepEqual($.datepicker.noWeekends(date), [(i + 1) % 7 >= 2, ""],
+ "No weekends " + date);
}
});
-test('iso8601Week', function() {
+test("iso8601Week", function() {
expect( 12 );
var date = new Date(2000, 12 - 1, 31);
- equal($.datepicker.iso8601Week(date), 52, 'ISO 8601 week ' + date);
+ equal($.datepicker.iso8601Week(date), 52, "ISO 8601 week " + date);
date = new Date(2001, 1 - 1, 1);
- equal($.datepicker.iso8601Week(date), 1, 'ISO 8601 week ' + date);
+ equal($.datepicker.iso8601Week(date), 1, "ISO 8601 week " + date);
date = new Date(2001, 1 - 1, 7);
- equal($.datepicker.iso8601Week(date), 1, 'ISO 8601 week ' + date);
+ equal($.datepicker.iso8601Week(date), 1, "ISO 8601 week " + date);
date = new Date(2001, 1 - 1, 8);
- equal($.datepicker.iso8601Week(date), 2, 'ISO 8601 week ' + date);
+ equal($.datepicker.iso8601Week(date), 2, "ISO 8601 week " + date);
date = new Date(2003, 12 - 1, 28);
- equal($.datepicker.iso8601Week(date), 52, 'ISO 8601 week ' + date);
+ equal($.datepicker.iso8601Week(date), 52, "ISO 8601 week " + date);
date = new Date(2003, 12 - 1, 29);
- equal($.datepicker.iso8601Week(date), 1, 'ISO 8601 week ' + date);
+ equal($.datepicker.iso8601Week(date), 1, "ISO 8601 week " + date);
date = new Date(2004, 1 - 1, 4);
- equal($.datepicker.iso8601Week(date), 1, 'ISO 8601 week ' + date);
+ equal($.datepicker.iso8601Week(date), 1, "ISO 8601 week " + date);
date = new Date(2004, 1 - 1, 5);
- equal($.datepicker.iso8601Week(date), 2, 'ISO 8601 week ' + date);
+ equal($.datepicker.iso8601Week(date), 2, "ISO 8601 week " + date);
date = new Date(2009, 12 - 1, 28);
- equal($.datepicker.iso8601Week(date), 53, 'ISO 8601 week ' + date);
+ equal($.datepicker.iso8601Week(date), 53, "ISO 8601 week " + date);
date = new Date(2010, 1 - 1, 3);
- equal($.datepicker.iso8601Week(date), 53, 'ISO 8601 week ' + date);
+ equal($.datepicker.iso8601Week(date), 53, "ISO 8601 week " + date);
date = new Date(2010, 1 - 1, 4);
- equal($.datepicker.iso8601Week(date), 1, 'ISO 8601 week ' + date);
+ equal($.datepicker.iso8601Week(date), 1, "ISO 8601 week " + date);
date = new Date(2010, 1 - 1, 10);
- equal($.datepicker.iso8601Week(date), 1, 'ISO 8601 week ' + date);
+ equal($.datepicker.iso8601Week(date), 1, "ISO 8601 week " + date);
});
-test('parseDate', function() {
+test("parseDate", function() {
expect( 26 );
- TestHelpers.datepicker.init('#inp');
+ TestHelpers.datepicker.init("#inp");
var currentYear, gmtDate, fr, settings, zh;
- ok($.datepicker.parseDate('d m y', '') == null, 'Parse date empty');
- TestHelpers.datepicker.equalsDate($.datepicker.parseDate('d m y', '3 2 01'),
- new Date(2001, 2 - 1, 3), 'Parse date d m y');
- TestHelpers.datepicker.equalsDate($.datepicker.parseDate('dd mm yy', '03 02 2001'),
- new Date(2001, 2 - 1, 3), 'Parse date dd mm yy');
- TestHelpers.datepicker.equalsDate($.datepicker.parseDate('d m y', '13 12 01'),
- new Date(2001, 12 - 1, 13), 'Parse date d m y');
- TestHelpers.datepicker.equalsDate($.datepicker.parseDate('dd mm yy', '13 12 2001'),
- new Date(2001, 12 - 1, 13), 'Parse date dd mm yy');
- TestHelpers.datepicker.equalsDate($.datepicker.parseDate('y-o', '01-34'),
- new Date(2001, 2 - 1, 3), 'Parse date y-o');
- TestHelpers.datepicker.equalsDate($.datepicker.parseDate('yy-oo', '2001-347'),
- new Date(2001, 12 - 1, 13), 'Parse date yy-oo');
- TestHelpers.datepicker.equalsDate($.datepicker.parseDate('oo yy', '348 2004'),
- new Date(2004, 12 - 1, 13), 'Parse date oo yy');
- TestHelpers.datepicker.equalsDate($.datepicker.parseDate('D d M y', 'Sat 3 Feb 01'),
- new Date(2001, 2 - 1, 3), 'Parse date D d M y');
- TestHelpers.datepicker.equalsDate($.datepicker.parseDate('d MM DD yy', '3 February Saturday 2001'),
- new Date(2001, 2 - 1, 3), 'Parse date dd MM DD yy');
- TestHelpers.datepicker.equalsDate($.datepicker.parseDate('DD, MM d, yy', 'Saturday, February 3, 2001'),
- new Date(2001, 2 - 1, 3), 'Parse date DD, MM d, yy');
- TestHelpers.datepicker.equalsDate($.datepicker.parseDate('\'day\' d \'of\' MM (\'\'DD\'\'), yy',
- 'day 3 of February (\'Saturday\'), 2001'), new Date(2001, 2 - 1, 3),
- 'Parse date \'day\' d \'of\' MM (\'\'DD\'\'), yy');
+ ok($.datepicker.parseDate("d m y", "") == null, "Parse date empty");
+ TestHelpers.datepicker.equalsDate($.datepicker.parseDate("d m y", "3 2 01"),
+ new Date(2001, 2 - 1, 3), "Parse date d m y");
+ TestHelpers.datepicker.equalsDate($.datepicker.parseDate("dd mm yy", "03 02 2001"),
+ new Date(2001, 2 - 1, 3), "Parse date dd mm yy");
+ TestHelpers.datepicker.equalsDate($.datepicker.parseDate("d m y", "13 12 01"),
+ new Date(2001, 12 - 1, 13), "Parse date d m y");
+ TestHelpers.datepicker.equalsDate($.datepicker.parseDate("dd mm yy", "13 12 2001"),
+ new Date(2001, 12 - 1, 13), "Parse date dd mm yy");
+ TestHelpers.datepicker.equalsDate($.datepicker.parseDate("y-o", "01-34"),
+ new Date(2001, 2 - 1, 3), "Parse date y-o");
+ TestHelpers.datepicker.equalsDate($.datepicker.parseDate("yy-oo", "2001-347"),
+ new Date(2001, 12 - 1, 13), "Parse date yy-oo");
+ TestHelpers.datepicker.equalsDate($.datepicker.parseDate("oo yy", "348 2004"),
+ new Date(2004, 12 - 1, 13), "Parse date oo yy");
+ TestHelpers.datepicker.equalsDate($.datepicker.parseDate("D d M y", "Sat 3 Feb 01"),
+ new Date(2001, 2 - 1, 3), "Parse date D d M y");
+ TestHelpers.datepicker.equalsDate($.datepicker.parseDate("d MM DD yy", "3 February Saturday 2001"),
+ new Date(2001, 2 - 1, 3), "Parse date dd MM DD yy");
+ TestHelpers.datepicker.equalsDate($.datepicker.parseDate("DD, MM d, yy", "Saturday, February 3, 2001"),
+ new Date(2001, 2 - 1, 3), "Parse date DD, MM d, yy");
+ TestHelpers.datepicker.equalsDate($.datepicker.parseDate("'day' d 'of' MM (''DD''), yy",
+ "day 3 of February ('Saturday'), 2001"), new Date(2001, 2 - 1, 3),
+ "Parse date 'day' d 'of' MM (''DD''), yy");
currentYear = new Date().getFullYear();
- TestHelpers.datepicker.equalsDate($.datepicker.parseDate('y-m-d', (currentYear - 2000) + '-02-03'),
- new Date(currentYear, 2 - 1, 3), 'Parse date y-m-d - default cutuff');
- TestHelpers.datepicker.equalsDate($.datepicker.parseDate('y-m-d', (currentYear - 2000 + 10) + '-02-03'),
- new Date(currentYear+10, 2 - 1, 3), 'Parse date y-m-d - default cutuff');
- TestHelpers.datepicker.equalsDate($.datepicker.parseDate('y-m-d', (currentYear - 2000 + 11) + '-02-03'),
- new Date(currentYear-89, 2 - 1, 3), 'Parse date y-m-d - default cutuff');
- TestHelpers.datepicker.equalsDate($.datepicker.parseDate('y-m-d', '80-02-03', {shortYearCutoff: 80}),
- new Date(2080, 2 - 1, 3), 'Parse date y-m-d - cutoff 80');
- TestHelpers.datepicker.equalsDate($.datepicker.parseDate('y-m-d', '81-02-03', {shortYearCutoff: 80}),
- new Date(1981, 2 - 1, 3), 'Parse date y-m-d - cutoff 80');
- TestHelpers.datepicker.equalsDate($.datepicker.parseDate('y-m-d', (currentYear - 2000 + 60) + '-02-03', {shortYearCutoff: '+60'}),
- new Date(currentYear + 60, 2 - 1, 3), 'Parse date y-m-d - cutoff +60');
- TestHelpers.datepicker.equalsDate($.datepicker.parseDate('y-m-d', (currentYear - 2000 + 61) + '-02-03', {shortYearCutoff: '+60'}),
- new Date(currentYear - 39, 2 - 1, 3), 'Parse date y-m-d - cutoff +60');
+ TestHelpers.datepicker.equalsDate($.datepicker.parseDate("y-m-d", (currentYear - 2000) + "-02-03"),
+ new Date(currentYear, 2 - 1, 3), "Parse date y-m-d - default cutuff");
+ TestHelpers.datepicker.equalsDate($.datepicker.parseDate("y-m-d", (currentYear - 2000 + 10) + "-02-03"),
+ new Date(currentYear+10, 2 - 1, 3), "Parse date y-m-d - default cutuff");
+ TestHelpers.datepicker.equalsDate($.datepicker.parseDate("y-m-d", (currentYear - 2000 + 11) + "-02-03"),
+ new Date(currentYear-89, 2 - 1, 3), "Parse date y-m-d - default cutuff");
+ TestHelpers.datepicker.equalsDate($.datepicker.parseDate("y-m-d", "80-02-03", {shortYearCutoff: 80}),
+ new Date(2080, 2 - 1, 3), "Parse date y-m-d - cutoff 80");
+ TestHelpers.datepicker.equalsDate($.datepicker.parseDate("y-m-d", "81-02-03", {shortYearCutoff: 80}),
+ new Date(1981, 2 - 1, 3), "Parse date y-m-d - cutoff 80");
+ TestHelpers.datepicker.equalsDate($.datepicker.parseDate("y-m-d", (currentYear - 2000 + 60) + "-02-03", {shortYearCutoff: "+60"}),
+ new Date(currentYear + 60, 2 - 1, 3), "Parse date y-m-d - cutoff +60");
+ TestHelpers.datepicker.equalsDate($.datepicker.parseDate("y-m-d", (currentYear - 2000 + 61) + "-02-03", {shortYearCutoff: "+60"}),
+ new Date(currentYear - 39, 2 - 1, 3), "Parse date y-m-d - cutoff +60");
gmtDate = new Date(2001, 2 - 1, 3);
gmtDate.setMinutes(gmtDate.getMinutes() - gmtDate.getTimezoneOffset());
- TestHelpers.datepicker.equalsDate($.datepicker.parseDate('@', '981158400000'), gmtDate, 'Parse date @');
- TestHelpers.datepicker.equalsDate($.datepicker.parseDate('!', '631167552000000000'), gmtDate, 'Parse date !');
+ TestHelpers.datepicker.equalsDate($.datepicker.parseDate("@", "981158400000"), gmtDate, "Parse date @");
+ TestHelpers.datepicker.equalsDate($.datepicker.parseDate("!", "631167552000000000"), gmtDate, "Parse date !");
fr = $.datepicker.regional.fr;
settings = {dayNamesShort: fr.dayNamesShort, dayNames: fr.dayNames,
monthNamesShort: fr.monthNamesShort, monthNames: fr.monthNames};
- TestHelpers.datepicker.equalsDate($.datepicker.parseDate('D d M y', 'Lun. 9 Avril 01', settings),
- new Date(2001, 4 - 1, 9), 'Parse date D M y with settings');
- TestHelpers.datepicker.equalsDate($.datepicker.parseDate('d MM DD yy', '9 Avril Lundi 2001', settings),
- new Date(2001, 4 - 1, 9), 'Parse date d MM DD yy with settings');
- TestHelpers.datepicker.equalsDate($.datepicker.parseDate('DD, MM d, yy', 'Lundi, Avril 9, 2001', settings),
- new Date(2001, 4 - 1, 9), 'Parse date DD, MM d, yy with settings');
+ TestHelpers.datepicker.equalsDate($.datepicker.parseDate("D d M y", "Lun. 9 Avril 01", settings),
+ new Date(2001, 4 - 1, 9), "Parse date D M y with settings");
+ TestHelpers.datepicker.equalsDate($.datepicker.parseDate("d MM DD yy", "9 Avril Lundi 2001", settings),
+ new Date(2001, 4 - 1, 9), "Parse date d MM DD yy with settings");
+ TestHelpers.datepicker.equalsDate($.datepicker.parseDate("DD, MM d, yy", "Lundi, Avril 9, 2001", settings),
+ new Date(2001, 4 - 1, 9), "Parse date DD, MM d, yy with settings");
TestHelpers.datepicker.equalsDate($.datepicker.parseDate("'jour' d 'de' MM (''DD''), yy", "jour 9 de Avril ('Lundi'), 2001", settings),
new Date(2001, 4 - 1, 9), "Parse date 'jour' d 'de' MM (''DD''), yy with settings");
- zh = $.datepicker.regional['zh-CN'];
- TestHelpers.datepicker.equalsDate($.datepicker.parseDate('yy M d', '2011 十一月 22', zh),
- new Date(2011, 11 - 1, 22), 'Parse date yy M d with zh-CN');
+ zh = $.datepicker.regional["zh-CN"];
+ TestHelpers.datepicker.equalsDate($.datepicker.parseDate("yy M d", "2011 十一月 22", zh),
+ new Date(2011, 11 - 1, 22), "Parse date yy M d with zh-CN");
});
-test('parseDateErrors', function() {
+test("parseDateErrors", function() {
expect( 17 );
- TestHelpers.datepicker.init('#inp');
+ TestHelpers.datepicker.init("#inp");
var fr, settings;
function expectError(expr, value, error) {
try {
expr();
- ok(false, 'Parsed error ' + value);
+ ok(false, "Parsed error " + value);
}
catch (e) {
- equal(e, error, 'Parsed error ' + value);
+ equal(e, error, "Parsed error " + value);
}
}
- expectError(function() { $.datepicker.parseDate(null, 'Sat 2 01'); },
- 'Sat 2 01', 'Invalid arguments');
- expectError(function() { $.datepicker.parseDate('d m y', null); },
- 'null', 'Invalid arguments');
- expectError(function() { $.datepicker.parseDate('d m y', 'Sat 2 01'); },
- 'Sat 2 01 - d m y', 'Missing number at position 0');
- expectError(function() { $.datepicker.parseDate('dd mm yy', 'Sat 2 01'); },
- 'Sat 2 01 - dd mm yy', 'Missing number at position 0');
- expectError(function() { $.datepicker.parseDate('d m y', '3 Feb 01'); },
- '3 Feb 01 - d m y', 'Missing number at position 2');
- expectError(function() { $.datepicker.parseDate('dd mm yy', '3 Feb 01'); },
- '3 Feb 01 - dd mm yy', 'Missing number at position 2');
- expectError(function() { $.datepicker.parseDate('d m y', '3 2 AD01'); },
- '3 2 AD01 - d m y', 'Missing number at position 4');
- expectError(function() { $.datepicker.parseDate('d m yy', '3 2 AD01'); },
- '3 2 AD01 - dd mm yy', 'Missing number at position 4');
- expectError(function() { $.datepicker.parseDate('y-o', '01-D01'); },
- '2001-D01 - y-o', 'Missing number at position 3');
- expectError(function() { $.datepicker.parseDate('yy-oo', '2001-D01'); },
- '2001-D01 - yy-oo', 'Missing number at position 5');
- expectError(function() { $.datepicker.parseDate('D d M y', 'D7 3 Feb 01'); },
- 'D7 3 Feb 01 - D d M y', 'Unknown name at position 0');
- expectError(function() { $.datepicker.parseDate('D d M y', 'Sat 3 M2 01'); },
- 'Sat 3 M2 01 - D d M y', 'Unknown name at position 6');
- expectError(function() { $.datepicker.parseDate('DD, MM d, yy', 'Saturday- Feb 3, 2001'); },
- 'Saturday- Feb 3, 2001 - DD, MM d, yy', 'Unexpected literal at position 8');
- expectError(function() { $.datepicker.parseDate('\'day\' d \'of\' MM (\'\'DD\'\'), yy',
- 'day 3 of February ("Saturday"), 2001'); },
- 'day 3 of Mon2 ("Day7"), 2001', 'Unexpected literal at position 19');
- expectError(function() { $.datepicker.parseDate('d m y', '29 2 01'); },
- '29 2 01 - d m y', 'Invalid date');
+ expectError(function() { $.datepicker.parseDate(null, "Sat 2 01"); },
+ "Sat 2 01", "Invalid arguments");
+ expectError(function() { $.datepicker.parseDate("d m y", null); },
+ "null", "Invalid arguments");
+ expectError(function() { $.datepicker.parseDate("d m y", "Sat 2 01"); },
+ "Sat 2 01 - d m y", "Missing number at position 0");
+ expectError(function() { $.datepicker.parseDate("dd mm yy", "Sat 2 01"); },
+ "Sat 2 01 - dd mm yy", "Missing number at position 0");
+ expectError(function() { $.datepicker.parseDate("d m y", "3 Feb 01"); },
+ "3 Feb 01 - d m y", "Missing number at position 2");
+ expectError(function() { $.datepicker.parseDate("dd mm yy", "3 Feb 01"); },
+ "3 Feb 01 - dd mm yy", "Missing number at position 2");
+ expectError(function() { $.datepicker.parseDate("d m y", "3 2 AD01"); },
+ "3 2 AD01 - d m y", "Missing number at position 4");
+ expectError(function() { $.datepicker.parseDate("d m yy", "3 2 AD01"); },
+ "3 2 AD01 - dd mm yy", "Missing number at position 4");
+ expectError(function() { $.datepicker.parseDate("y-o", "01-D01"); },
+ "2001-D01 - y-o", "Missing number at position 3");
+ expectError(function() { $.datepicker.parseDate("yy-oo", "2001-D01"); },
+ "2001-D01 - yy-oo", "Missing number at position 5");
+ expectError(function() { $.datepicker.parseDate("D d M y", "D7 3 Feb 01"); },
+ "D7 3 Feb 01 - D d M y", "Unknown name at position 0");
+ expectError(function() { $.datepicker.parseDate("D d M y", "Sat 3 M2 01"); },
+ "Sat 3 M2 01 - D d M y", "Unknown name at position 6");
+ expectError(function() { $.datepicker.parseDate("DD, MM d, yy", "Saturday- Feb 3, 2001"); },
+ "Saturday- Feb 3, 2001 - DD, MM d, yy", "Unexpected literal at position 8");
+ expectError(function() { $.datepicker.parseDate("'day' d 'of' MM (''DD''), yy",
+ "day 3 of February (\"Saturday\"), 2001"); },
+ "day 3 of Mon2 ('Day7'), 2001", "Unexpected literal at position 19");
+ expectError(function() { $.datepicker.parseDate("d m y", "29 2 01"); },
+ "29 2 01 - d m y", "Invalid date");
fr = $.datepicker.regional.fr;
settings = {dayNamesShort: fr.dayNamesShort, dayNames: fr.dayNames,
monthNamesShort: fr.monthNamesShort, monthNames: fr.monthNames};
- expectError(function() { $.datepicker.parseDate('D d M y', 'Mon 9 Avr 01', settings); },
- 'Mon 9 Avr 01 - D d M y', 'Unknown name at position 0');
- expectError(function() { $.datepicker.parseDate('D d M y', 'Lun. 9 Apr 01', settings); },
- 'Lun. 9 Apr 01 - D d M y', 'Unknown name at position 7');
+ expectError(function() { $.datepicker.parseDate("D d M y", "Mon 9 Avr 01", settings); },
+ "Mon 9 Avr 01 - D d M y", "Unknown name at position 0");
+ expectError(function() { $.datepicker.parseDate("D d M y", "Lun. 9 Apr 01", settings); },
+ "Lun. 9 Apr 01 - D d M y", "Unknown name at position 7");
});
-test('Ticket #7244: date parser does not fail when too many numbers are passed into the date function', function() {
+test("Ticket #7244: date parser does not fail when too many numbers are passed into the date function", function() {
expect( 4 );
var date;
try{
- date = $.datepicker.parseDate('dd/mm/yy', '18/04/19881');
+ date = $.datepicker.parseDate("dd/mm/yy", "18/04/19881");
ok(false, "Did not properly detect an invalid date");
}catch(e){
ok("invalid date detected");
}
try {
- date = $.datepicker.parseDate('dd/mm/yy', '18/04/1988 @ 2:43 pm');
+ date = $.datepicker.parseDate("dd/mm/yy", "18/04/1988 @ 2:43 pm");
equal(date.getDate(), 18);
equal(date.getMonth(), 3);
equal(date.getFullYear(), 1988);
@@ -972,87 +972,87 @@ test('Ticket #7244: date parser does not fail when too many numbers are passed i
}
});
-test('formatDate', function() {
+test("formatDate", function() {
expect( 16 );
- TestHelpers.datepicker.init('#inp');
+ TestHelpers.datepicker.init("#inp");
var gmtDate, fr, settings;
- equal($.datepicker.formatDate('d m y', new Date(2001, 2 - 1, 3)),
- '3 2 01', 'Format date d m y');
- equal($.datepicker.formatDate('dd mm yy', new Date(2001, 2 - 1, 3)),
- '03 02 2001', 'Format date dd mm yy');
- equal($.datepicker.formatDate('d m y', new Date(2001, 12 - 1, 13)),
- '13 12 01', 'Format date d m y');
- equal($.datepicker.formatDate('dd mm yy', new Date(2001, 12 - 1, 13)),
- '13 12 2001', 'Format date dd mm yy');
- equal($.datepicker.formatDate('yy-o', new Date(2001, 2 - 1, 3)),
- '2001-34', 'Format date yy-o');
- equal($.datepicker.formatDate('yy-oo', new Date(2001, 2 - 1, 3)),
- '2001-034', 'Format date yy-oo');
- equal($.datepicker.formatDate('D M y', new Date(2001, 2 - 1, 3)),
- 'Sat Feb 01', 'Format date D M y');
- equal($.datepicker.formatDate('DD MM yy', new Date(2001, 2 - 1, 3)),
- 'Saturday February 2001', 'Format date DD MM yy');
- equal($.datepicker.formatDate('DD, MM d, yy', new Date(2001, 2 - 1, 3)),
- 'Saturday, February 3, 2001', 'Format date DD, MM d, yy');
- equal($.datepicker.formatDate('\'day\' d \'of\' MM (\'\'DD\'\'), yy',
- new Date(2001, 2 - 1, 3)), 'day 3 of February (\'Saturday\'), 2001',
- 'Format date \'day\' d \'of\' MM (\'\'DD\'\'), yy');
+ equal($.datepicker.formatDate("d m y", new Date(2001, 2 - 1, 3)),
+ "3 2 01", "Format date d m y");
+ equal($.datepicker.formatDate("dd mm yy", new Date(2001, 2 - 1, 3)),
+ "03 02 2001", "Format date dd mm yy");
+ equal($.datepicker.formatDate("d m y", new Date(2001, 12 - 1, 13)),
+ "13 12 01", "Format date d m y");
+ equal($.datepicker.formatDate("dd mm yy", new Date(2001, 12 - 1, 13)),
+ "13 12 2001", "Format date dd mm yy");
+ equal($.datepicker.formatDate("yy-o", new Date(2001, 2 - 1, 3)),
+ "2001-34", "Format date yy-o");
+ equal($.datepicker.formatDate("yy-oo", new Date(2001, 2 - 1, 3)),
+ "2001-034", "Format date yy-oo");
+ equal($.datepicker.formatDate("D M y", new Date(2001, 2 - 1, 3)),
+ "Sat Feb 01", "Format date D M y");
+ equal($.datepicker.formatDate("DD MM yy", new Date(2001, 2 - 1, 3)),
+ "Saturday February 2001", "Format date DD MM yy");
+ equal($.datepicker.formatDate("DD, MM d, yy", new Date(2001, 2 - 1, 3)),
+ "Saturday, February 3, 2001", "Format date DD, MM d, yy");
+ equal($.datepicker.formatDate("'day' d 'of' MM (''DD''), yy",
+ new Date(2001, 2 - 1, 3)), "day 3 of February ('Saturday'), 2001",
+ "Format date 'day' d 'of' MM ('DD'), yy");
gmtDate = new Date(2001, 2 - 1, 3);
gmtDate.setMinutes(gmtDate.getMinutes() - gmtDate.getTimezoneOffset());
- equal($.datepicker.formatDate('@', gmtDate), '981158400000', 'Format date @');
- equal($.datepicker.formatDate('!', gmtDate), '631167552000000000', 'Format date !');
+ equal($.datepicker.formatDate("@", gmtDate), "981158400000", "Format date @");
+ equal($.datepicker.formatDate("!", gmtDate), "631167552000000000", "Format date !");
fr = $.datepicker.regional.fr;
settings = {dayNamesShort: fr.dayNamesShort, dayNames: fr.dayNames,
monthNamesShort: fr.monthNamesShort, monthNames: fr.monthNames};
- equal($.datepicker.formatDate('D M y', new Date(2001, 4 - 1, 9), settings),
- 'Lun. Avril 01', 'Format date D M y with settings');
- equal($.datepicker.formatDate('DD MM yy', new Date(2001, 4 - 1, 9), settings),
- 'Lundi Avril 2001', 'Format date DD MM yy with settings');
- equal($.datepicker.formatDate('DD, MM d, yy', new Date(2001, 4 - 1, 9), settings),
- 'Lundi, Avril 9, 2001', 'Format date DD, MM d, yy with settings');
- equal($.datepicker.formatDate('\'jour\' d \'de\' MM (\'\'DD\'\'), yy',
- new Date(2001, 4 - 1, 9), settings), 'jour 9 de Avril (\'Lundi\'), 2001',
- 'Format date \'jour\' d \'de\' MM (\'\'DD\'\'), yy with settings');
+ equal($.datepicker.formatDate("D M y", new Date(2001, 4 - 1, 9), settings),
+ "Lun. Avril 01", "Format date D M y with settings");
+ equal($.datepicker.formatDate("DD MM yy", new Date(2001, 4 - 1, 9), settings),
+ "Lundi Avril 2001", "Format date DD MM yy with settings");
+ equal($.datepicker.formatDate("DD, MM d, yy", new Date(2001, 4 - 1, 9), settings),
+ "Lundi, Avril 9, 2001", "Format date DD, MM d, yy with settings");
+ equal($.datepicker.formatDate("'jour' d 'de' MM (''DD''), yy",
+ new Date(2001, 4 - 1, 9), settings), "jour 9 de Avril ('Lundi'), 2001",
+ "Format date 'jour' d 'de' MM (''DD''), yy with settings");
});
-test('Ticket 6827: formatDate day of year calculation is wrong during day lights savings time', function(){
+test("Ticket 6827: formatDate day of year calculation is wrong during day lights savings time", function(){
expect( 1 );
var time = $.datepicker.formatDate("oo", new Date("2010/03/30 12:00:00 CDT"));
equal(time, "089");
});
-test('Ticket 7602: Stop datepicker from appearing with beforeShow event handler', function(){
+test("Ticket 7602: Stop datepicker from appearing with beforeShow event handler", function(){
expect( 3 );
- var inp = TestHelpers.datepicker.init('#inp',{
+ var inp = TestHelpers.datepicker.init("#inp",{
beforeShow: function(){
return false;
}
}),
- dp = $('#ui-datepicker-div');
- inp.datepicker('show');
- equal(dp.css('display'), 'none',"beforeShow returns false");
- inp.datepicker('destroy');
+ dp = $("#ui-datepicker-div");
+ inp.datepicker("show");
+ equal(dp.css("display"), "none","beforeShow returns false");
+ inp.datepicker("destroy");
- inp = TestHelpers.datepicker.init('#inp',{
+ inp = TestHelpers.datepicker.init("#inp",{
beforeShow: function(){
}
});
- dp = $('#ui-datepicker-div');
- inp.datepicker('show');
- equal(dp.css('display'), 'block',"beforeShow returns nothing");
- inp.datepicker('hide');
- inp.datepicker('destroy');
+ dp = $("#ui-datepicker-div");
+ inp.datepicker("show");
+ equal(dp.css("display"), "block","beforeShow returns nothing");
+ inp.datepicker("hide");
+ inp.datepicker("destroy");
- inp = TestHelpers.datepicker.init('#inp',{
+ inp = TestHelpers.datepicker.init("#inp",{
beforeShow: function(){
return true;
}
});
- dp = $('#ui-datepicker-div');
- inp.datepicker('show');
- equal(dp.css('display'), 'block',"beforeShow returns true");
- inp.datepicker('hide');
- inp.datepicker('destroy');
+ dp = $("#ui-datepicker-div");
+ inp.datepicker("show");
+ equal(dp.css("display"), "block","beforeShow returns true");
+ inp.datepicker("hide");
+ inp.datepicker("destroy");
});
})(jQuery);
diff --git a/tests/unit/datepicker/datepicker_test_helpers.js b/tests/unit/datepicker/datepicker_test_helpers.js
index 2d374f561..a9605edff 100644
--- a/tests/unit/datepicker/datepicker_test_helpers.js
+++ b/tests/unit/datepicker/datepicker_test_helpers.js
@@ -7,7 +7,7 @@ TestHelpers.datepicker = {
},
equalsDate: function(d1, d2, message) {
if (!d1 || !d2) {
- ok(false, message + ' - missing date');
+ ok(false, message + " - missing date");
return;
}
d1 = new Date(d1.getFullYear(), d1.getMonth(), d1.getDate());
@@ -15,8 +15,8 @@ TestHelpers.datepicker = {
equal(d1.toString(), d2.toString(), message);
},
init: function(id, options) {
- $.datepicker.setDefaults($.datepicker.regional['']);
- return $(id).datepicker($.extend({showAnim: ''}, options || {}));
+ $.datepicker.setDefaults($.datepicker.regional[""]);
+ return $(id).datepicker($.extend({showAnim: ""}, options || {}));
},
- PROP_NAME: 'datepicker'
+ PROP_NAME: "datepicker"
};
\ No newline at end of file
diff --git a/tests/unit/dialog/dialog_common.js b/tests/unit/dialog/dialog_common.js
index 57d7aa0aa..ea4c91767 100644
--- a/tests/unit/dialog/dialog_common.js
+++ b/tests/unit/dialog/dialog_common.js
@@ -4,11 +4,11 @@ TestHelpers.commonWidgetTests( "dialog", {
autoOpen: true,
buttons: [],
closeOnEscape: true,
- closeText: 'close',
+ closeText: "close",
disabled: false,
- dialogClass: '',
+ dialogClass: "",
draggable: true,
- height: 'auto',
+ height: "auto",
hide: null,
maxHeight: null,
maxWidth: null,
@@ -16,10 +16,10 @@ TestHelpers.commonWidgetTests( "dialog", {
minWidth: 150,
modal: false,
position: {
- my: 'center',
- at: 'center',
+ my: "center",
+ at: "center",
of: window,
- collision: 'fit',
+ collision: "fit",
using: $.ui.dialog.prototype.options.position.using
},
resizable: true,
diff --git a/tests/unit/dialog/dialog_core.js b/tests/unit/dialog/dialog_core.js
index 817f76ea9..b488bd112 100644
--- a/tests/unit/dialog/dialog_core.js
+++ b/tests/unit/dialog/dialog_core.js
@@ -10,10 +10,10 @@ test("title id", function() {
expect(1);
var titleId,
- el = $('
').dialog();
+ el = $("
").dialog();
- titleId = el.dialog('widget').find('.ui-dialog-title').attr('id');
- ok( /ui-id-\d+$/.test( titleId ), 'auto-numbered title id');
+ titleId = el.dialog("widget").find(".ui-dialog-title").attr("id");
+ ok( /ui-id-\d+$/.test( titleId ), "auto-numbered title id");
el.remove();
});
@@ -27,7 +27,7 @@ test( "ARIA", function() {
equal( wrapper.attr( "aria-describedby" ), el.attr( "id" ), "aria-describedby added" );
el.remove();
- el = $( '
' ).dialog();
+ el = $("
").dialog();
strictEqual( el.dialog( "widget" ).attr( "aria-describedby" ), undefined, "no aria-describedby added, as already present in markup" );
el.remove();
});
diff --git a/tests/unit/dialog/dialog_deprecated.js b/tests/unit/dialog/dialog_deprecated.js
index 918190791..57f360544 100644
--- a/tests/unit/dialog/dialog_deprecated.js
+++ b/tests/unit/dialog/dialog_deprecated.js
@@ -34,8 +34,8 @@ test( "position, right bottom on window", function() {
test("position, offset from top left w/array", function() {
expect( 2 );
- var el = $('
').dialog({ position: [10, 10] }),
- dialog = el.dialog('widget'),
+ var el = $("
").dialog({ position: [10, 10] }),
+ dialog = el.dialog("widget"),
offset = dialog.offset();
closeEnough(offset.left, 10 + $(window).scrollLeft(), 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() {
expect( 2 );
- var el = $('
').dialog({ position: "top" }),
- dialog = el.dialog('widget'),
+ var el = $("
").dialog({ position: "top" }),
+ dialog = el.dialog("widget"),
offset = dialog.offset();
closeEnough(offset.left, Math.round($(window).width() / 2 - dialog.outerWidth() / 2) + $(window).scrollLeft(), 1);
closeEnough(offset.top, $(window).scrollTop(), 1);
@@ -54,8 +54,8 @@ test("position, top on window", function() {
test("position, left on window", function() {
expect( 2 );
- var el = $('
').dialog({ position: "left" }),
- dialog = el.dialog('widget'),
+ var el = $("
").dialog({ position: "left" }),
+ dialog = el.dialog("widget"),
offset = dialog.offset();
closeEnough(offset.left, 0, 1);
closeEnough(offset.top, Math.round($(window).height() / 2 - dialog.outerHeight() / 2) + $(window).scrollTop(), 1);
diff --git a/tests/unit/dialog/dialog_events.js b/tests/unit/dialog/dialog_events.js
index 19337ad5d..254158ef4 100644
--- a/tests/unit/dialog/dialog_events.js
+++ b/tests/unit/dialog/dialog_events.js
@@ -12,10 +12,10 @@ test("open", function() {
el.dialog({
open: function(ev, ui) {
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(ev.type, 'dialogopen', 'event type in callback');
- deepEqual(ui, {}, 'ui hash in callback');
+ equal(ev.type, "dialogopen", "event type in callback");
+ deepEqual(ui, {}, "ui hash in callback");
}
});
el.remove();
@@ -24,16 +24,16 @@ test("open", function() {
el.dialog({
autoOpen: false,
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(ev.type, 'dialogopen', 'event type in callback');
- deepEqual(ui, {}, 'ui hash in callback');
+ equal(ev.type, "dialogopen", "event type 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(true, 'dialog("open") fires open event');
- equal(this, el[0], 'context of event');
- deepEqual(ui, {}, 'ui hash in event');
+ ok(true, "dialog('open') fires open event");
+ equal(this, el[0], "context of event");
+ deepEqual(ui, {}, "ui hash in event");
});
el.dialog("open");
el.remove();
@@ -88,22 +88,22 @@ test("dragStart", function() {
expect(9);
var handle,
- el = $('
').dialog({
+ el = $("
").dialog({
dragStart: function(ev, ui) {
- ok(true, 'dragging fires dragStart callback');
+ ok(true, "dragging fires dragStart 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.offset !== undefined, "ui.offset in callback");
}
- }).bind('dialogdragstart', function(ev, ui) {
- ok(true, 'dragging fires dialogdragstart event');
- equal(this, el[0], 'context of event');
+ }).bind("dialogdragstart", function(ev, ui) {
+ ok(true, "dragging fires dialogdragstart event");
+ equal(this, el[0], "context of event");
ok(ui.position !== undefined, "ui.position 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);
el.remove();
});
@@ -112,26 +112,26 @@ test("drag", function() {
expect(9);
var handle,
hasDragged = false,
- el = $('
').dialog({
+ el = $("
").dialog({
drag: function(ev, ui) {
if (!hasDragged) {
- ok(true, 'dragging fires drag callback');
+ ok(true, "dragging fires drag 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.offset !== undefined, "ui.offset in callback");
hasDragged = true;
}
}
- }).one('dialogdrag', function(ev, ui) {
- ok(true, 'dragging fires dialogdrag event');
- equal(this, el[0], 'context of event');
+ }).one("dialogdrag", function(ev, ui) {
+ ok(true, "dragging fires dialogdrag event");
+ equal(this, el[0], "context of event");
ok(ui.position !== undefined, "ui.position 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);
el.remove();
});
@@ -140,22 +140,22 @@ test("dragStop", function() {
expect(9);
var handle,
- el = $('
').dialog({
+ el = $("
").dialog({
dragStop: function(ev, ui) {
- ok(true, 'dragging fires dragStop callback');
+ ok(true, "dragging fires dragStop 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.offset !== undefined, "ui.offset in callback");
}
- }).bind('dialogdragstop', function(ev, ui) {
- ok(true, 'dragging fires dialogdragstop event');
- equal(this, el[0], 'context of event');
+ }).bind("dialogdragstop", function(ev, ui) {
+ ok(true, "dragging fires dialogdragstop event");
+ equal(this, el[0], "context of event");
ok(ui.position !== undefined, "ui.position 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);
el.remove();
});
@@ -164,26 +164,26 @@ test("resizeStart", function() {
expect(13);
var handle,
- el = $('
').dialog({
+ el = $("
").dialog({
resizeStart: function(ev, ui) {
- ok(true, 'resizing fires resizeStart callback');
+ ok(true, "resizing fires resizeStart 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.originalSize !== undefined, "ui.originalSize in callback");
ok(ui.position !== undefined, "ui.position in callback");
ok(ui.size !== undefined, "ui.size in callback");
}
- }).bind('dialogresizestart', function(ev, ui) {
- ok(true, 'resizing fires dialogresizestart event');
- equal(this, el[0], 'context of event');
+ }).bind("dialogresizestart", function(ev, ui) {
+ ok(true, "resizing fires dialogresizestart event");
+ equal(this, el[0], "context of event");
ok(ui.originalPosition !== undefined, "ui.originalPosition in callback");
ok(ui.originalSize !== undefined, "ui.originalSize in callback");
ok(ui.position !== undefined, "ui.position 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);
el.remove();
});
@@ -192,12 +192,12 @@ test("resize", function() {
expect(13);
var handle,
hasResized = false,
- el = $('
').dialog({
+ el = $("
").dialog({
resize: function(ev, ui) {
if (!hasResized) {
- ok(true, 'resizing fires resize callback');
+ ok(true, "resizing fires resize 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.originalSize !== undefined, "ui.originalSize in callback");
ok(ui.position !== undefined, "ui.position in callback");
@@ -206,16 +206,16 @@ test("resize", function() {
hasResized = true;
}
}
- }).one('dialogresize', function(ev, ui) {
- ok(true, 'resizing fires dialogresize event');
- equal(this, el[0], 'context of event');
+ }).one("dialogresize", function(ev, ui) {
+ ok(true, "resizing fires dialogresize event");
+ equal(this, el[0], "context of event");
ok(ui.originalPosition !== undefined, "ui.originalPosition in callback");
ok(ui.originalSize !== undefined, "ui.originalSize in callback");
ok(ui.position !== undefined, "ui.position 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);
el.remove();
});
@@ -224,26 +224,26 @@ test("resizeStop", function() {
expect(13);
var handle,
- el = $('
').dialog({
+ el = $("
").dialog({
resizeStop: function(ev, ui) {
- ok(true, 'resizing fires resizeStop callback');
+ ok(true, "resizing fires resizeStop 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.originalSize !== undefined, "ui.originalSize in callback");
ok(ui.position !== undefined, "ui.position in callback");
ok(ui.size !== undefined, "ui.size in callback");
}
- }).bind('dialogresizestop', function(ev, ui) {
- ok(true, 'resizing fires dialogresizestop event');
- equal(this, el[0], 'context of event');
+ }).bind("dialogresizestop", function(ev, ui) {
+ ok(true, "resizing fires dialogresizestop event");
+ equal(this, el[0], "context of event");
ok(ui.originalPosition !== undefined, "ui.originalPosition in callback");
ok(ui.originalSize !== undefined, "ui.originalSize in callback");
ok(ui.position !== undefined, "ui.position 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);
el.remove();
});
@@ -251,77 +251,77 @@ test("resizeStop", function() {
asyncTest("close", function() {
expect(14);
- var el = $('
').dialog({
+ var el = $("
").dialog({
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(ev.type, 'dialogclose', 'event type in callback');
- deepEqual(ui, {}, 'ui hash in callback');
+ equal(ev.type, "dialogclose", "event type in callback");
+ deepEqual(ui, {}, "ui hash in callback");
}
- }).bind('dialogclose', function(ev, ui) {
- ok(true, '.dialog("close") fires dialogclose event');
- equal(this, el[0], 'context of event');
- deepEqual(ui, {}, 'ui hash in event');
+ }).bind("dialogclose", function(ev, ui) {
+ ok(true, ".dialog('close') fires dialogclose event");
+ equal(this, el[0], "context of event");
+ deepEqual(ui, {}, "ui hash in event");
});
- el.dialog('close');
+ el.dialog("close");
el.remove();
// Close event with an effect
- el = $('
').dialog({
+ el = $("
").dialog({
hide: 10,
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(ev.type, 'dialogclose', 'event type in callback');
- deepEqual(ui, {}, 'ui hash in callback');
+ equal(ev.type, "dialogclose", "event type in callback");
+ deepEqual(ui, {}, "ui hash in callback");
start();
}
- }).bind('dialogclose', function(ev, ui) {
- ok(true, '.dialog("close") fires dialogclose event');
- equal(this, el[0], 'context of event');
- deepEqual(ui, {}, 'ui hash in event');
+ }).bind("dialogclose", function(ev, ui) {
+ ok(true, ".dialog('close') fires dialogclose event");
+ equal(this, el[0], "context of event");
+ deepEqual(ui, {}, "ui hash in event");
});
- el.dialog('close');
+ el.dialog("close");
});
test("beforeClose", function() {
expect(14);
- var el = $('
').dialog({
+ var el = $("
").dialog({
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(ev.type, 'dialogbeforeclose', 'event type in callback');
- deepEqual(ui, {}, 'ui hash in callback');
+ equal(ev.type, "dialogbeforeclose", "event type in callback");
+ deepEqual(ui, {}, "ui hash in callback");
return false;
}
});
- el.dialog('close');
- ok( el.dialog("widget").is(":visible"), 'beforeClose callback should prevent dialog from closing');
+ el.dialog("close");
+ ok( el.dialog("widget").is(":visible"), "beforeClose callback should prevent dialog from closing");
el.remove();
- el = $('
').dialog();
- el.dialog('option', 'beforeClose', function(ev, ui) {
- ok(true, '.dialog("close") fires beforeClose callback');
+ el = $("
").dialog();
+ el.dialog("option", "beforeClose", function(ev, ui) {
+ ok(true, ".dialog('close') fires beforeClose callback");
equal(this, el[0], "context of callback");
- equal(ev.type, 'dialogbeforeclose', 'event type in callback');
- deepEqual(ui, {}, 'ui hash in callback');
+ equal(ev.type, "dialogbeforeclose", "event type in callback");
+ deepEqual(ui, {}, "ui hash in callback");
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 = $('
').dialog().bind('dialogbeforeclose', function(ev, ui) {
- ok(true, '.dialog("close") triggers dialogbeforeclose event');
+ el = $("
").dialog().bind("dialogbeforeclose", function(ev, ui) {
+ ok(true, ".dialog('close') triggers dialogbeforeclose event");
equal(this, el[0], "context of event");
- deepEqual(ui, {}, 'ui hash in event');
+ deepEqual(ui, {}, "ui hash in event");
return false;
});
- el.dialog('close');
- ok( el.dialog("widget").is(":visible"), 'dialogbeforeclose event should prevent dialog from closing');
+ el.dialog("close");
+ ok( el.dialog("widget").is(":visible"), "dialogbeforeclose event should prevent dialog from closing");
el.remove();
});
@@ -329,14 +329,14 @@ test("beforeClose", function() {
asyncTest("ensure dialog's container doesn't scroll on resize and focus", function() {
expect(2);
- var el = $('#dialog1').dialog(),
+ var el = $("#dialog1").dialog(),
initialScroll = $(window).scrollTop();
- el.dialog('option', 'height', 600);
+ el.dialog("option", "height", 600);
equal($(window).scrollTop(), initialScroll, "scroll hasn't moved after height change");
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");
- el.dialog('destroy');
+ el.dialog("destroy");
start();
}, 500);
});
diff --git a/tests/unit/dialog/dialog_methods.js b/tests/unit/dialog/dialog_methods.js
index 85d13d157..b4c58c31e 100644
--- a/tests/unit/dialog/dialog_methods.js
+++ b/tests/unit/dialog/dialog_methods.js
@@ -12,25 +12,25 @@ module("dialog: methods", {
test("init", function() {
expect(6);
- $("
").appendTo('body').dialog().remove();
- ok(true, '.dialog() called on element');
+ $("
").appendTo("body").dialog().remove();
+ ok(true, ".dialog() called on element");
$([]).dialog().remove();
- ok(true, '.dialog() called on empty collection');
+ ok(true, ".dialog() called on empty collection");
- $('
').dialog().remove();
- ok(true, '.dialog() called on disconnected DOMElement - never connected');
+ $("
").dialog().remove();
+ ok(true, ".dialog() called on disconnected DOMElement - never connected");
- $('
').appendTo('body').remove().dialog().remove();
- ok(true, '.dialog() called on disconnected DOMElement - removed');
+ $("
").appendTo("body").remove().dialog().remove();
+ ok(true, ".dialog() called on disconnected DOMElement - removed");
- var el = $('
').dialog();
+ var el = $("
").dialog();
el.dialog("option", "foo");
el.remove();
- ok(true, 'arbitrary option getter after init');
+ ok(true, "arbitrary option getter after init");
- $('
').dialog().dialog("option", "foo", "bar").remove();
- ok(true, 'arbitrary option setter after init');
+ $("
").dialog().dialog("option", "foo", "bar").remove();
+ ok(true, "arbitrary option setter after init");
});
test("destroy", function() {
@@ -61,12 +61,12 @@ test("destroy", function() {
test("#4980: Destroy should place element back in original DOM position", function(){
expect( 2 );
- var container = $('
'),
- modal = container.find('#modal');
+ var container = $("
"),
+ modal = container.find("#modal");
modal.dialog();
- ok(!$.contains(container[0], modal[0]), 'dialog should move modal element to outside container element');
- 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 should move modal element to outside container element");
+ modal.dialog("destroy");
+ ok($.contains(container[0], modal[0]), "dialog(destroy) should place element back in original DOM position");
});
test( "enable/disable disabled", function() {
@@ -81,29 +81,29 @@ test("close", function() {
expect( 3 );
var el,
- expected = $('
').dialog(),
- actual = expected.dialog('close');
- equal(actual, expected, 'close is chainable');
+ expected = $("
").dialog(),
+ actual = expected.dialog("close");
+ equal(actual, expected, "close is chainable");
- el = $('
').dialog();
- ok(el.dialog('widget').is(':visible') && !el.dialog('widget').is(':hidden'), 'dialog visible before close method called');
- el.dialog('close');
- ok(el.dialog('widget').is(':hidden') && !el.dialog('widget').is(':visible'), 'dialog hidden after close method called');
+ el = $("
").dialog();
+ ok(el.dialog("widget").is(":visible") && !el.dialog("widget").is(":hidden"), "dialog visible before close method called");
+ el.dialog("close");
+ ok(el.dialog("widget").is(":hidden") && !el.dialog("widget").is(":visible"), "dialog hidden after close method called");
});
test("isOpen", function() {
expect(4);
- var el = $('
').dialog();
- equal(el.dialog('isOpen'), true, "dialog is open after init");
- el.dialog('close');
- equal(el.dialog('isOpen'), false, "dialog is closed");
+ var el = $("
").dialog();
+ equal(el.dialog("isOpen"), true, "dialog is open after init");
+ el.dialog("close");
+ equal(el.dialog("isOpen"), false, "dialog is closed");
el.remove();
- el = $('
').dialog({autoOpen: false});
- equal(el.dialog('isOpen'), false, "dialog is closed after init");
- el.dialog('open');
- equal(el.dialog('isOpen'), true, "dialog is open");
+ el = $("
").dialog({autoOpen: false});
+ equal(el.dialog("isOpen"), false, "dialog is closed after init");
+ el.dialog("open");
+ equal(el.dialog("isOpen"), true, "dialog is open");
el.remove();
});
@@ -137,49 +137,49 @@ test("moveToTop", function() {
test("open", function() {
expect( 3 );
var el,
- expected = $('
').dialog(),
- actual = expected.dialog('open');
- equal(actual, expected, 'open is chainable');
+ expected = $("
").dialog(),
+ actual = expected.dialog("open");
+ equal(actual, expected, "open is chainable");
- el = $('
').dialog({ autoOpen: false });
- ok(el.dialog('widget').is(':hidden') && !el.dialog('widget').is(':visible'), 'dialog hidden before open method called');
- el.dialog('open');
- ok(el.dialog('widget').is(':visible') && !el.dialog('widget').is(':hidden'), 'dialog visible after open method called');
+ el = $("
").dialog({ autoOpen: false });
+ ok(el.dialog("widget").is(":hidden") && !el.dialog("widget").is(":visible"), "dialog hidden before open method called");
+ el.dialog("open");
+ 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() {
expect(2);
- var d1 = $('
').appendTo( "body" ).dialog({autoOpen: false});
+ var d1 = $("
").appendTo( "body" ).dialog({autoOpen: false});
- d1.find('#b').prop( "checked", true );
- equal(d1.find('input:checked').val(), 'b', "checkbox b is checked");
+ d1.find("#b").prop( "checked", true );
+ equal(d1.find("input:checked").val(), "b", "checkbox b is checked");
- d1.dialog('open');
- equal(d1.find('input:checked').val(), 'b', "checkbox b is checked");
+ d1.dialog("open");
+ equal(d1.find("input:checked").val(), "b", "checkbox b is checked");
d1.remove();
});
test("#5531: dialog width should be at least minWidth on creation", function () {
expect( 4 );
- var el = $('
').dialog({
+ var el = $("
").dialog({
width: 200,
minWidth: 300
});
- equal(el.dialog('option', 'width'), 300, "width is minWidth");
- el.dialog('option', 'width', 200);
- equal(el.dialog('option', 'width'), 300, "width unchanged when set to < minWidth");
- el.dialog('option', 'width', 320);
- equal(el.dialog('option', 'width'), 320, "width changed if set to > minWidth");
+ equal(el.dialog("option", "width"), 300, "width is minWidth");
+ el.dialog("option", "width", 200);
+ equal(el.dialog("option", "width"), 300, "width unchanged when set to < minWidth");
+ el.dialog("option", "width", 320);
+ equal(el.dialog("option", "width"), 320, "width changed if set to > minWidth");
el.remove();
- el = $('
').dialog({
+ el = $("
").dialog({
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();
});
diff --git a/tests/unit/dialog/dialog_options.js b/tests/unit/dialog/dialog_options.js
index dff3ffaae..a20480de6 100644
--- a/tests/unit/dialog/dialog_options.js
+++ b/tests/unit/dialog/dialog_options.js
@@ -49,12 +49,12 @@ test( "appendTo", function() {
test("autoOpen", function() {
expect(2);
- var el = $('
').dialog({ autoOpen: false });
- ok( !el.dialog("widget").is(":visible"), '.dialog({ autoOpen: false })');
+ var el = $("
").dialog({ autoOpen: false });
+ ok( !el.dialog("widget").is(":visible"), ".dialog({ autoOpen: false })");
el.remove();
- el = $('
').dialog({ autoOpen: true });
- ok( el.dialog("widget").is(":visible"), '.dialog({ autoOpen: true })');
+ el = $("
").dialog({ autoOpen: true });
+ ok( el.dialog("widget").is(":visible"), ".dialog({ autoOpen: true })");
el.remove();
});
@@ -74,7 +74,7 @@ test("buttons", function() {
equal(ev.target, btn[1], "event target");
}
},
- el = $('
').dialog({ buttons: buttons });
+ el = $("
").dialog({ buttons: buttons });
btn = el.dialog( "widget" ).find( ".ui-dialog-buttonpane button" );
equal(btn.length, 2, "number of buttons");
@@ -85,8 +85,8 @@ test("buttons", function() {
i++;
});
- 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(btn.parent().hasClass("ui-dialog-buttonset"), "buttons in container");
+ ok(el.parent().hasClass("ui-dialog-buttons"), "dialog wrapper adds class about having buttons");
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);
- 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" );
equal(btn.length, 1, "number of buttons after setter");
- btn.trigger('click');
+ btn.trigger("click");
i = 0;
$.each(newButtons, function( key ) {
@@ -116,7 +116,7 @@ test("buttons", function() {
btn = el.dialog( "widget" ).find( ".ui-dialog-buttonpane button" );
equal(btn.length, 0, "all buttons have 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();
});
@@ -156,77 +156,77 @@ test("buttons - advanced", function() {
test("closeOnEscape", function() {
expect( 6 );
- var el = $('
').dialog({ closeOnEscape: false });
- ok(true, 'closeOnEscape: false');
- ok(el.dialog('widget').is(':visible') && !el.dialog('widget').is(':hidden'), 'dialog is open before ESC');
- el.simulate('keydown', { keyCode: $.ui.keyCode.ESCAPE })
- .simulate('keypress', { 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');
+ var el = $("
").dialog({ closeOnEscape: false });
+ ok(true, "closeOnEscape: false");
+ ok(el.dialog("widget").is(":visible") && !el.dialog("widget").is(":hidden"), "dialog is open before ESC");
+ el.simulate("keydown", { keyCode: $.ui.keyCode.ESCAPE })
+ .simulate("keypress", { 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");
el.remove();
- el = $('
').dialog({ closeOnEscape: true });
- ok(true, 'closeOnEscape: true');
- ok(el.dialog('widget').is(':visible') && !el.dialog('widget').is(':hidden'), 'dialog is open before ESC');
- el.simulate('keydown', { keyCode: $.ui.keyCode.ESCAPE })
- .simulate('keypress', { 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');
+ el = $("
").dialog({ closeOnEscape: true });
+ ok(true, "closeOnEscape: true");
+ ok(el.dialog("widget").is(":visible") && !el.dialog("widget").is(":hidden"), "dialog is open before ESC");
+ el.simulate("keydown", { keyCode: $.ui.keyCode.ESCAPE })
+ .simulate("keypress", { 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");
});
test("closeText", function() {
expect(3);
- var el = $('
').dialog();
- equal(el.dialog('widget').find('.ui-dialog-titlebar-close span').text(), 'close',
- 'default close text');
+ var el = $("
").dialog();
+ equal(el.dialog("widget").find(".ui-dialog-titlebar-close span").text(), "close",
+ "default close text");
el.remove();
- el = $('
').dialog({ closeText: "foo" });
- equal(el.dialog('widget').find('.ui-dialog-titlebar-close span').text(), 'foo',
- 'closeText on init');
+ el = $("
").dialog({ closeText: "foo" });
+ equal(el.dialog("widget").find(".ui-dialog-titlebar-close span").text(), "foo",
+ "closeText on init");
el.remove();
- el = $('
').dialog().dialog('option', 'closeText', 'bar');
- equal(el.dialog('widget').find('.ui-dialog-titlebar-close span').text(), 'bar',
- 'closeText via option method');
+ el = $("
").dialog().dialog("option", "closeText", "bar");
+ equal(el.dialog("widget").find(".ui-dialog-titlebar-close span").text(), "bar",
+ "closeText via option method");
el.remove();
});
test("dialogClass", function() {
expect( 6 );
- var el = $('
').dialog();
- equal(el.dialog('widget').is(".foo"), false, 'dialogClass not specified. foo class added');
+ var el = $("
").dialog();
+ equal(el.dialog("widget").is(".foo"), false, "dialogClass not specified. foo class added");
el.remove();
- el = $('
').dialog({ dialogClass: "foo" });
- equal(el.dialog('widget').is(".foo"), true, 'dialogClass in init. foo class added');
+ el = $("
").dialog({ dialogClass: "foo" });
+ equal(el.dialog("widget").is(".foo"), true, "dialogClass in init. foo class added");
el.dialog( "option", "dialogClass", "foobar" );
- 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(".foo"), false, "dialogClass changed, previous one was removed" );
+ equal( el.dialog("widget").is(".foobar"), true, "dialogClass changed, new one was added" );
el.remove();
- el = $('
').dialog({ dialogClass: "foo bar" });
- 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');
+ el = $("
").dialog({ dialogClass: "foo bar" });
+ 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");
el.remove();
});
test("draggable", function() {
expect(4);
- var el = $('
').dialog({ draggable: false });
+ var el = $("
").dialog({ draggable: false });
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);
el.remove();
- el = $('
').dialog({ draggable: true });
+ el = $("
").dialog({ draggable: true });
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);
el.remove();
});
@@ -234,22 +234,22 @@ test("draggable", function() {
test("height", function() {
expect(4);
- var el = $('
').dialog();
- equal(el.dialog('widget').outerHeight(), 150, "default height");
+ var el = $("
").dialog();
+ equal(el.dialog("widget").outerHeight(), 150, "default height");
el.remove();
- el = $('
').dialog({ height: 237 });
- equal(el.dialog('widget').outerHeight(), 237, "explicit height");
+ el = $("
").dialog({ height: 237 });
+ equal(el.dialog("widget").outerHeight(), 237, "explicit height");
el.remove();
- el = $('
').dialog();
- el.dialog('option', 'height', 238);
- equal(el.dialog('widget').outerHeight(), 238, "explicit height set after init");
+ el = $("
").dialog();
+ el.dialog("option", "height", 238);
+ equal(el.dialog("widget").outerHeight(), 238, "explicit height set after init");
el.remove();
- el = $('
').css("padding", "20px")
+ el = $("
").css("padding", "20px")
.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();
});
@@ -265,76 +265,76 @@ asyncTest( "hide, #5860 - don't leave effects wrapper behind", function() {
test("maxHeight", function() {
expect(3);
- var el = $('
').dialog({ maxHeight: 200 });
- TestHelpers.dialog.drag(el, '.ui-resizable-s', 1000, 1000);
- closeEnough(el.dialog('widget').height(), 200, 1, "maxHeight");
+ var el = $("
").dialog({ maxHeight: 200 });
+ TestHelpers.dialog.drag(el, ".ui-resizable-s", 1000, 1000);
+ closeEnough(el.dialog("widget").height(), 200, 1, "maxHeight");
el.remove();
- el = $('
').dialog({ maxHeight: 200 });
- TestHelpers.dialog.drag(el, '.ui-resizable-n', -1000, -1000);
- closeEnough(el.dialog('widget').height(), 200, 1, "maxHeight");
+ el = $("
").dialog({ maxHeight: 200 });
+ TestHelpers.dialog.drag(el, ".ui-resizable-n", -1000, -1000);
+ closeEnough(el.dialog("widget").height(), 200, 1, "maxHeight");
el.remove();
- el = $('
').dialog({ maxHeight: 200 }).dialog('option', 'maxHeight', 300);
- TestHelpers.dialog.drag(el, '.ui-resizable-s', 1000, 1000);
- closeEnough(el.dialog('widget').height(), 300, 1, "maxHeight");
+ el = $("
").dialog({ maxHeight: 200 }).dialog("option", "maxHeight", 300);
+ TestHelpers.dialog.drag(el, ".ui-resizable-s", 1000, 1000);
+ closeEnough(el.dialog("widget").height(), 300, 1, "maxHeight");
el.remove();
});
test("maxWidth", function() {
expect(3);
- var el = $('
').dialog({ maxWidth: 200 });
- TestHelpers.dialog.drag(el, '.ui-resizable-e', 1000, 1000);
- closeEnough(el.dialog('widget').width(), 200, 1, "maxWidth");
+ var el = $("
").dialog({ maxWidth: 200 });
+ TestHelpers.dialog.drag(el, ".ui-resizable-e", 1000, 1000);
+ closeEnough(el.dialog("widget").width(), 200, 1, "maxWidth");
el.remove();
- el = $('
').dialog({ maxWidth: 200 });
- TestHelpers.dialog.drag(el, '.ui-resizable-w', -1000, -1000);
- closeEnough(el.dialog('widget').width(), 200, 1, "maxWidth");
+ el = $("
").dialog({ maxWidth: 200 });
+ TestHelpers.dialog.drag(el, ".ui-resizable-w", -1000, -1000);
+ closeEnough(el.dialog("widget").width(), 200, 1, "maxWidth");
el.remove();
- el = $('
').dialog({ maxWidth: 200 }).dialog('option', 'maxWidth', 300);
- TestHelpers.dialog.drag(el, '.ui-resizable-w', -1000, -1000);
- closeEnough(el.dialog('widget').width(), 300, 1, "maxWidth");
+ el = $("
").dialog({ maxWidth: 200 }).dialog("option", "maxWidth", 300);
+ TestHelpers.dialog.drag(el, ".ui-resizable-w", -1000, -1000);
+ closeEnough(el.dialog("widget").width(), 300, 1, "maxWidth");
el.remove();
});
test("minHeight", function() {
expect(3);
- var el = $('
').dialog({ minHeight: 10 });
- TestHelpers.dialog.drag(el, '.ui-resizable-s', -1000, -1000);
- closeEnough(el.dialog('widget').height(), 10, 1, "minHeight");
+ var el = $("
").dialog({ minHeight: 10 });
+ TestHelpers.dialog.drag(el, ".ui-resizable-s", -1000, -1000);
+ closeEnough(el.dialog("widget").height(), 10, 1, "minHeight");
el.remove();
- el = $('
').dialog({ minHeight: 10 });
- TestHelpers.dialog.drag(el, '.ui-resizable-n', 1000, 1000);
- closeEnough(el.dialog('widget').height(), 10, 1, "minHeight");
+ el = $("
").dialog({ minHeight: 10 });
+ TestHelpers.dialog.drag(el, ".ui-resizable-n", 1000, 1000);
+ closeEnough(el.dialog("widget").height(), 10, 1, "minHeight");
el.remove();
- el = $('
').dialog({ minHeight: 10 }).dialog('option', 'minHeight', 30);
- TestHelpers.dialog.drag(el, '.ui-resizable-n', 1000, 1000);
- closeEnough(el.dialog('widget').height(), 30, 1, "minHeight");
+ el = $("
").dialog({ minHeight: 10 }).dialog("option", "minHeight", 30);
+ TestHelpers.dialog.drag(el, ".ui-resizable-n", 1000, 1000);
+ closeEnough(el.dialog("widget").height(), 30, 1, "minHeight");
el.remove();
});
test("minWidth", function() {
expect(3);
- var el = $('
').dialog({ minWidth: 10 });
- TestHelpers.dialog.drag(el, '.ui-resizable-e', -1000, -1000);
- closeEnough(el.dialog('widget').width(), 10, 1, "minWidth");
+ var el = $("
").dialog({ minWidth: 10 });
+ TestHelpers.dialog.drag(el, ".ui-resizable-e", -1000, -1000);
+ closeEnough(el.dialog("widget").width(), 10, 1, "minWidth");
el.remove();
- el = $('
').dialog({ minWidth: 10 });
- TestHelpers.dialog.drag(el, '.ui-resizable-w', 1000, 1000);
- closeEnough(el.dialog('widget').width(), 10, 1, "minWidth");
+ el = $("
").dialog({ minWidth: 10 });
+ TestHelpers.dialog.drag(el, ".ui-resizable-w", 1000, 1000);
+ closeEnough(el.dialog("widget").width(), 10, 1, "minWidth");
el.remove();
- el = $('
').dialog({ minWidth: 30 }).dialog('option', 'minWidth', 30);
- TestHelpers.dialog.drag(el, '.ui-resizable-w', 1000, 1000);
- closeEnough(el.dialog('widget').width(), 30, 1, "minWidth");
+ el = $("
").dialog({ minWidth: 30 }).dialog("option", "minWidth", 30);
+ TestHelpers.dialog.drag(el, ".ui-resizable-w", 1000, 1000);
+ closeEnough(el.dialog("widget").width(), 30, 1, "minWidth");
el.remove();
});
@@ -378,8 +378,8 @@ test( "position, right bottom at right bottom via ui.position args", function()
test( "position, at another element", function() {
expect( 4 );
- var parent = $('
').css({
- position: 'absolute',
+ var parent = $("
").css({
+ position: "absolute",
top: 400,
left: 600,
height: 10,
@@ -420,16 +420,16 @@ test( "position, at another element", function() {
test("resizable", function() {
expect(4);
- var el = $('
').dialog();
+ var el = $("
").dialog();
TestHelpers.dialog.shouldResize(el, 50, 50, "[default]");
- el.dialog('option', 'resizable', false);
- TestHelpers.dialog.shouldResize(el, 0, 0, 'disabled after init');
+ el.dialog("option", "resizable", false);
+ TestHelpers.dialog.shouldResize(el, 0, 0, "disabled after init");
el.remove();
- el = $('
').dialog({ resizable: false });
+ el = $("
").dialog({ resizable: false });
TestHelpers.dialog.shouldResize(el, 0, 0, "disabled in init options");
- el.dialog('option', 'resizable', true);
- TestHelpers.dialog.shouldResize(el, 50, 50, 'enabled after init');
+ el.dialog("option", "resizable", true);
+ TestHelpers.dialog.shouldResize(el, 50, 50, "enabled after init");
el.remove();
});
@@ -437,37 +437,37 @@ test( "title", function() {
expect( 11 );
function titleText() {
- return el.dialog('widget').find( ".ui-dialog-title" ).html();
+ return el.dialog("widget").find( ".ui-dialog-title" ).html();
}
- var el = $( '
' ).dialog();
+ var el = $( "
" ).dialog();
// some browsers return a non-breaking space and some return " "
// so we generate a non-breaking space for comparison
equal( titleText(), $( "
" ).html(), "[default]" );
equal( el.dialog( "option", "title" ), null, "option not changed" );
el.remove();
- el = $( '
' ).dialog();
+ el = $( "
" ).dialog();
equal( titleText(), "foo", "title in element attribute" );
equal( el.dialog( "option", "title"), "foo", "option updated from attribute" );
el.remove();
- el = $( '
' ).dialog({ title: 'foo' });
+ el = $( "
" ).dialog({ title: "foo" });
equal( titleText(), "foo", "title in init options" );
equal( el.dialog("option", "title"), "foo", "opiton set from options hash" );
el.remove();
- el = $( '
' ).dialog({ title: 'bar' });
+ el = $( "
" ).dialog({ title: "bar" });
equal( titleText(), "bar", "title in init options should override title in element attribute" );
equal( el.dialog("option", "title"), "bar", "opiton set from options hash" );
el.remove();
- el = $( '
' ).dialog().dialog( 'option', 'title', 'foo' );
- equal( titleText(), 'foo', 'title after init' );
+ el = $( "
" ).dialog().dialog( "option", "title", "foo" );
+ equal( titleText(), "foo", "title after init" );
el.remove();
// make sure attroperties are properly ignored - #5742 - .attr() might return a DOMElement
- el = $( '
' ).dialog();
+ el = $( "
" ).dialog();
// some browsers return a non-breaking space and some return " "
// so we get the text to normalize to the actual non-breaking space
equal( titleText(), $( "
" ).html(), "[default]" );
@@ -478,34 +478,34 @@ test( "title", function() {
test("width", function() {
expect(3);
- var el = $('
').dialog();
- closeEnough(el.dialog('widget').width(), 300, 1, "default width");
+ var el = $("
").dialog();
+ closeEnough(el.dialog("widget").width(), 300, 1, "default width");
el.remove();
- el = $('
').dialog({width: 437 });
- closeEnough(el.dialog('widget').width(), 437, 1, "explicit width");
- el.dialog('option', 'width', 438);
- closeEnough(el.dialog('widget').width(), 438, 1, 'explicit width after init');
+ el = $("
").dialog({width: 437 });
+ closeEnough(el.dialog("widget").width(), 437, 1, "explicit width");
+ el.dialog("option", "width", 438);
+ closeEnough(el.dialog("widget").width(), 438, 1, "explicit width after init");
el.remove();
});
test("#4826: setting resizable false toggles resizable on dialog", function() {
expect(6);
var i,
- el = $('
').dialog({ resizable: false });
+ el = $("
").dialog({ resizable: false });
TestHelpers.dialog.shouldResize(el, 0, 0, "[default]");
for (i=0; i<2; i++) {
- el.dialog('close').dialog('open');
- TestHelpers.dialog.shouldResize(el, 0, 0, 'initialized with resizable false toggle ('+ (i+1) +')');
+ el.dialog("close").dialog("open");
+ TestHelpers.dialog.shouldResize(el, 0, 0, "initialized with resizable false toggle ("+ (i+1) +")");
}
el.remove();
- el = $('
').dialog({ resizable: true });
+ el = $("
").dialog({ resizable: true });
TestHelpers.dialog.shouldResize(el, 50, 50, "[default]");
for (i=0; i<2; i++) {
- el.dialog('close').dialog('option', 'resizable', false).dialog('open');
- TestHelpers.dialog.shouldResize(el, 0, 0, 'set option resizable false toggle ('+ (i+1) +')');
+ el.dialog("close").dialog("option", "resizable", false).dialog("open");
+ TestHelpers.dialog.shouldResize(el, 0, 0, "set option resizable false toggle ("+ (i+1) +")");
}
el.remove();
diff --git a/tests/unit/dialog/dialog_test_helpers.js b/tests/unit/dialog/dialog_test_helpers.js
index e104ed63f..4ecaf0c0f 100644
--- a/tests/unit/dialog/dialog_test_helpers.js
+++ b/tests/unit/dialog/dialog_test_helpers.js
@@ -1,6 +1,6 @@
TestHelpers.dialog = {
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
//TODO: fix resizable so handle doesn't require mouseover in order to be used
$( handle, d ).simulate("mouseover").simulate( "drag", {
@@ -10,7 +10,7 @@ TestHelpers.dialog = {
},
testDrag: function(el, dx, dy, expectedDX, expectedDY, msg) {
var actualDX, actualDY, offsetAfter,
- d = el.dialog('widget'),
+ d = el.dialog("widget"),
handle = $(".ui-dialog-titlebar", d),
offsetBefore = d.offset();
@@ -22,11 +22,11 @@ TestHelpers.dialog = {
actualDX = offsetAfter.left - offsetBefore.left;
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) {
var heightAfter, widthAfter, actual, expected,
- d = el.dialog('widget'),
+ d = el.dialog("widget"),
handle = $(".ui-resizable-se", d),
heightBefore = d.height(),
widthBefore = d.width();
@@ -39,6 +39,6 @@ TestHelpers.dialog = {
msg = msg ? msg + "." : "";
actual = { width: widthAfter, height: heightAfter },
expected = { width: widthBefore + dw, height: heightBefore + dh };
- deepEqual(actual, expected, 'resized[' + 50 + ', ' + 50 + '] ' + msg);
+ deepEqual(actual, expected, "resized[" + 50 + ", " + 50 + "] " + msg);
}
};
\ No newline at end of file
diff --git a/tests/unit/draggable/draggable_core.js b/tests/unit/draggable/draggable_core.js
index 4e8f14d04..0f0aa2e05 100644
--- a/tests/unit/draggable/draggable_core.js
+++ b/tests/unit/draggable/draggable_core.js
@@ -7,20 +7,20 @@
module("draggable: core");
test("element types", function() {
- 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' +
- ',acronym,code,samp,kbd,var,img,hr' +
- ',input,button,label,select,iframe').split(',');
+ 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" +
+ ",acronym,code,samp,kbd,var,img,hr" +
+ ",input,button,label,select,iframe").split(",");
expect( typeNames.length * 2 );
$.each(typeNames, function(i) {
var offsetBefore, offsetAfter,
typeName = typeNames[i],
- el = $(document.createElement(typeName)).appendTo('#qunit-fixture');
+ el = $(document.createElement(typeName)).appendTo("#qunit-fixture");
- (typeName === 'table' && el.append("
content "));
- el.draggable({ cancel: '' });
+ (typeName === "table" && el.append("
content "));
+ el.draggable({ cancel: "" });
offsetBefore = el.offset();
el.simulate( "drag", {
dx: 50,
@@ -50,16 +50,16 @@ test("No options, absolute", function() {
test("resizable handle with complex markup (#8756 / #8757)", function() {
expect( 2 );
- $('#draggable1')
+ $("#draggable1")
.append(
- $('
')
+ $("
")
.addClass("ui-resizable-handle")
.addClass("ui-resizable-w")
- .append($('
'))
+ .append($("
"))
);
- var handle = $('.ui-resizable-w div'),
- target = $('#draggable1').draggable().resizable({ handles: 'all' });
+ var handle = $(".ui-resizable-w div"),
+ target = $("#draggable1").draggable().resizable({ handles: "all" });
// todo: fix resizable so it doesn't require a mouseover
handle.simulate("mouseover").simulate( "drag", { dx: -50 } );
diff --git a/tests/unit/draggable/draggable_events.js b/tests/unit/draggable/draggable_events.js
index 07a53e22e..f4ab3a8ea 100644
--- a/tests/unit/draggable/draggable_events.js
+++ b/tests/unit/draggable/draggable_events.js
@@ -82,7 +82,7 @@ test("stopping the stop callback", function() {
expect(1);
var el = $("#draggable2").draggable({
- helper: 'clone',
+ helper: "clone",
stop: function() { return false; }
});
@@ -91,7 +91,7 @@ test("stopping the stop callback", function() {
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");
});
diff --git a/tests/unit/draggable/draggable_methods.js b/tests/unit/draggable/draggable_methods.js
index 9ea353ca6..43db285ce 100644
--- a/tests/unit/draggable/draggable_methods.js
+++ b/tests/unit/draggable/draggable_methods.js
@@ -8,36 +8,36 @@ module("draggable: methods");
test("init", function() {
expect(5);
- $("
").appendTo('body').draggable().remove();
- ok(true, '.draggable() called on element');
+ $("
").appendTo("body").draggable().remove();
+ ok(true, ".draggable() called on element");
$([]).draggable();
- ok(true, '.draggable() called on empty collection');
+ ok(true, ".draggable() called on empty collection");
$("
").draggable();
- ok(true, '.draggable() called on disconnected DOMElement');
+ ok(true, ".draggable() called on disconnected DOMElement");
$("
").draggable().draggable("option", "foo");
- ok(true, 'arbitrary option getter after init');
+ ok(true, "arbitrary option getter after init");
$("
").draggable().draggable("option", "foo", "bar");
- ok(true, 'arbitrary option setter after init');
+ ok(true, "arbitrary option setter after init");
});
test("destroy", function() {
expect(4);
- $("
").appendTo('body').draggable().draggable("destroy").remove();
- ok(true, '.draggable("destroy") called on element');
+ $("
").appendTo("body").draggable().draggable("destroy").remove();
+ ok(true, ".draggable('destroy') called on element");
$([]).draggable().draggable("destroy");
- ok(true, '.draggable("destroy") called on empty collection');
+ ok(true, ".draggable('destroy') called on empty collection");
$("
").draggable().draggable("destroy");
- ok(true, '.draggable("destroy") called on disconnected DOMElement');
+ ok(true, ".draggable('destroy') called on disconnected DOMElement");
- var expected = $('
').draggable(),
- actual = expected.draggable('destroy');
- equal(actual, expected, 'destroy is chainable');
+ var expected = $("
").draggable(),
+ actual = expected.draggable("destroy");
+ equal(actual, expected, "destroy is chainable");
});
test("enable", function() {
@@ -46,23 +46,23 @@ test("enable", function() {
var expected, actual, el;
el = $("#draggable2").draggable({ disabled: true });
- TestHelpers.draggable.shouldNotMove(el, '.draggable({ disabled: true })');
+ TestHelpers.draggable.shouldNotMove(el, ".draggable({ disabled: true })");
el.draggable("enable");
- TestHelpers.draggable.shouldMove(el, '.draggable("enable")');
+ TestHelpers.draggable.shouldMove(el, ".draggable('enable')");
equal(el.draggable("option", "disabled"), false, "disabled option getter");
el.draggable("destroy");
el.draggable({ disabled: true });
- TestHelpers.draggable.shouldNotMove(el, '.draggable({ disabled: true })');
+ TestHelpers.draggable.shouldNotMove(el, ".draggable({ disabled: true })");
el.draggable("option", "disabled", false);
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 = $('
').draggable(),
- actual = expected.draggable('enable');
- equal(actual, expected, 'enable is chainable');
+ expected = $("
").draggable(),
+ actual = expected.draggable("enable");
+ equal(actual, expected, "enable is chainable");
});
test("disable", function() {
@@ -71,24 +71,24 @@ test("disable", function() {
var expected, actual, el;
el = $("#draggable2").draggable({ disabled: false });
- TestHelpers.draggable.shouldMove(el, '.draggable({ disabled: false })');
+ TestHelpers.draggable.shouldMove(el, ".draggable({ disabled: false })");
el.draggable("disable");
- TestHelpers.draggable.shouldNotMove(el, '.draggable("disable")');
+ TestHelpers.draggable.shouldNotMove(el, ".draggable('disable')");
equal(el.draggable("option", "disabled"), true, "disabled option getter");
el.draggable("destroy");
el.draggable({ disabled: false });
- TestHelpers.draggable.shouldMove(el, '.draggable({ disabled: false })');
+ TestHelpers.draggable.shouldMove(el, ".draggable({ disabled: false })");
el.draggable("option", "disabled", true);
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 = $('
').draggable(),
- actual = expected.draggable('disable');
- equal(actual, expected, 'disable is chainable');
+ expected = $("
").draggable(),
+ actual = expected.draggable("disable");
+ equal(actual, expected, "disable is chainable");
});
})(jQuery);
diff --git a/tests/unit/draggable/draggable_options.js b/tests/unit/draggable/draggable_options.js
index 59f425236..1fe2fe6ff 100644
--- a/tests/unit/draggable/draggable_options.js
+++ b/tests/unit/draggable/draggable_options.js
@@ -7,10 +7,10 @@ module("draggable: options");
test("{ appendTo: 'parent' }, default", function() {
expect( 2 );
- var el = $("#draggable2").draggable({ appendTo: 'parent' });
+ var el = $("#draggable2").draggable({ appendTo: "parent" });
TestHelpers.draggable.shouldMove(el);
- el = $("#draggable1").draggable({ appendTo: 'parent' });
+ el = $("#draggable1").draggable({ appendTo: "parent" });
TestHelpers.draggable.shouldMove(el);
});
@@ -74,7 +74,7 @@ test("{ axis: ? }, unexpected", function() {
test("{ cancel: 'input,textarea,button,select,option' }, default", function() {
expect( 2 );
- $('
').appendTo('#main');
+ $("
").appendTo("#main");
var el = $("#draggable-option-cancel-default").draggable({ cancel: "input,textarea,button,select,option" });
TestHelpers.draggable.shouldMove(el);
@@ -94,7 +94,7 @@ test("{ cancel: 'span' }", function() {
el.draggable("destroy");
- el = $("#draggable2").draggable({ cancel: 'span' });
+ el = $("#draggable2").draggable({ cancel: "span" });
TestHelpers.draggable.testDrag(el, "#draggable2 span", 50, 50, 0, 0);
});
@@ -122,13 +122,13 @@ test("{ cancel: ? }, unexpected", function() {
test("{ containment: false }, default", function() {
expect( 1 );
- ok(false, 'missing test - untested code is broken code');
+ ok(false, "missing test - untested code is broken code");
});
test("{ containment: Element }", function() {
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 );
var offsetAfter,
- el = $("#draggable1").draggable({ containment: 'parent' }),
+ el = $("#draggable1").draggable({ containment: "parent" }),
p = el.parent(),
po = p.offset(),
expected = {
- 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')
+ 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")
};
el.simulate( "drag", {
@@ -149,19 +149,19 @@ test("{ containment: 'parent' }, relative", function() {
dy: -100
});
offsetAfter = el.offset();
- deepEqual(offsetAfter, expected, 'compare offset to parent');
+ deepEqual(offsetAfter, expected, "compare offset to parent");
});
test("{ containment: 'parent' }, absolute", function() {
expect( 1 );
var offsetAfter,
- el = $("#draggable2").draggable({ containment: 'parent' }),
+ el = $("#draggable2").draggable({ containment: "parent" }),
p = el.parent(),
po = p.offset(),
expected = {
- 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')
+ 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")
};
el.simulate( "drag", {
@@ -169,32 +169,32 @@ test("{ containment: 'parent' }, absolute", function() {
dy: -100
});
offsetAfter = el.offset();
- deepEqual(offsetAfter, expected, 'compare offset to parent');
+ deepEqual(offsetAfter, expected, "compare offset to parent");
});
/*
test("{ containment: 'document' }", function() {
expect( 1 );
- ok(false, 'missing test - untested code is broken code');
+ ok(false, "missing test - untested code is broken code");
});
test("{ containment: 'window' }", function() {
expect( 1 );
- ok(false, 'missing test - untested code is broken code');
+ ok(false, "missing test - untested code is broken code");
});
test("{ containment: Selector }", function() {
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() {
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: false}, default", function() {
- expect( 1 );
-
- ok(false, 'missing test - untested code is broken code');
-});
-*/
-
-test( "{ cursorAt: left, top }", function() {
- expect( 20 );
+test( "cursorAt", function() {
+ expect( 24 );
var deltaX = -3,
deltaY = -3,
tests = {
+ "false": { cursorAt : false },
"{ 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" },
@@ -277,9 +270,12 @@ test( "{ cursorAt: left, top }", function() {
var el = $( "#draggable" + ( i + 1 ) ).draggable({
cursorAt: testData.cursorAt,
drag: function( event, ui ) {
- 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" );
+ if( !testData.cursorAt ) {
+ equal( ui.position.left - ui.originalPosition.left, deltaX, testName + " " + position + " left" );
+ 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 {
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" );
@@ -315,7 +311,7 @@ test("{ grid: [50, 50] }, absolute", function() {
test("{ handle: 'span' }", function() {
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.shouldNotMove(el, "drag element");
@@ -341,13 +337,13 @@ test("{ helper: 'original' }, relative, with scroll offset on parent", function(
var el = $("#draggable1").draggable({ helper: "original" });
TestHelpers.draggable.setScroll();
- TestHelpers.draggable.testScroll(el, 'relative');
+ TestHelpers.draggable.testScroll(el, "relative");
TestHelpers.draggable.setScroll();
- TestHelpers.draggable.testScroll(el, 'static');
+ TestHelpers.draggable.testScroll(el, "static");
TestHelpers.draggable.setScroll();
- TestHelpers.draggable.testScroll(el, 'absolute');
+ TestHelpers.draggable.testScroll(el, "absolute");
TestHelpers.draggable.restoreScroll();
@@ -358,16 +354,16 @@ test("{ helper: 'original' }, relative, with scroll offset on root", function()
var el = $("#draggable1").draggable({ helper: "original" });
- TestHelpers.draggable.setScroll('root');
- TestHelpers.draggable.testScroll(el, 'relative');
+ TestHelpers.draggable.setScroll("root");
+ TestHelpers.draggable.testScroll(el, "relative");
- TestHelpers.draggable.setScroll('root');
- TestHelpers.draggable.testScroll(el, 'static');
+ TestHelpers.draggable.setScroll("root");
+ TestHelpers.draggable.testScroll(el, "static");
- TestHelpers.draggable.setScroll('root');
- TestHelpers.draggable.testScroll(el, 'absolute');
+ TestHelpers.draggable.setScroll("root");
+ 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" });
TestHelpers.draggable.setScroll();
- TestHelpers.draggable.setScroll('root');
- TestHelpers.draggable.testScroll(el, 'relative');
+ TestHelpers.draggable.setScroll("root");
+ TestHelpers.draggable.testScroll(el, "relative");
TestHelpers.draggable.setScroll();
- TestHelpers.draggable.setScroll('root');
- TestHelpers.draggable.testScroll(el, 'static');
+ TestHelpers.draggable.setScroll("root");
+ TestHelpers.draggable.testScroll(el, "static");
TestHelpers.draggable.setScroll();
- TestHelpers.draggable.setScroll('root');
- TestHelpers.draggable.testScroll(el, 'absolute');
+ TestHelpers.draggable.setScroll("root");
+ TestHelpers.draggable.testScroll(el, "absolute");
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);
- 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.testScroll(el, 'relative');
+ TestHelpers.draggable.testScroll(el, "relative");
TestHelpers.draggable.setScroll();
- TestHelpers.draggable.testScroll(el, 'static');
+ TestHelpers.draggable.testScroll(el, "static");
TestHelpers.draggable.setScroll();
- TestHelpers.draggable.testScroll(el, 'absolute');
+ TestHelpers.draggable.testScroll(el, "absolute");
TestHelpers.draggable.restoreScroll();
@@ -417,18 +413,18 @@ test("{ helper: 'original' }, absolute, with scroll offset on root", function()
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.testScroll(el, 'relative');
+ TestHelpers.draggable.setScroll("root");
+ TestHelpers.draggable.testScroll(el, "relative");
- TestHelpers.draggable.setScroll('root');
- TestHelpers.draggable.testScroll(el, 'static');
+ TestHelpers.draggable.setScroll("root");
+ TestHelpers.draggable.testScroll(el, "static");
- TestHelpers.draggable.setScroll('root');
- TestHelpers.draggable.testScroll(el, 'absolute');
+ TestHelpers.draggable.setScroll("root");
+ 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);
- 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('root');
- TestHelpers.draggable.testScroll(el, 'relative');
+ TestHelpers.draggable.setScroll("root");
+ TestHelpers.draggable.testScroll(el, "relative");
TestHelpers.draggable.setScroll();
- TestHelpers.draggable.setScroll('root');
- TestHelpers.draggable.testScroll(el, 'static');
+ TestHelpers.draggable.setScroll("root");
+ TestHelpers.draggable.testScroll(el, "static");
TestHelpers.draggable.setScroll();
- TestHelpers.draggable.setScroll('root');
- TestHelpers.draggable.testScroll(el, 'absolute');
+ TestHelpers.draggable.setScroll("root");
+ TestHelpers.draggable.testScroll(el, "absolute");
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);
- 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.testScroll(el, 'relative');
+ TestHelpers.draggable.testScroll(el, "relative");
TestHelpers.draggable.setScroll();
- TestHelpers.draggable.testScroll(el, 'static');
+ TestHelpers.draggable.testScroll(el, "static");
TestHelpers.draggable.setScroll();
- TestHelpers.draggable.testScroll(el, 'absolute');
+ TestHelpers.draggable.testScroll(el, "absolute");
TestHelpers.draggable.restoreScroll();
@@ -478,40 +474,40 @@ test("{ helper: 'original' }, fixed, with scroll offset on root", function() {
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.testScroll(el, 'relative');
+ TestHelpers.draggable.setScroll("root");
+ TestHelpers.draggable.testScroll(el, "relative");
- TestHelpers.draggable.setScroll('root');
- TestHelpers.draggable.testScroll(el, 'static');
+ TestHelpers.draggable.setScroll("root");
+ TestHelpers.draggable.testScroll(el, "static");
- TestHelpers.draggable.setScroll('root');
- TestHelpers.draggable.testScroll(el, 'absolute');
+ TestHelpers.draggable.setScroll("root");
+ 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() {
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('root');
- TestHelpers.draggable.testScroll(el, 'relative');
+ TestHelpers.draggable.setScroll("root");
+ TestHelpers.draggable.testScroll(el, "relative");
TestHelpers.draggable.setScroll();
- TestHelpers.draggable.setScroll('root');
- TestHelpers.draggable.testScroll(el, 'static');
+ TestHelpers.draggable.setScroll("root");
+ TestHelpers.draggable.testScroll(el, "static");
TestHelpers.draggable.setScroll();
- TestHelpers.draggable.setScroll('root');
- TestHelpers.draggable.testScroll(el, 'absolute');
+ TestHelpers.draggable.setScroll("root");
+ TestHelpers.draggable.testScroll(el, "absolute");
TestHelpers.draggable.restoreScroll();
- TestHelpers.draggable.restoreScroll('root');
+ TestHelpers.draggable.restoreScroll("root");
});
@@ -529,7 +525,7 @@ test("{ helper: 'clone' }, absolute", function() {
dx: 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();
} });
- $("#main").css('position', 'relative');
+ $("#main").css("position", "relative");
origOffset = $("#draggable1").offset();
el.simulate( "drag", {
dx: 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();
el.simulate( "drag", {
dx: 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();
el.simulate( "drag", {
dx: 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();
@@ -576,38 +572,38 @@ test("{ helper: 'clone' }, absolute with scroll offset on root", function() {
expect(3);
- TestHelpers.draggable.setScroll('root');
+ TestHelpers.draggable.setScroll("root");
var helperOffset = null,
origOffset = null,
el = $("#draggable1").draggable({ helper: "clone", drag: function(event, ui) {
helperOffset = ui.helper.offset();
} });
- $("#main").css('position', 'relative');
+ $("#main").css("position", "relative");
origOffset = $("#draggable1").offset();
el.simulate( "drag", {
dx: 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();
el.simulate( "drag", {
dx: 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();
el.simulate( "drag", {
dx: 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);
- TestHelpers.draggable.setScroll('root');
+ TestHelpers.draggable.setScroll("root");
TestHelpers.draggable.setScroll();
var helperOffset = null,
@@ -624,31 +620,31 @@ test("{ helper: 'clone' }, absolute with scroll offset on root and parent", func
helperOffset = ui.helper.offset();
} });
- $("#main").css('position', 'relative');
+ $("#main").css("position", "relative");
origOffset = $("#draggable1").offset();
el.simulate( "drag", {
dx: 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();
el.simulate( "drag", {
dx: 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();
el.simulate( "drag", {
dx: 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();
});
diff --git a/tests/unit/draggable/draggable_test_helpers.js b/tests/unit/draggable/draggable_test_helpers.js
index 9a6355b2e..c1ac0ab88 100644
--- a/tests/unit/draggable/draggable_test_helpers.js
+++ b/tests/unit/draggable/draggable_test_helpers.js
@@ -15,7 +15,7 @@ TestHelpers.draggable = {
expected = { left: offsetBefore.left + expectedDX, top: offsetBefore.top + expectedDY };
msg = msg ? msg + "." : "";
- deepEqual(actual, expected, 'dragged[' + dx + ', ' + dy + '] ' + msg);
+ deepEqual(actual, expected, "dragged[" + dx + ", " + dy + "] " + msg);
},
shouldMove: function(el, 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);
},
testScroll: function(el, position ) {
- var oldPosition = $("#main").css('position');
- $("#main").css('position', position);
- TestHelpers.draggable.shouldMove(el, position+' parent');
- $("#main").css('position', oldPosition);
+ var oldPosition = $("#main").css("position");
+ $("#main").css("position", position);
+ TestHelpers.draggable.shouldMove(el, position+" parent");
+ $("#main").css("position", oldPosition);
},
restoreScroll: function( what ) {
if( what ) {
@@ -46,9 +46,9 @@ TestHelpers.draggable = {
}
},
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) {
- return parseInt(el.css('margin-' + side), 10) || 0;
+ return parseInt(el.css("margin-" + side), 10) || 0;
}
};
\ No newline at end of file
diff --git a/tests/unit/droppable/droppable_core.js b/tests/unit/droppable/droppable_core.js
index c98850a03..53b08fd85 100644
--- a/tests/unit/droppable/droppable_core.js
+++ b/tests/unit/droppable/droppable_core.js
@@ -7,18 +7,18 @@
module("droppable: core");
test("element types", function() {
- 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' +
- ',acronym,code,samp,kbd,var,img,hr' +
- ',input,button,label,select,iframe').split(',');
+ 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" +
+ ",acronym,code,samp,kbd,var,img,hr" +
+ ",input,button,label,select,iframe").split(",");
expect( typeNames.length );
$.each(typeNames, function(i) {
var typeName = typeNames[i],
- el = $(document.createElement(typeName)).appendTo('body');
+ el = $(document.createElement(typeName)).appendTo("body");
- (typeName === 'table' && el.append("
content "));
+ (typeName === "table" && el.append("
content "));
el.droppable();
TestHelpers.droppable.shouldDrop();
el.droppable("destroy");
diff --git a/tests/unit/droppable/droppable_methods.js b/tests/unit/droppable/droppable_methods.js
index 76501c5b1..2b452a63d 100644
--- a/tests/unit/droppable/droppable_methods.js
+++ b/tests/unit/droppable/droppable_methods.js
@@ -8,37 +8,37 @@ module("droppable: methods");
test("init", function() {
expect( 5 );
- $("
").appendTo('body').droppable().remove();
- ok(true, '.droppable() called on element');
+ $("
").appendTo("body").droppable().remove();
+ ok(true, ".droppable() called on element");
$([]).droppable();
- ok(true, '.droppable() called on empty collection');
+ ok(true, ".droppable() called on empty collection");
$("
").droppable();
- ok(true, '.droppable() called on disconnected DOMElement');
+ ok(true, ".droppable() called on disconnected DOMElement");
$("
").droppable().droppable("option", "foo");
- ok(true, 'arbitrary option getter after init');
+ ok(true, "arbitrary option getter after init");
$("
").droppable().droppable("option", "foo", "bar");
- ok(true, 'arbitrary option setter after init');
+ ok(true, "arbitrary option setter after init");
});
test("destroy", function() {
expect( 4 );
- $("
").appendTo('body').droppable().droppable("destroy").remove();
- ok(true, '.droppable("destroy") called on element');
+ $("
").appendTo("body").droppable().droppable("destroy").remove();
+ ok(true, ".droppable('destroy') called on element");
$([]).droppable().droppable("destroy");
- ok(true, '.droppable("destroy") called on empty collection');
+ ok(true, ".droppable('destroy') called on empty collection");
$("
").droppable().droppable("destroy");
- ok(true, '.droppable("destroy") called on disconnected DOMElement');
+ ok(true, ".droppable('destroy') called on disconnected DOMElement");
- var expected = $('
').droppable(),
- actual = expected.droppable('destroy');
- equal(actual, expected, 'destroy is chainable');
+ var expected = $("
").droppable(),
+ actual = expected.droppable("destroy");
+ equal(actual, expected, "destroy is chainable");
});
test("enable", function() {
@@ -58,9 +58,9 @@ test("enable", function() {
equal(el.droppable("option", "disabled"), false, "disabled option setter");
TestHelpers.droppable.shouldDrop();
- expected = $('
').droppable(),
- actual = expected.droppable('enable');
- equal(actual, expected, 'enable is chainable');
+ expected = $("
").droppable(),
+ actual = expected.droppable("enable");
+ equal(actual, expected, "enable is chainable");
});
test("disable", function() {
@@ -80,9 +80,9 @@ test("disable", function() {
equal(el.droppable("option", "disabled"), true, "disabled option setter");
TestHelpers.droppable.shouldNotDrop();
- expected = $('
').droppable(),
- actual = expected.droppable('disable');
- equal(actual, expected, 'disable is chainable');
+ expected = $("
").droppable(),
+ actual = expected.droppable("disable");
+ equal(actual, expected, "disable is chainable");
});
})(jQuery);
diff --git a/tests/unit/droppable/droppable_test_helpers.js b/tests/unit/droppable/droppable_test_helpers.js
index 79311788c..ffd374529 100644
--- a/tests/unit/droppable/droppable_test_helpers.js
+++ b/tests/unit/droppable/droppable_test_helpers.js
@@ -1,10 +1,10 @@
TestHelpers.droppable = {
shouldDrop: function() {
// todo: actually implement this
- ok(true, 'missing test - untested code is broken code');
+ ok(true, "missing test - untested code is broken code");
},
shouldNotDrop: function() {
// todo: actually implement this
- ok(true, 'missing test - untested code is broken code');
+ ok(true, "missing test - untested code is broken code");
}
};
\ No newline at end of file
diff --git a/tests/unit/menu/menu_options.js b/tests/unit/menu/menu_options.js
index 2c8749e3c..e3977e6ce 100644
--- a/tests/unit/menu/menu_options.js
+++ b/tests/unit/menu/menu_options.js
@@ -41,9 +41,12 @@ test( "{ disabled: false }", function() {
});
test( "{ icons: default }", function() {
- expect( 1 );
+ expect( 2 );
var element = $( "#menu2" ).menu();
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() {
diff --git a/tests/unit/qunit-composite.js b/tests/unit/qunit-composite.js
index 89c47eb29..b3df04217 100644
--- a/tests/unit/qunit-composite.js
+++ b/tests/unit/qunit-composite.js
@@ -96,7 +96,7 @@ QUnit.testDone(function() {
}
});
- current.getElementsByTagName('a')[0].href = src;
+ current.getElementsByTagName("a")[0].href = src;
});
}( QUnit ) );
diff --git a/tests/unit/resizable/resizable_common.js b/tests/unit/resizable/resizable_common.js
index 2c64f3cb1..6758214ad 100644
--- a/tests/unit/resizable/resizable_common.js
+++ b/tests/unit/resizable/resizable_common.js
@@ -1,19 +1,19 @@
-TestHelpers.commonWidgetTests('resizable', {
+TestHelpers.commonWidgetTests("resizable", {
defaults: {
alsoResize: false,
animate: false,
- animateDuration: 'slow',
- animateEasing: 'swing',
+ animateDuration: "slow",
+ animateEasing: "swing",
aspectRatio: false,
autoHide: false,
- cancel: 'input,textarea,button,select,option',
+ cancel: "input,textarea,button,select,option",
containment: false,
delay: 0,
disabled: false,
distance: 1,
ghost: false,
grid: false,
- handles: 'e,s,se',
+ handles: "e,s,se",
helper: false,
maxHeight: null,
maxWidth: null,
diff --git a/tests/unit/resizable/resizable_core.js b/tests/unit/resizable/resizable_core.js
index 13da26ece..4cffea185 100644
--- a/tests/unit/resizable/resizable_core.js
+++ b/tests/unit/resizable/resizable_core.js
@@ -8,17 +8,17 @@ module("resizable: core");
/*
test("element types", function() {
- 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'
- + ',acronym,code,samp,kbd,var,img,object,hr'
- + ',input,button,label,select,iframe').split(',');
+ 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"
+ + ",acronym,code,samp,kbd,var,img,object,hr"
+ + ",input,button,label,select,iframe").split(",");
$.each(typeNames, function(i) {
var typeName = typeNames[i];
- el = $(document.createElement(typeName)).appendTo('body');
- (typeName == 'table' && el.append("
content "));
+ el = $(document.createElement(typeName)).appendTo("body");
+ (typeName == "table" && el.append("
content "));
el.resizable();
- ok(true, '$("<' + typeName + '/>").resizable()');
+ ok(true, "$('<" + typeName + "/>').resizable()");
el.resizable("destroy");
el.remove();
});
@@ -28,7 +28,7 @@ test("element types", function() {
test("n", function() {
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);
equal( target.height(), 150, "compare height" );
@@ -43,7 +43,7 @@ test("n", function() {
test("s", function() {
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);
equal( target.height(), 150, "compare height" );
@@ -59,7 +59,7 @@ test("s", function() {
test("e", function() {
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);
equal( target.width(), 150, "compare width");
@@ -75,7 +75,7 @@ test("e", function() {
test("w", function() {
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);
equal( target.width(), 150, "compare width" );
@@ -90,7 +90,7 @@ test("w", function() {
test("ne", function() {
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);
equal( target.width(), 50, "compare width" );
@@ -106,7 +106,7 @@ test("ne", function() {
test("se", function() {
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);
equal( target.width(), 150, "compare width" );
@@ -123,7 +123,7 @@ test("se", function() {
test("sw", function() {
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);
equal( target.width(), 150, "compare width" );
@@ -139,7 +139,7 @@ test("sw", function() {
test("nw", function() {
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);
equal( target.width(), 150, "compare width" );
@@ -153,15 +153,15 @@ test("nw", function() {
test("handle with complex markup (#8756)", function() {
expect(2);
- $('#resizable1')
+ $("#resizable1")
.append(
- $('
')
+ $("
")
.addClass("ui-resizable-handle")
.addClass("ui-resizable-w")
- .append($('
'))
+ .append($("
"))
);
- 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);
equal( target.width(), 150, "compare width" );
@@ -176,7 +176,7 @@ test("resizable accounts for scroll position correctly (#3815)", function() {
var position, top, left,
container = $("
").appendTo("#qunit-fixture"),
overflowed = $("
").appendTo( container ),
- el = $("
").appendTo( overflowed ).resizable({ handles: 'all' }),
+ el = $("
").appendTo( overflowed ).resizable({ handles: "all" }),
handle = ".ui-resizable-e";
container.scrollLeft( 100 ).scrollTop( 100 );
diff --git a/tests/unit/resizable/resizable_options.js b/tests/unit/resizable/resizable_options.js
index d79523183..89504e363 100644
--- a/tests/unit/resizable/resizable_options.js
+++ b/tests/unit/resizable/resizable_options.js
@@ -28,7 +28,7 @@ test( "alsoResize", function() {
test("aspectRatio: 'preserve' (e)", function() {
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);
equal( target.width(), 130, "compare maxWidth");
@@ -42,7 +42,7 @@ test("aspectRatio: 'preserve' (e)", function() {
test("aspectRatio: 'preserve' (w)", function() {
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);
equal( target.width(), 130, "compare maxWidth");
@@ -56,7 +56,7 @@ test("aspectRatio: 'preserve' (w)", function() {
test("aspectRatio: 'preserve' (n)", function() {
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);
equal( target.width(), 130, "compare maxWidth");
@@ -70,7 +70,7 @@ test("aspectRatio: 'preserve' (n)", function() {
test("aspectRatio: 'preserve' (s)", function() {
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);
equal( target.width(), 130, "compare maxWidth");
@@ -84,7 +84,7 @@ test("aspectRatio: 'preserve' (s)", function() {
test("aspectRatio: 'preserve' (se)", function() {
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);
equal( target.width(), 130, "compare maxWidth");
@@ -98,7 +98,7 @@ test("aspectRatio: 'preserve' (se)", function() {
test("aspectRatio: 'preserve' (sw)", function() {
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);
equal( target.width(), 130, "compare maxWidth");
@@ -112,7 +112,7 @@ test("aspectRatio: 'preserve' (sw)", function() {
test("aspectRatio: 'preserve' (ne)", function() {
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);
equal( target.width(), 130, "compare maxWidth");
@@ -141,7 +141,7 @@ test( "containment", function() {
test("grid", function() {
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);
equal( target.width(), 103, "compare width");
@@ -169,7 +169,7 @@ test("grid (min/max dimensions)", function() {
test("grid (wrapped)", function() {
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);
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() {
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);
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() {
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);
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() {
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);
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() {
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);
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() {
expect(8);
- var target = $('
').resizable({ handles: 'all', zIndex: 100 });
- target.children( '.ui-resizable-handle' ).each( function( index, handle ) {
- equal( $( handle ).css( 'zIndex' ), 100, 'compare zIndex' );
+ var target = $("
").resizable({ handles: "all", zIndex: 100 });
+ target.children( ".ui-resizable-handle" ).each( function( index, handle ) {
+ equal( $( handle ).css( "zIndex" ), 100, "compare zIndex" );
});
});
diff --git a/tests/unit/selectable/selectable.html b/tests/unit/selectable/selectable.html
index 13718e1f3..18ffc6ef7 100644
--- a/tests/unit/selectable/selectable.html
+++ b/tests/unit/selectable/selectable.html
@@ -26,7 +26,6 @@
-
diff --git a/tests/unit/selectable/selectable_common.js b/tests/unit/selectable/selectable_common.js
index aee6a15ac..00bbedc61 100644
--- a/tests/unit/selectable/selectable_common.js
+++ b/tests/unit/selectable/selectable_common.js
@@ -1,13 +1,13 @@
-TestHelpers.commonWidgetTests('selectable', {
+TestHelpers.commonWidgetTests("selectable", {
defaults: {
- appendTo: 'body',
+ appendTo: "body",
autoRefresh: true,
- cancel: 'input,textarea,button,select,option',
+ cancel: "input,textarea,button,select,option",
create: null,
delay: 0,
disabled: false,
distance: 0,
- filter: '*',
- tolerance: 'touch'
+ filter: "*",
+ tolerance: "touch"
}
});
diff --git a/tests/unit/selectable/selectable_events.js b/tests/unit/selectable/selectable_events.js
index 984fd1862..f933d3890 100644
--- a/tests/unit/selectable/selectable_events.js
+++ b/tests/unit/selectable/selectable_events.js
@@ -35,4 +35,32 @@ test( "stop", function() {
});
});
+test( "mousedown: initial position of helper", function() {
+ expect( 2 );
+
+ var contentToForceScroll, helper,
+ element = $("#selectable1").selectable();
+
+ contentToForceScroll = $("
").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 );
diff --git a/tests/unit/selectable/selectable_methods.js b/tests/unit/selectable/selectable_methods.js
index d894a13e4..72f9bb28d 100644
--- a/tests/unit/selectable/selectable_methods.js
+++ b/tests/unit/selectable/selectable_methods.js
@@ -8,39 +8,39 @@ module("selectable: methods");
test("init", function() {
expect( 5 );
- $("
").appendTo('body').selectable().remove();
- ok(true, '.selectable() called on element');
+ $("
").appendTo("body").selectable().remove();
+ ok(true, ".selectable() called on element");
$([]).selectable().remove();
- ok(true, '.selectable() called on empty collection');
+ ok(true, ".selectable() called on empty collection");
$("
").selectable().remove();
- ok(true, '.selectable() called on disconnected DOMElement');
+ ok(true, ".selectable() called on disconnected DOMElement");
var el = $("
").selectable();
el.selectable("option", "foo");
el.remove();
- ok(true, 'arbitrary option getter after init');
+ ok(true, "arbitrary option getter after init");
$("
").selectable().selectable("option", "foo", "bar").remove();
- ok(true, 'arbitrary option setter after init');
+ ok(true, "arbitrary option setter after init");
});
test("destroy", function() {
expect( 4 );
- $("
").appendTo('body').selectable().selectable("destroy").remove();
- ok(true, '.selectable("destroy") called on element');
+ $("
").appendTo("body").selectable().selectable("destroy").remove();
+ ok(true, ".selectable('destroy') called on element");
$([]).selectable().selectable("destroy").remove();
- ok(true, '.selectable("destroy") called on empty collection');
+ ok(true, ".selectable('destroy') called on empty collection");
$("
").selectable().selectable("destroy").remove();
- ok(true, '.selectable("destroy") called on disconnected DOMElement');
+ ok(true, ".selectable('destroy') called on disconnected DOMElement");
- var expected = $('
').selectable(),
- actual = expected.selectable('destroy');
- equal(actual, expected, 'destroy is chainable');
+ var expected = $("
").selectable(),
+ actual = expected.selectable("destroy");
+ equal(actual, expected, "destroy is chainable");
});
test("enable", function() {
@@ -66,9 +66,9 @@ test("enable", function() {
equal(fired, true, "start fired");
el.selectable("destroy");
- expected = $('
').selectable();
- actual = expected.selectable('enable');
- equal(actual, expected, 'enable is chainable');
+ expected = $("
").selectable();
+ actual = expected.selectable("enable");
+ equal(actual, expected, "enable is chainable");
});
test("disable", function() {
@@ -96,9 +96,9 @@ test("disable", function() {
equal(fired, false, "start fired");
el.selectable("destroy");
- expected = $('
').selectable();
- actual = expected.selectable('disable');
- equal(actual, expected, 'disable is chainable');
+ expected = $("
").selectable();
+ actual = expected.selectable("disable");
+ equal(actual, expected, "disable is chainable");
});
})(jQuery);
diff --git a/tests/unit/selectable/selectable_options.js b/tests/unit/selectable/selectable_options.js
index a2455fdca..973247f56 100644
--- a/tests/unit/selectable/selectable_options.js
+++ b/tests/unit/selectable/selectable_options.js
@@ -52,7 +52,7 @@ test("filter", function() {
selected = function() { actual += 1; };
- el = $("#selectable1").selectable({ filter: '.special', selected: selected });
+ el = $("#selectable1").selectable({ filter: ".special", selected: selected });
el.simulate( "drag", {
dx: 1000,
dy: 1000
diff --git a/tests/unit/slider/slider_common.js b/tests/unit/slider/slider_common.js
index ccf793549..48fd5e457 100644
--- a/tests/unit/slider/slider_common.js
+++ b/tests/unit/slider/slider_common.js
@@ -1,13 +1,13 @@
TestHelpers.commonWidgetTests( "slider", {
defaults: {
animate: false,
- cancel: 'input,textarea,button,select,option',
+ cancel: "input,textarea,button,select,option",
delay: 0,
disabled: false,
distance: 0,
max: 100,
min: 0,
- orientation: 'horizontal',
+ orientation: "horizontal",
range: false,
step: 1,
value: 0,
diff --git a/tests/unit/slider/slider_core.js b/tests/unit/slider/slider_core.js
index 86a516875..7195147cc 100644
--- a/tests/unit/slider/slider_core.js
+++ b/tests/unit/slider/slider_core.js
@@ -17,11 +17,11 @@ module("slider: core");
test("keydown HOME on handle sets value to min", function() {
expect( 2 );
- el = $('
');
+ el = $("
");
options = {
max: 5,
min: -5,
- orientation: 'horizontal',
+ orientation: "horizontal",
step: 1
};
el.slider(options);
@@ -31,13 +31,13 @@ test("keydown HOME on handle sets value to min", function() {
handle().simulate("keydown", { keyCode: $.ui.keyCode.HOME });
equal(el.slider("value"), options.min);
- el.slider('destroy');
+ el.slider("destroy");
- el = $('
');
+ el = $("
");
options = {
max: 5,
min: -5,
- orientation: 'vertical',
+ orientation: "vertical",
step: 1
};
el.slider(options);
@@ -47,16 +47,16 @@ test("keydown HOME on handle sets value to min", function() {
handle().simulate("keydown", { keyCode: $.ui.keyCode.HOME });
equal(el.slider("value"), options.min);
- el.slider('destroy');
+ el.slider("destroy");
});
test("keydown END on handle sets value to max", function() {
expect( 2 );
- el = $('
');
+ el = $("
");
options = {
max: 5,
min: -5,
- orientation: 'horizontal',
+ orientation: "horizontal",
step: 1
};
el.slider(options);
@@ -66,13 +66,13 @@ test("keydown END on handle sets value to max", function() {
handle().simulate("keydown", { keyCode: $.ui.keyCode.END });
equal(el.slider("value"), options.max);
- el.slider('destroy');
+ el.slider("destroy");
- el = $('
');
+ el = $("
");
options = {
max: 5,
min: -5,
- orientation: 'vertical',
+ orientation: "vertical",
step: 1
};
el.slider(options);
@@ -82,13 +82,13 @@ test("keydown END on handle sets value to max", function() {
handle().simulate("keydown", { keyCode: $.ui.keyCode.END });
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() {
expect( 4 );
- $.each(['horizontal', 'vertical'], function(i, orientation) {
- el = $('
');
+ $.each(["horizontal", "vertical"], function(i, orientation) {
+ el = $("
");
options = {
max: 100,
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() {
expect( 4 );
- $.each(['horizontal', 'vertical'], function(i, orientation) {
- el = $('
');
+ $.each(["horizontal", "vertical"], function(i, orientation) {
+ el = $("
");
options = {
max: 100,
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() {
expect( 4 );
- el = $('
');
+ el = $("
");
options = {
max: 5,
min: -5,
- orientation: 'horizontal',
+ orientation: "horizontal",
step: 1
};
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 = $('
');
+ el = $("
");
options = {
max: 5,
min: -5,
- orientation: 'vertical',
+ orientation: "vertical",
step: 1
};
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() {
expect( 4 );
- el = $('
');
+ el = $("
");
options = {
max: 5,
min: -5,
- orientation: 'horizontal',
+ orientation: "horizontal",
step: 1
};
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 = $('
');
+ el = $("
");
options = {
max: 5,
min: -5,
- orientation: 'vertical',
+ orientation: "vertical",
step: 1
};
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() {
expect( 4 );
- el = $('
');
+ el = $("
");
options = {
max: 5,
min: -5,
- orientation: 'horizontal',
+ orientation: "horizontal",
step: 1
};
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 = $('
');
+ el = $("
");
options = {
max: 5,
min: -5,
- orientation: 'vertical',
+ orientation: "vertical",
step: 1
};
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() {
expect( 4 );
- el = $('
');
+ el = $("
");
options = {
max: 5,
min: -5,
- orientation: 'horizontal',
+ orientation: "horizontal",
step: 1
};
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 = $('
');
+ el = $("
");
options = {
max: 5,
min: -5,
- orientation: 'vertical',
+ orientation: "vertical",
step: 1
};
el.slider(options);
diff --git a/tests/unit/slider/slider_methods.js b/tests/unit/slider/slider_methods.js
index 83e78b855..73b8eb739 100644
--- a/tests/unit/slider/slider_methods.js
+++ b/tests/unit/slider/slider_methods.js
@@ -8,22 +8,22 @@ module("slider: methods");
test("init", function() {
expect(5);
- $("
").appendTo('body').slider().remove();
- ok(true, '.slider() called on element');
+ $("
").appendTo("body").slider().remove();
+ ok(true, ".slider() called on element");
$([]).slider().remove();
- ok(true, '.slider() called on empty collection');
+ ok(true, ".slider() called on empty collection");
- $('
').slider().remove();
- ok(true, '.slider() called on disconnected DOMElement');
+ $("
").slider().remove();
+ ok(true, ".slider() called on disconnected DOMElement");
- var el = $('
').slider();
+ var el = $("
").slider();
el.slider("option", "foo");
el.remove();
- ok(true, 'arbitrary option getter after init');
+ ok(true, "arbitrary option getter after init");
- $('
').slider().slider("option", "foo", "bar").remove();
- ok(true, 'arbitrary option setter after init');
+ $("
").slider().slider("option", "foo", "bar").remove();
+ ok(true, "arbitrary option setter after init");
});
test("destroy", function() {
@@ -36,60 +36,60 @@ test("destroy", function() {
test("enable", function() {
expect( 5 );
var el,
- expected = $('
').slider(),
- actual = expected.slider('enable');
- equal(actual, expected, 'enable is chainable');
+ expected = $("
").slider(),
+ actual = expected.slider("enable");
+ equal(actual, expected, "enable is chainable");
- el = $('
').slider({ disabled: true });
- 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');
- 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-slider-disabled'), 'slider does not have ui-slider-disabled class after enable method call');
+ el = $("
").slider({ disabled: true });
+ 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");
+ 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-slider-disabled"), "slider does not have ui-slider-disabled class after enable method call");
});
test("disable", function() {
expect( 5 );
var el,
- expected = $('
').slider(),
- actual = expected.slider('disable');
- equal(actual, expected, 'disable is chainable');
+ expected = $("
").slider(),
+ actual = expected.slider("disable");
+ equal(actual, expected, "disable is chainable");
- el = $('
').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-slider-disabled'), 'slider does not have ui-slider-disabled class before disable method call');
- el.slider('disable');
- 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');
+ el = $("
").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-slider-disabled"), "slider does not have ui-slider-disabled class before disable method call");
+ el.slider("disable");
+ 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");
});
test("value", function() {
expect( 17 );
- $([false, 'min', 'max']).each(function() {
- var el = $('
').slider({
+ $([false, "min", "max"]).each(function() {
+ var el = $("
").slider({
range: this,
value: 5
});
- 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, 'range: ' + this + ' slider method set');
+ 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, "range: " + this + " slider method set");
el.remove();
});
- var el = $('
').slider({
+ var el = $("
").slider({
min: -1, value: 0, max: 1
});
// min with value option vs value method
- el.slider('option', 'value', -2);
- 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', -2), el, 'value method is chainable');
- equal(el.slider('option', 'value'), -1, 'value method set respects min');
+ el.slider("option", "value", -2);
+ 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", -2), el, "value method is chainable");
+ equal(el.slider("option", "value"), -1, "value method set respects min");
// max with value option vs value method
- el.slider('option', 'value', 2);
- 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', 2), el, 'value method is chainable');
- equal(el.slider('option', 'value'), 1, 'value method set respects max');
+ el.slider("option", "value", 2);
+ 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", 2), el, "value method is chainable");
+ equal(el.slider("option", "value"), 1, "value method set respects max");
});
//test("values", function() {
diff --git a/tests/unit/slider/slider_options.js b/tests/unit/slider/slider_options.js
index e34352eb0..d354ef91c 100644
--- a/tests/unit/slider/slider_options.js
+++ b/tests/unit/slider/slider_options.js
@@ -13,12 +13,12 @@ module("slider: options");
test("max", function() {
expect( 2 );
- el = $('
');
+ el = $("
");
options = {
max: 37,
min: 6,
- orientation: 'horizontal',
+ orientation: "horizontal",
step: 1,
value: 50
};
@@ -26,18 +26,18 @@ test("max", function() {
el.slider(options);
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");
- el.slider('destroy');
+ el.slider("destroy");
});
test("min", function() {
expect( 2 );
- el = $('
');
+ el = $("
");
options = {
max: 37,
min: 6,
- orientation: 'vertical',
+ orientation: "vertical",
step: 1,
value: 2
};
@@ -45,45 +45,45 @@ test("min", function() {
el.slider(options);
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");
- el.slider('destroy');
+ el.slider("destroy");
});
test("orientation", function() {
expect( 6 );
- el = $('#slider1');
+ el = $("#slider1");
options = {
max: 2,
min: -2,
- orientation: 'vertical',
+ orientation: "vertical",
value: 1
};
var percentVal = (options.value - options.min) / (options.max - options.min) * 100;
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-vertical'), "horizontal slider does not have class .ui-slider-vertical");
- equal(handle()[0].style.left, percentVal + '%', "horizontal slider handle is positioned with left: %");
+ 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");
+ equal(handle()[0].style.left, percentVal + "%", "horizontal slider handle is positioned with left: %");
- el.slider('destroy');
+ el.slider("destroy");
options = {
max: 2,
min: -2,
- orientation: 'horizontal',
+ orientation: "horizontal",
value: -1
};
percentVal = (options.value - options.min) / (options.max - options.min) * 100;
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-horizontal'), "vertical slider does not have class .ui-slider-horizontal");
- equal(handle()[0].style.bottom, percentVal + '%', "vertical slider handle is positioned with bottom: %");
+ 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");
+ 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)
test("step", function() {
expect( 9 );
- var el = $('
').slider({
+ var el = $("
").slider({
min: 0,
value: 0,
step: 10,
@@ -116,7 +116,7 @@ test("step", function() {
el.slider("value", 19);
equal( el.slider("value"), 20 );
- el = $('
').slider({
+ el = $("
").slider({
min: 0,
value: 0,
step: 20,
@@ -136,7 +136,7 @@ test("step", function() {
el.slider("option", "value", 19);
equal( el.slider("value"), 20 );
- el.slider('destroy');
+ el.slider("destroy");
});
//test("value", function() {
diff --git a/tests/unit/sortable/sortable_events.js b/tests/unit/sortable/sortable_events.js
index b9ee078f5..1b8165acb 100644
--- a/tests/unit/sortable/sortable_events.js
+++ b/tests/unit/sortable/sortable_events.js
@@ -17,15 +17,15 @@ test("start", function() {
dy: 10
});
- ok(hash, 'start event triggered');
- ok(hash.helper, 'UI hash includes: helper');
- ok(hash.placeholder, 'UI hash includes: placeholder');
- ok(hash.item, 'UI hash includes: item');
- ok(!hash.sender, 'UI hash does not include: sender');
+ ok(hash, "start event triggered");
+ ok(hash.helper, "UI hash includes: helper");
+ ok(hash.placeholder, "UI hash includes: placeholder");
+ ok(hash.item, "UI hash includes: item");
+ ok(!hash.sender, "UI hash does not include: sender");
// todo: see if these events should actually have sane values in them
- ok('position' in hash, 'UI hash includes: position');
- ok('offset' in hash, 'UI hash includes: offset');
+ ok("position" in hash, "UI hash includes: position");
+ ok("offset" in hash, "UI hash includes: offset");
});
@@ -42,13 +42,13 @@ test("sort", function() {
dy: 10
});
- ok(hash, 'sort event triggered');
- ok(hash.helper, 'UI hash includes: helper');
- ok(hash.placeholder, 'UI hash includes: placeholder');
- 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.item, 'UI hash includes: item');
- ok(!hash.sender, 'UI hash does not include: sender');
+ ok(hash, "sort event triggered");
+ ok(hash.helper, "UI hash includes: helper");
+ ok(hash.placeholder, "UI hash includes: placeholder");
+ 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.item, "UI hash includes: item");
+ ok(!hash.sender, "UI hash does not include: sender");
});
@@ -65,7 +65,7 @@ test("change", function() {
dy: 1
});
- ok(!hash, '1px drag, change event should not be triggered');
+ ok(!hash, "1px drag, change event should not be triggered");
$("#sortable").sortable({
change: function( e, ui ) {
@@ -75,13 +75,13 @@ test("change", function() {
dy: 22
});
- ok(hash, 'change event triggered');
- ok(hash.helper, 'UI hash includes: helper');
- ok(hash.placeholder, 'UI hash includes: placeholder');
- 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.item, 'UI hash includes: item');
- ok(!hash.sender, 'UI hash does not include: sender');
+ ok(hash, "change event triggered");
+ ok(hash.helper, "UI hash includes: helper");
+ ok(hash.placeholder, "UI hash includes: placeholder");
+ 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.item, "UI hash includes: item");
+ ok(!hash.sender, "UI hash does not include: sender");
});
@@ -97,13 +97,13 @@ test("beforeStop", function() {
dy: 20
});
- ok(hash, 'beforeStop event triggered');
- ok(hash.helper, 'UI hash includes: helper');
- ok(hash.placeholder, 'UI hash includes: placeholder');
- 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.item, 'UI hash includes: item');
- ok(!hash.sender, 'UI hash does not include: sender');
+ ok(hash, "beforeStop event triggered");
+ ok(hash.helper, "UI hash includes: helper");
+ ok(hash.placeholder, "UI hash includes: placeholder");
+ 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.item, "UI hash includes: item");
+ ok(!hash.sender, "UI hash does not include: sender");
});
@@ -119,13 +119,13 @@ test("stop", function() {
dy: 20
});
- ok(hash, 'stop event triggered');
- ok(!hash.helper, 'UI should not include: helper');
- ok(hash.placeholder, 'UI hash includes: placeholder');
- 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.item, 'UI hash includes: item');
- ok(!hash.sender, 'UI hash does not include: sender');
+ ok(hash, "stop event triggered");
+ ok(!hash.helper, "UI should not include: helper");
+ ok(hash.placeholder, "UI hash includes: placeholder");
+ 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.item, "UI hash includes: item");
+ ok(!hash.sender, "UI hash does not include: sender");
});
@@ -142,7 +142,7 @@ test("update", function() {
dy: 1
});
- ok(!hash, '1px drag, update event should not be triggered');
+ ok(!hash, "1px drag, update event should not be triggered");
$("#sortable").sortable({
update: function( e, ui ) {
@@ -152,13 +152,13 @@ test("update", function() {
dy: 22
});
- ok(hash, 'update event triggered');
- ok(!hash.helper, 'UI hash should not include: helper');
- ok(hash.placeholder, 'UI hash includes: placeholder');
- 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.item, 'UI hash includes: item');
- ok(!hash.sender, 'UI hash does not include: sender');
+ ok(hash, "update event triggered");
+ ok(!hash.helper, "UI hash should not include: helper");
+ ok(hash.placeholder, "UI hash includes: placeholder");
+ 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.item, "UI hash includes: item");
+ 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");
});
-test('#4752: link event firing on sortable with connect list', function () {
+test("#4752: link event firing on sortable with connect list", function () {
expect( 10 );
var fired = {},
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({
- connectWith: '#qunit-fixture ul',
+ $("#qunit-fixture ul").sortable({
+ connectWith: "#qunit-fixture ul",
change: function () {
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;
});
- $('#sortable li:eq(0)').simulate('click');
- ok(!hasFired('change'), 'Click only, change event should not have fired');
- ok(hasFired('click'), 'Click event should have fired');
+ $("#sortable li:eq(0)").simulate("click");
+ ok(!hasFired("change"), "Click only, change event should not have fired");
+ ok(hasFired("click"), "Click event should have fired");
// Drag an item within the first list
fired = {};
- $('#sortable li:eq(0)').simulate('drag', { dx: 0, dy: 40 });
- ok(hasFired('change'), '40px drag, change event should have fired');
- ok(!hasFired('receive'), 'Receive event should not have fired');
- ok(!hasFired('remove'), 'Remove event should not have fired');
- ok(!hasFired('click'), 'Click event should not have fired');
+ $("#sortable li:eq(0)").simulate("drag", { dx: 0, dy: 40 });
+ ok(hasFired("change"), "40px drag, change event should have fired");
+ ok(!hasFired("receive"), "Receive event should not have fired");
+ ok(!hasFired("remove"), "Remove 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
fired = {};
- $('#sortable li:eq(0)').simulate('drag', { dx: 0, dy: 150 });
- ok(hasFired('change'), '150px drag, change event should have fired');
- ok(hasFired('receive'), 'Receive event should have fired');
- ok(hasFired('remove'), 'Remove event should have fired');
- ok(!hasFired('click'), 'Click event should not have fired');
+ $("#sortable li:eq(0)").simulate("drag", { dx: 0, dy: 150 });
+ ok(hasFired("change"), "150px drag, change event should have fired");
+ ok(hasFired("receive"), "Receive event should have fired");
+ ok(hasFired("remove"), "Remove event should have fired");
+ ok(!hasFired("click"), "Click event should not have fired");
});
/*
diff --git a/tests/unit/sortable/sortable_methods.js b/tests/unit/sortable/sortable_methods.js
index de32e2f5d..07a7bc77d 100644
--- a/tests/unit/sortable/sortable_methods.js
+++ b/tests/unit/sortable/sortable_methods.js
@@ -8,36 +8,36 @@ module("sortable: methods");
test("init", function() {
expect(5);
- $("
").appendTo('body').sortable().remove();
- ok(true, '.sortable() called on element');
+ $("
").appendTo("body").sortable().remove();
+ ok(true, ".sortable() called on element");
$([]).sortable();
- ok(true, '.sortable() called on empty collection');
+ ok(true, ".sortable() called on empty collection");
$("
").sortable();
- ok(true, '.sortable() called on disconnected DOMElement');
+ ok(true, ".sortable() called on disconnected DOMElement");
$("
").sortable().sortable("option", "foo");
- ok(true, 'arbitrary option getter after init');
+ ok(true, "arbitrary option getter after init");
$("
").sortable().sortable("option", "foo", "bar");
- ok(true, 'arbitrary option setter after init');
+ ok(true, "arbitrary option setter after init");
});
test("destroy", function() {
expect(4);
- $("
").appendTo('body').sortable().sortable("destroy").remove();
- ok(true, '.sortable("destroy") called on element');
+ $("
").appendTo("body").sortable().sortable("destroy").remove();
+ ok(true, ".sortable('destroy') called on element");
$([]).sortable().sortable("destroy");
- ok(true, '.sortable("destroy") called on empty collection');
+ ok(true, ".sortable('destroy') called on empty collection");
$("
").sortable().sortable("destroy");
- ok(true, '.sortable("destroy") called on disconnected DOMElement');
+ ok(true, ".sortable('destroy') called on disconnected DOMElement");
- var expected = $('
').sortable(),
- actual = expected.sortable('destroy');
- equal(actual, expected, 'destroy is chainable');
+ var expected = $("
").sortable(),
+ actual = expected.sortable("destroy");
+ equal(actual, expected, "destroy is chainable");
});
test("enable", function() {
@@ -47,7 +47,7 @@ test("enable", function() {
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");
equal(el.sortable("option", "disabled"), false, "disabled option getter");
@@ -57,11 +57,11 @@ test("enable", function() {
el.sortable("option", "disabled", false);
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 = $('
').sortable(),
- actual = expected.sortable('enable');
- equal(actual, expected, 'enable is chainable');
+ expected = $("
").sortable(),
+ actual = expected.sortable("enable");
+ equal(actual, expected, "enable is chainable");
});
test("disable", function() {
@@ -70,23 +70,23 @@ test("disable", function() {
var el, actual, expected;
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");
- 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({ 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);
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");
- 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 = $('
').sortable(),
- actual = expected.sortable('disable');
- equal(actual, expected, 'disable is chainable');
+ expected = $("
").sortable(),
+ actual = expected.sortable("disable");
+ equal(actual, expected, "disable is chainable");
});
})(jQuery);
diff --git a/tests/unit/spinner/spinner_events.js b/tests/unit/spinner/spinner_events.js
index 1ee0d17a5..610f7a2ec 100644
--- a/tests/unit/spinner/spinner_events.js
+++ b/tests/unit/spinner/spinner_events.js
@@ -5,7 +5,7 @@ var simulateKeyDownUp = TestHelpers.spinner.simulateKeyDownUp;
module( "spinner: events" );
test( "start", function() {
- expect( 6 );
+ expect( 10 );
var element = $( "#spin" ).spinner();
function shouldStart( expectation, msg ) {
@@ -29,14 +29,14 @@ test( "start", function() {
shouldStart( true, "button down" );
element.spinner( "widget" ).find( ".ui-spinner-down" ).mousedown().mouseup();
- shouldStart( false, "stepUp" );
+ shouldStart( true, "stepUp" );
element.spinner( "stepUp" );
- shouldStart( false, "stepDown" );
+ shouldStart( true, "stepDown" );
element.spinner( "stepDown" );
- shouldStart( false, "pageUp" );
+ shouldStart( true, "pageUp" );
element.spinner( "pageUp" );
- shouldStart( false, "pageDown" );
+ shouldStart( true, "pageDown" );
element.spinner( "pageDown" );
shouldStart( false, "value" );
@@ -44,7 +44,7 @@ test( "start", function() {
});
test( "spin", function() {
- expect( 6 );
+ expect( 10 );
var element = $( "#spin" ).spinner();
function shouldSpin( expectation, msg ) {
@@ -68,14 +68,14 @@ test( "spin", function() {
shouldSpin( true, "button down" );
element.spinner( "widget" ).find( ".ui-spinner-down" ).mousedown().mouseup();
- shouldSpin( false, "stepUp" );
+ shouldSpin( true, "stepUp" );
element.spinner( "stepUp" );
- shouldSpin( false, "stepDown" );
+ shouldSpin( true, "stepDown" );
element.spinner( "stepDown" );
- shouldSpin( false, "pageUp" );
+ shouldSpin( true, "pageUp" );
element.spinner( "pageUp" );
- shouldSpin( false, "pageDown" );
+ shouldSpin( true, "pageDown" );
element.spinner( "pageDown" );
shouldSpin( false, "value" );
@@ -83,7 +83,7 @@ test( "spin", function() {
});
test( "stop", function() {
- expect( 6 );
+ expect( 10 );
var element = $( "#spin" ).spinner();
function shouldStop( expectation, msg ) {
@@ -107,14 +107,14 @@ test( "stop", function() {
shouldStop( true, "button down" );
element.spinner( "widget" ).find( ".ui-spinner-down" ).mousedown().mouseup();
- shouldStop( false, "stepUp" );
+ shouldStop( true, "stepUp" );
element.spinner( "stepUp" );
- shouldStop( false, "stepDown" );
+ shouldStop( true, "stepDown" );
element.spinner( "stepDown" );
- shouldStop( false, "pageUp" );
+ shouldStop( true, "pageUp" );
element.spinner( "pageUp" );
- shouldStop( false, "pageDown" );
+ shouldStop( true, "pageDown" );
element.spinner( "pageDown" );
shouldStop( false, "value" );
diff --git a/tests/unit/spinner/spinner_options.js b/tests/unit/spinner/spinner_options.js
index 284e03a3e..6f3650f92 100644
--- a/tests/unit/spinner/spinner_options.js
+++ b/tests/unit/spinner/spinner_options.js
@@ -5,10 +5,17 @@ module( "spinner: options" );
// culture is tested after numberFormat, since it depends on numberFormat
test( "icons: default ", function() {
- expect( 2 );
- var element = $( "#spin" ).val( 0 ).spinner().spinner( "widget" );
- equal( element.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" );
+ expect( 4 );
+ var element = $( "#spin" ).val( 0 ).spinner();
+ equal( element.spinner( "widget" ).find( ".ui-icon:first" ).attr( "class" ), "ui-icon ui-icon-triangle-1-n" );
+ 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() {
diff --git a/themes/base/jquery.ui.theme.css b/themes/base/jquery.ui.theme.css
index 47aedb0d3..cd52fc786 100644
--- a/themes/base/jquery.ui.theme.css
+++ b/themes/base/jquery.ui.theme.css
@@ -393,14 +393,14 @@
/* Overlays */
.ui-widget-overlay {
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;filter:Alpha(Opacity=30)/*{opacityOverlay}*/;
+ opacity: .3/*{opacityOverlay}*/;
+ filter: Alpha(Opacity=30)/*{opacityFilterOverlay}*/;
}
.ui-widget-shadow {
margin: -8px/*{offsetTopShadow}*/ 0 0 -8px/*{offsetLeftShadow}*/;
padding: 8px/*{thicknessShadow}*/;
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;filter:Alpha(Opacity=30)/*{opacityShadow}*/;
+ opacity: .3/*{opacityShadow}*/;
+ filter: Alpha(Opacity=30)/*{opacityFilterShadow}*/;
border-radius: 8px/*{cornerRadiusShadow}*/;
}
diff --git a/ui/.jshintrc b/ui/.jshintrc
index edf09721b..c7589525f 100644
--- a/ui/.jshintrc
+++ b/ui/.jshintrc
@@ -8,6 +8,7 @@
"latedef": true,
"noarg": true,
"onevar": true,
+ "quotmark": "double",
"trailing": true,
"undef": true,
"unused": true,
diff --git a/ui/jquery.ui.core.js b/ui/jquery.ui.core.js
index 694cb1bef..b5a4fd756 100644
--- a/ui/jquery.ui.core.js
+++ b/ui/jquery.ui.core.js
@@ -69,17 +69,17 @@ $.fn.extend({
scrollParent: function() {
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() {
- 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);
} else {
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);
}
- return (/fixed/).test(this.css('position')) || !scrollParent.length ? $(document) : scrollParent;
+ return (/fixed/).test(this.css("position")) || !scrollParent.length ? $(document) : scrollParent;
},
zIndex: function( zIndex ) {
diff --git a/ui/jquery.ui.datepicker.js b/ui/jquery.ui.datepicker.js
index e3a9286dd..6f187ecaa 100644
--- a/ui/jquery.ui.datepicker.js
+++ b/ui/jquery.ui.datepicker.js
@@ -15,7 +15,7 @@
$.extend($.ui, { datepicker: { version: "@VERSION" } });
-var PROP_NAME = 'datepicker',
+var PROP_NAME = "datepicker",
dpuuid = new Date().getTime(),
instActive;
@@ -30,44 +30,44 @@ function Datepicker() {
this._disabledInputs = []; // List of date picker inputs that have been disabled
this._datepickerShowing = false; // True if the popup picker is showing , false if not
this._inDialog = false; // True if showing within a "dialog", false if not
- this._mainDivId = 'ui-datepicker-div'; // The ID of the main datepicker division
- this._inlineClass = 'ui-datepicker-inline'; // The name of the inline marker class
- this._appendClass = 'ui-datepicker-append'; // The name of the append marker class
- this._triggerClass = 'ui-datepicker-trigger'; // The name of the trigger marker class
- this._dialogClass = 'ui-datepicker-dialog'; // The name of the dialog marker class
- this._disableClass = 'ui-datepicker-disabled'; // The name of the disabled covering marker class
- this._unselectableClass = 'ui-datepicker-unselectable'; // The name of the unselectable cell marker class
- this._currentClass = 'ui-datepicker-current-day'; // The name of the current day marker class
- this._dayOverClass = 'ui-datepicker-days-cell-over'; // The name of the day hover marker class
+ this._mainDivId = "ui-datepicker-div"; // The ID of the main datepicker division
+ this._inlineClass = "ui-datepicker-inline"; // The name of the inline marker class
+ this._appendClass = "ui-datepicker-append"; // The name of the append marker class
+ this._triggerClass = "ui-datepicker-trigger"; // The name of the trigger marker class
+ this._dialogClass = "ui-datepicker-dialog"; // The name of the dialog marker class
+ this._disableClass = "ui-datepicker-disabled"; // The name of the disabled covering marker class
+ this._unselectableClass = "ui-datepicker-unselectable"; // The name of the unselectable cell marker class
+ this._currentClass = "ui-datepicker-current-day"; // The name of the current day marker class
+ this._dayOverClass = "ui-datepicker-days-cell-over"; // The name of the day hover marker class
this.regional = []; // Available regional settings, indexed by language code
- this.regional[''] = { // Default regional settings
- closeText: 'Done', // Display text for close link
- prevText: 'Prev', // Display text for previous month link
- nextText: 'Next', // Display text for next month link
- currentText: 'Today', // Display text for current month link
- monthNames: ['January','February','March','April','May','June',
- 'July','August','September','October','November','December'], // Names of months for drop-down and formatting
- monthNamesShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], // For formatting
- dayNames: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], // For formatting
- dayNamesShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], // For formatting
- dayNamesMin: ['Su','Mo','Tu','We','Th','Fr','Sa'], // Column headings for days starting at Sunday
- weekHeader: 'Wk', // Column header for week of the year
- dateFormat: 'mm/dd/yy', // See format options on parseDate
+ this.regional[""] = { // Default regional settings
+ closeText: "Done", // Display text for close link
+ prevText: "Prev", // Display text for previous month link
+ nextText: "Next", // Display text for next month link
+ currentText: "Today", // Display text for current month link
+ monthNames: ["January","February","March","April","May","June",
+ "July","August","September","October","November","December"], // Names of months for drop-down and formatting
+ monthNamesShort: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], // For formatting
+ dayNames: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], // For formatting
+ dayNamesShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], // For formatting
+ dayNamesMin: ["Su","Mo","Tu","We","Th","Fr","Sa"], // Column headings for days starting at Sunday
+ weekHeader: "Wk", // Column header for week of the year
+ dateFormat: "mm/dd/yy", // See format options on parseDate
firstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...
isRTL: false, // True if right-to-left language, false if left-to-right
showMonthAfterYear: false, // True if the year select precedes month, false for month then year
- yearSuffix: '' // Additional text to append to the year in the month headers
+ yearSuffix: "" // Additional text to append to the year in the month headers
};
this._defaults = { // Global defaults for all the date picker instances
- showOn: 'focus', // 'focus' for popup on focus,
- // 'button' for trigger button, or 'both' for either
- showAnim: 'fadeIn', // Name of jQuery animation for popup
+ showOn: "focus", // "focus" for popup on focus,
+ // "button" for trigger button, or "both" for either
+ showAnim: "fadeIn", // Name of jQuery animation for popup
showOptions: {}, // Options for enhanced animations
defaultDate: null, // Used when field is blank: actual date,
// +/-number for offset from today, null for today
- appendText: '', // Display text following the input box, e.g. showing the format
- buttonText: '...', // Text for trigger button
- buttonImage: '', // URL for trigger button image
+ appendText: "", // Display text following the input box, e.g. showing the format
+ buttonText: "...", // Text for trigger button
+ buttonImage: "", // URL for trigger button image
buttonImageOnly: false, // True if the image appears alone, false if it appears on a button
hideIfNoPrevNext: false, // True to hide next/previous month links
// if not applicable, false to just disable them
@@ -75,7 +75,7 @@ function Datepicker() {
gotoCurrent: false, // True if today link goes back to current selection instead
changeMonth: false, // True if month can be selected directly, false if only prev/next
changeYear: false, // True if year can be selected directly, false if only prev/next
- yearRange: 'c-10:c+10', // Range of years to display in drop-down,
+ yearRange: "c-10:c+10", // Range of years to display in drop-down,
// either relative to today's year (-nn:+nn), relative to currently displayed year
// (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)
showOtherMonths: false, // True to show dates in other months, false to leave blank
@@ -83,14 +83,14 @@ function Datepicker() {
showWeek: false, // True to show week of the year, false to not show it
calculateWeek: this.iso8601Week, // How to calculate the week of the year,
// takes a Date and returns the number of the week for it
- shortYearCutoff: '+10', // Short year values < this are in the current century,
+ shortYearCutoff: "+10", // Short year values < this are in the current century,
// > this are in the previous century,
- // string value starting with '+' for current year + value
+ // string value starting with "+" for current year + value
minDate: null, // The earliest selectable date, or null for no limit
maxDate: null, // The latest selectable date, or null for no limit
- duration: 'fast', // Duration of display/closure
+ duration: "fast", // Duration of display/closure
beforeShowDay: null, // Function that takes a date and returns an array with
- // [0] = true if selectable, false if not, [1] = custom CSS class name(s) or '',
+ // [0] = true if selectable, false if not, [1] = custom CSS class name(s) or "",
// [2] = cell title (optional), e.g. $.datepicker.noWeekends
beforeShow: null, // Function that takes an input field and
// returns a set of custom settings for the date picker
@@ -101,20 +101,20 @@ function Datepicker() {
showCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)
stepMonths: 1, // Number of months to step back/forward
stepBigMonths: 12, // Number of months to step back/forward for the big links
- altField: '', // Selector for an alternate field to store selected dates into
- altFormat: '', // The date format to use for the alternate field
+ altField: "", // Selector for an alternate field to store selected dates into
+ altFormat: "", // The date format to use for the alternate field
constrainInput: true, // The input is constrained by the current date format
showButtonPanel: false, // True to show button panel, false to not show it
autoSize: false, // True to size the input for the date format, false to leave as is
disabled: false // The initial disabled state
};
- $.extend(this._defaults, this.regional['']);
- this.dpDiv = bindHover($('
'));
+ $.extend(this._defaults, this.regional[""]);
+ this.dpDiv = bindHover($("
"));
}
$.extend(Datepicker.prototype, {
/* Class name added to elements to indicate already configured with a date picker. */
- markerClassName: 'hasDatepicker',
+ markerClassName: "hasDatepicker",
//Keep track of the maximum number of rows displayed (see #7043)
maxRows: 4,
@@ -140,14 +140,14 @@ $.extend(Datepicker.prototype, {
_attachDatepicker: function(target, settings) {
var nodeName, inline, inst;
nodeName = target.nodeName.toLowerCase();
- inline = (nodeName === 'div' || nodeName === 'span');
+ inline = (nodeName === "div" || nodeName === "span");
if (!target.id) {
this.uuid += 1;
- target.id = 'dp' + this.uuid;
+ target.id = "dp" + this.uuid;
}
inst = this._newInst($(target), inline);
inst.settings = $.extend({}, settings || {});
- if (nodeName === 'input') {
+ if (nodeName === "input") {
this._connectDatepicker(target, inst);
} else if (inline) {
this._inlineDatepicker(target, inst);
@@ -156,13 +156,13 @@ $.extend(Datepicker.prototype, {
/* Create a new instance object. */
_newInst: function(target, inline) {
- var id = target[0].id.replace(/([^A-Za-z0-9_\-])/g, '\\\\$1'); // escape jQuery meta chars
+ var id = target[0].id.replace(/([^A-Za-z0-9_\-])/g, "\\\\$1"); // escape jQuery meta chars
return {id: id, input: target, // associated target
selectedDay: 0, selectedMonth: 0, selectedYear: 0, // current selection
drawMonth: 0, drawYear: 0, // month being drawn
inline: inline, // is datepicker inline or not
dpDiv: (!inline ? this.dpDiv : // presentation div
- bindHover($('
')))};
+ bindHover($("
")))};
},
/* Attach the date picker to an input field. */
@@ -187,37 +187,37 @@ $.extend(Datepicker.prototype, {
/* Make attachments based on settings. */
_attachments: function(input, inst) {
var showOn, buttonText, buttonImage,
- appendText = this._get(inst, 'appendText'),
- isRTL = this._get(inst, 'isRTL');
+ appendText = this._get(inst, "appendText"),
+ isRTL = this._get(inst, "isRTL");
if (inst.append) {
inst.append.remove();
}
if (appendText) {
- inst.append = $('
' + appendText + ' ');
- input[isRTL ? 'before' : 'after'](inst.append);
+ inst.append = $("
" + appendText + " ");
+ input[isRTL ? "before" : "after"](inst.append);
}
- input.unbind('focus', this._showDatepicker);
+ input.unbind("focus", this._showDatepicker);
if (inst.trigger) {
inst.trigger.remove();
}
- showOn = this._get(inst, 'showOn');
- if (showOn === 'focus' || showOn === 'both') { // pop-up date picker when in the marked field
+ showOn = this._get(inst, "showOn");
+ if (showOn === "focus" || showOn === "both") { // pop-up date picker when in the marked field
input.focus(this._showDatepicker);
}
- if (showOn === 'button' || showOn === 'both') { // pop-up date picker when button clicked
- buttonText = this._get(inst, 'buttonText');
- buttonImage = this._get(inst, 'buttonImage');
- inst.trigger = $(this._get(inst, 'buttonImageOnly') ?
- $('
').addClass(this._triggerClass).
+ if (showOn === "button" || showOn === "both") { // pop-up date picker when button clicked
+ buttonText = this._get(inst, "buttonText");
+ buttonImage = this._get(inst, "buttonImage");
+ inst.trigger = $(this._get(inst, "buttonImageOnly") ?
+ $("
").addClass(this._triggerClass).
attr({ src: buttonImage, alt: buttonText, title: buttonText }) :
- $('
').addClass(this._triggerClass).
- html(!buttonImage ? buttonText : $('
').attr(
+ $("
").addClass(this._triggerClass).
+ html(!buttonImage ? buttonText : $("
").attr(
{ src:buttonImage, alt:buttonText, title:buttonText })));
- input[isRTL ? 'before' : 'after'](inst.trigger);
+ input[isRTL ? "before" : "after"](inst.trigger);
inst.trigger.click(function() {
if ($.datepicker._datepickerShowing && $.datepicker._lastInput === input[0]) {
$.datepicker._hideDatepicker();
@@ -234,10 +234,10 @@ $.extend(Datepicker.prototype, {
/* Apply the maximum length for the date format. */
_autoSize: function(inst) {
- if (this._get(inst, 'autoSize') && !inst.inline) {
+ if (this._get(inst, "autoSize") && !inst.inline) {
var findMax, max, maxI, i,
date = new Date(2009, 12 - 1, 20), // Ensure double digits
- dateFormat = this._get(inst, 'dateFormat');
+ dateFormat = this._get(inst, "dateFormat");
if (dateFormat.match(/[DM]/)) {
findMax = function(names) {
@@ -252,11 +252,11 @@ $.extend(Datepicker.prototype, {
return maxI;
};
date.setMonth(findMax(this._get(inst, (dateFormat.match(/MM/) ?
- 'monthNames' : 'monthNamesShort'))));
+ "monthNames" : "monthNamesShort"))));
date.setDate(findMax(this._get(inst, (dateFormat.match(/DD/) ?
- 'dayNames' : 'dayNamesShort'))) + 20 - date.getDay());
+ "dayNames" : "dayNamesShort"))) + 20 - date.getDay());
}
- inst.input.attr('size', this._formatDate(inst, date).length);
+ inst.input.attr("size", this._formatDate(inst, date).length);
}
},
@@ -287,7 +287,7 @@ $.extend(Datepicker.prototype, {
* @param settings object - update the dialog date picker instance's settings (anonymous object)
* @param pos int[2] - coordinates for the dialog's position within the screen or
* event - with x/y coordinates or
- * leave empty for default (screen centre)
+ * leave empty for default (screen centre)
* @return the manager object
*/
_dialogDatepicker: function(input, date, onSelect, settings, pos) {
@@ -296,11 +296,11 @@ $.extend(Datepicker.prototype, {
if (!inst) {
this.uuid += 1;
- id = 'dp' + this.uuid;
- this._dialogInput = $('
');
+ id = "dp" + this.uuid;
+ this._dialogInput = $("
");
this._dialogInput.keydown(this._doKeyDown);
- $('body').append(this._dialogInput);
+ $("body").append(this._dialogInput);
inst = this._dialogInst = this._newInst(this._dialogInput, false);
inst.settings = {};
$.data(this._dialogInput[0], PROP_NAME, inst);
@@ -320,7 +320,7 @@ $.extend(Datepicker.prototype, {
}
// move input on screen for focus, but hidden behind dialog
- this._dialogInput.css('left', (this._pos[0] + 20) + 'px').css('top', this._pos[1] + 'px');
+ this._dialogInput.css("left", (this._pos[0] + 20) + "px").css("top", this._pos[1] + "px");
inst.settings.onSelect = onSelect;
this._inDialog = true;
this.dpDiv.addClass(this._dialogClass);
@@ -346,15 +346,15 @@ $.extend(Datepicker.prototype, {
nodeName = target.nodeName.toLowerCase();
$.removeData(target, PROP_NAME);
- if (nodeName === 'input') {
+ if (nodeName === "input") {
inst.append.remove();
inst.trigger.remove();
$target.removeClass(this.markerClassName).
- unbind('focus', this._showDatepicker).
- unbind('keydown', this._doKeyDown).
- unbind('keypress', this._doKeyPress).
- unbind('keyup', this._doKeyUp);
- } else if (nodeName === 'div' || nodeName === 'span') {
+ unbind("focus", this._showDatepicker).
+ unbind("keydown", this._doKeyDown).
+ unbind("keypress", this._doKeyPress).
+ unbind("keyup", this._doKeyUp);
+ } else if (nodeName === "div" || nodeName === "span") {
$target.removeClass(this.markerClassName).empty();
}
},
@@ -372,14 +372,14 @@ $.extend(Datepicker.prototype, {
}
nodeName = target.nodeName.toLowerCase();
- if (nodeName === 'input') {
+ if (nodeName === "input") {
target.disabled = false;
- inst.trigger.filter('button').
+ inst.trigger.filter("button").
each(function() { this.disabled = false; }).end().
- filter('img').css({opacity: '1.0', cursor: ''});
- } else if (nodeName === 'div' || nodeName === 'span') {
- inline = $target.children('.' + this._inlineClass);
- inline.children().removeClass('ui-state-disabled');
+ filter("img").css({opacity: "1.0", cursor: ""});
+ } else if (nodeName === "div" || nodeName === "span") {
+ inline = $target.children("." + this._inlineClass);
+ inline.children().removeClass("ui-state-disabled");
inline.find("select.ui-datepicker-month, select.ui-datepicker-year").
prop("disabled", false);
}
@@ -400,14 +400,14 @@ $.extend(Datepicker.prototype, {
}
nodeName = target.nodeName.toLowerCase();
- if (nodeName === 'input') {
+ if (nodeName === "input") {
target.disabled = true;
- inst.trigger.filter('button').
+ inst.trigger.filter("button").
each(function() { this.disabled = true; }).end().
- filter('img').css({opacity: '0.5', cursor: 'default'});
- } else if (nodeName === 'div' || nodeName === 'span') {
- inline = $target.children('.' + this._inlineClass);
- inline.children().addClass('ui-state-disabled');
+ filter("img").css({opacity: "0.5", cursor: "default"});
+ } else if (nodeName === "div" || nodeName === "span") {
+ inline = $target.children("." + this._inlineClass);
+ inline.children().addClass("ui-state-disabled");
inline.find("select.ui-datepicker-month, select.ui-datepicker-year").
prop("disabled", true);
}
@@ -442,7 +442,7 @@ $.extend(Datepicker.prototype, {
return $.data(target, PROP_NAME);
}
catch (err) {
- throw 'Missing instance data for this datepicker';
+ throw "Missing instance data for this datepicker";
}
},
@@ -450,8 +450,8 @@ $.extend(Datepicker.prototype, {
* @param target element - the target input field or division or span
* @param name object - the new settings to update or
* string - the name of the setting to change or retrieve,
- * when retrieving also 'all' for all instance settings or
- * 'defaults' for all global defaults
+ * when retrieving also "all" for all instance settings or
+ * "defaults" for all global defaults
* @param value any - the new value for the setting
* (omit if above is an object or to retrieve a value)
*/
@@ -459,14 +459,14 @@ $.extend(Datepicker.prototype, {
var settings, date, minDate, maxDate,
inst = this._getInst(target);
- if (arguments.length === 2 && typeof name === 'string') {
- return (name === 'defaults' ? $.extend({}, $.datepicker._defaults) :
- (inst ? (name === 'all' ? $.extend({}, inst.settings) :
+ if (arguments.length === 2 && typeof name === "string") {
+ return (name === "defaults" ? $.extend({}, $.datepicker._defaults) :
+ (inst ? (name === "all" ? $.extend({}, inst.settings) :
this._get(inst, name)) : null));
}
settings = name || {};
- if (typeof name === 'string') {
+ if (typeof name === "string") {
settings = {};
settings[name] = value;
}
@@ -477,8 +477,8 @@ $.extend(Datepicker.prototype, {
}
date = this._getDateDatepicker(target, true);
- minDate = this._getMinMaxDate(inst, 'min');
- maxDate = this._getMinMaxDate(inst, 'max');
+ minDate = this._getMinMaxDate(inst, "min");
+ maxDate = this._getMinMaxDate(inst, "max");
extendRemove(inst.settings, settings);
// reformat the old minDate/maxDate values if dateFormat changes and a new minDate/maxDate isn't provided
if (minDate !== null && settings.dateFormat !== undefined && settings.minDate === undefined) {
@@ -548,7 +548,7 @@ $.extend(Datepicker.prototype, {
var onSelect, dateStr, sel,
inst = $.datepicker._getInst(event.target),
handled = true,
- isRTL = inst.dpDiv.is('.ui-datepicker-rtl');
+ isRTL = inst.dpDiv.is(".ui-datepicker-rtl");
inst._keyEvent = true;
if ($.datepicker._datepickerShowing) {
@@ -556,13 +556,13 @@ $.extend(Datepicker.prototype, {
case 9: $.datepicker._hideDatepicker();
handled = false;
break; // hide on tab out
- case 13: sel = $('td.' + $.datepicker._dayOverClass + ':not(.' +
- $.datepicker._currentClass + ')', inst.dpDiv);
+ case 13: sel = $("td." + $.datepicker._dayOverClass + ":not(." +
+ $.datepicker._currentClass + ")", inst.dpDiv);
if (sel[0]) {
$.datepicker._selectDay(event.target, inst.selectedMonth, inst.selectedYear, sel[0]);
}
- onSelect = $.datepicker._get(inst, 'onSelect');
+ onSelect = $.datepicker._get(inst, "onSelect");
if (onSelect) {
dateStr = $.datepicker._formatDate(inst);
@@ -576,12 +576,12 @@ $.extend(Datepicker.prototype, {
case 27: $.datepicker._hideDatepicker();
break; // hide on escape
case 33: $.datepicker._adjustDate(event.target, (event.ctrlKey ?
- -$.datepicker._get(inst, 'stepBigMonths') :
- -$.datepicker._get(inst, 'stepMonths')), 'M');
+ -$.datepicker._get(inst, "stepBigMonths") :
+ -$.datepicker._get(inst, "stepMonths")), "M");
break; // previous month/year on page up/+ ctrl
case 34: $.datepicker._adjustDate(event.target, (event.ctrlKey ?
- +$.datepicker._get(inst, 'stepBigMonths') :
- +$.datepicker._get(inst, 'stepMonths')), 'M');
+ +$.datepicker._get(inst, "stepBigMonths") :
+ +$.datepicker._get(inst, "stepMonths")), "M");
break; // next month/year on page down/+ ctrl
case 35: if (event.ctrlKey || event.metaKey) {
$.datepicker._clearDate(event.target);
@@ -594,36 +594,36 @@ $.extend(Datepicker.prototype, {
handled = event.ctrlKey || event.metaKey;
break; // current on ctrl or command +home
case 37: if (event.ctrlKey || event.metaKey) {
- $.datepicker._adjustDate(event.target, (isRTL ? +1 : -1), 'D');
+ $.datepicker._adjustDate(event.target, (isRTL ? +1 : -1), "D");
}
handled = event.ctrlKey || event.metaKey;
// -1 day on ctrl or command +left
if (event.originalEvent.altKey) {
$.datepicker._adjustDate(event.target, (event.ctrlKey ?
- -$.datepicker._get(inst, 'stepBigMonths') :
- -$.datepicker._get(inst, 'stepMonths')), 'M');
+ -$.datepicker._get(inst, "stepBigMonths") :
+ -$.datepicker._get(inst, "stepMonths")), "M");
}
// next month/year on alt +left on Mac
break;
case 38: if (event.ctrlKey || event.metaKey) {
- $.datepicker._adjustDate(event.target, -7, 'D');
+ $.datepicker._adjustDate(event.target, -7, "D");
}
handled = event.ctrlKey || event.metaKey;
break; // -1 week on ctrl or command +up
case 39: if (event.ctrlKey || event.metaKey) {
- $.datepicker._adjustDate(event.target, (isRTL ? -1 : +1), 'D');
+ $.datepicker._adjustDate(event.target, (isRTL ? -1 : +1), "D");
}
handled = event.ctrlKey || event.metaKey;
// +1 day on ctrl or command +right
if (event.originalEvent.altKey) {
$.datepicker._adjustDate(event.target, (event.ctrlKey ?
- +$.datepicker._get(inst, 'stepBigMonths') :
- +$.datepicker._get(inst, 'stepMonths')), 'M');
+ +$.datepicker._get(inst, "stepBigMonths") :
+ +$.datepicker._get(inst, "stepMonths")), "M");
}
// next month/year on alt +right
break;
case 40: if (event.ctrlKey || event.metaKey) {
- $.datepicker._adjustDate(event.target, +7, 'D');
+ $.datepicker._adjustDate(event.target, +7, "D");
}
handled = event.ctrlKey || event.metaKey;
break; // +1 week on ctrl or command +down
@@ -646,10 +646,10 @@ $.extend(Datepicker.prototype, {
var chars, chr,
inst = $.datepicker._getInst(event.target);
- if ($.datepicker._get(inst, 'constrainInput')) {
- chars = $.datepicker._possibleChars($.datepicker._get(inst, 'dateFormat'));
+ if ($.datepicker._get(inst, "constrainInput")) {
+ chars = $.datepicker._possibleChars($.datepicker._get(inst, "dateFormat"));
chr = String.fromCharCode(event.charCode == null ? event.keyCode : event.charCode);
- return event.ctrlKey || event.metaKey || (chr < ' ' || !chars || chars.indexOf(chr) > -1);
+ return event.ctrlKey || event.metaKey || (chr < " " || !chars || chars.indexOf(chr) > -1);
}
},
@@ -660,7 +660,7 @@ $.extend(Datepicker.prototype, {
if (inst.input.val() !== inst.lastVal) {
try {
- date = $.datepicker.parseDate($.datepicker._get(inst, 'dateFormat'),
+ date = $.datepicker.parseDate($.datepicker._get(inst, "dateFormat"),
(inst.input ? inst.input.val() : null),
$.datepicker._getFormatConfig(inst));
@@ -683,8 +683,8 @@ $.extend(Datepicker.prototype, {
*/
_showDatepicker: function(input) {
input = input.target || input;
- if (input.nodeName.toLowerCase() !== 'input') { // find from button/image trigger
- input = $('input', input.parentNode)[0];
+ if (input.nodeName.toLowerCase() !== "input") { // find from button/image trigger
+ input = $("input", input.parentNode)[0];
}
if ($.datepicker._isDisabledDatepicker(input) || $.datepicker._lastInput === input) { // already here
@@ -702,7 +702,7 @@ $.extend(Datepicker.prototype, {
}
}
- beforeShow = $.datepicker._get(inst, 'beforeShow');
+ beforeShow = $.datepicker._get(inst, "beforeShow");
beforeShowSettings = beforeShow ? beforeShow.apply(input, [input, inst]) : {};
if(beforeShowSettings === false){
return;
@@ -714,7 +714,7 @@ $.extend(Datepicker.prototype, {
$.datepicker._setDateFromField(inst);
if ($.datepicker._inDialog) { // hide cursor
- input.value = '';
+ input.value = "";
}
if (!$.datepicker._pos) { // position below input
$.datepicker._pos = $.datepicker._findPos(input);
@@ -723,7 +723,7 @@ $.extend(Datepicker.prototype, {
isFixed = false;
$(input).parents().each(function() {
- isFixed |= $(this).css('position') === 'fixed';
+ isFixed |= $(this).css("position") === "fixed";
return !isFixed;
});
@@ -732,28 +732,28 @@ $.extend(Datepicker.prototype, {
//to avoid flashes on Firefox
inst.dpDiv.empty();
// determine sizing offscreen
- inst.dpDiv.css({position: 'absolute', display: 'block', top: '-1000px'});
+ inst.dpDiv.css({position: "absolute", display: "block", top: "-1000px"});
$.datepicker._updateDatepicker(inst);
// fix width for dynamic number of date pickers
// and adjust position before showing
offset = $.datepicker._checkOffset(inst, offset, isFixed);
inst.dpDiv.css({position: ($.datepicker._inDialog && $.blockUI ?
- 'static' : (isFixed ? 'fixed' : 'absolute')), display: 'none',
- left: offset.left + 'px', top: offset.top + 'px'});
+ "static" : (isFixed ? "fixed" : "absolute")), display: "none",
+ left: offset.left + "px", top: offset.top + "px"});
if (!inst.inline) {
- showAnim = $.datepicker._get(inst, 'showAnim');
- duration = $.datepicker._get(inst, 'duration');
+ showAnim = $.datepicker._get(inst, "showAnim");
+ duration = $.datepicker._get(inst, "duration");
inst.dpDiv.zIndex($(input).zIndex()+1);
$.datepicker._datepickerShowing = true;
if ( $.effects && $.effects.effect[ showAnim ] ) {
- inst.dpDiv.show(showAnim, $.datepicker._get(inst, 'showOptions'), duration);
+ inst.dpDiv.show(showAnim, $.datepicker._get(inst, "showOptions"), duration);
} else {
- inst.dpDiv[showAnim || 'show'](showAnim ? duration : null);
+ inst.dpDiv[showAnim || "show"](showAnim ? duration : null);
}
- if (inst.input.is(':visible') && !inst.input.is(':disabled')) {
+ if (inst.input.is(":visible") && !inst.input.is(":disabled")) {
inst.input.focus();
}
$.datepicker._curInst = inst;
@@ -766,26 +766,26 @@ $.extend(Datepicker.prototype, {
instActive = inst; // for delegate hover events
inst.dpDiv.empty().append(this._generateHTML(inst));
this._attachHandlers(inst);
- inst.dpDiv.find('.' + this._dayOverClass + ' a').mouseover();
+ inst.dpDiv.find("." + this._dayOverClass + " a").mouseover();
var origyearshtml,
numMonths = this._getNumberOfMonths(inst),
cols = numMonths[1],
width = 17;
- inst.dpDiv.removeClass('ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4').width('');
+ inst.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width("");
if (cols > 1) {
- inst.dpDiv.addClass('ui-datepicker-multi-' + cols).css('width', (width * cols) + 'em');
+ inst.dpDiv.addClass("ui-datepicker-multi-" + cols).css("width", (width * cols) + "em");
}
- inst.dpDiv[(numMonths[0] !== 1 || numMonths[1] !== 1 ? 'add' : 'remove') +
- 'Class']('ui-datepicker-multi');
- inst.dpDiv[(this._get(inst, 'isRTL') ? 'add' : 'remove') +
- 'Class']('ui-datepicker-rtl');
+ inst.dpDiv[(numMonths[0] !== 1 || numMonths[1] !== 1 ? "add" : "remove") +
+ "Class"]("ui-datepicker-multi");
+ inst.dpDiv[(this._get(inst, "isRTL") ? "add" : "remove") +
+ "Class"]("ui-datepicker-rtl");
// #6694 - don't focus the input if it's already focused
// this breaks the change event in IE
if (inst === $.datepicker._curInst && $.datepicker._datepickerShowing && inst.input &&
- inst.input.is(':visible') && !inst.input.is(':disabled') && inst.input[0] !== document.activeElement) {
+ inst.input.is(":visible") && !inst.input.is(":disabled") && inst.input[0] !== document.activeElement) {
inst.input.focus();
}
@@ -795,7 +795,7 @@ $.extend(Datepicker.prototype, {
setTimeout(function(){
//assure that inst.yearshtml didn't change.
if( origyearshtml === inst.yearshtml && inst.yearshtml ){
- inst.dpDiv.find('select.ui-datepicker-year:first').replaceWith(inst.yearshtml);
+ inst.dpDiv.find("select.ui-datepicker-year:first").replaceWith(inst.yearshtml);
}
origyearshtml = inst.yearshtml = null;
}, 0);
@@ -810,8 +810,8 @@ $.extend(Datepicker.prototype, {
var convert = function(value) {
return {thin: 1, medium: 2, thick: 3}[value] || value;
};
- return [parseFloat(convert(elem.css('border-left-width'))),
- parseFloat(convert(elem.css('border-top-width')))];
+ return [parseFloat(convert(elem.css("border-left-width"))),
+ parseFloat(convert(elem.css("border-top-width")))];
},
/* Check positioning to remain on screen. */
@@ -823,7 +823,7 @@ $.extend(Datepicker.prototype, {
viewWidth = document.documentElement.clientWidth + (isFixed ? 0 : $(document).scrollLeft()),
viewHeight = document.documentElement.clientHeight + (isFixed ? 0 : $(document).scrollTop());
- offset.left -= (this._get(inst, 'isRTL') ? (dpWidth - inputWidth) : 0);
+ offset.left -= (this._get(inst, "isRTL") ? (dpWidth - inputWidth) : 0);
offset.left -= (isFixed && offset.left === inst.input.offset().left) ? $(document).scrollLeft() : 0;
offset.top -= (isFixed && offset.top === (inst.input.offset().top + inputHeight)) ? $(document).scrollTop() : 0;
@@ -840,10 +840,10 @@ $.extend(Datepicker.prototype, {
_findPos: function(obj) {
var position,
inst = this._getInst(obj),
- isRTL = this._get(inst, 'isRTL');
+ isRTL = this._get(inst, "isRTL");
- while (obj && (obj.type === 'hidden' || obj.nodeType !== 1 || $.expr.filters.hidden(obj))) {
- obj = obj[isRTL ? 'previousSibling' : 'nextSibling'];
+ while (obj && (obj.type === "hidden" || obj.nodeType !== 1 || $.expr.filters.hidden(obj))) {
+ obj = obj[isRTL ? "previousSibling" : "nextSibling"];
}
position = $(obj).offset();
@@ -862,18 +862,18 @@ $.extend(Datepicker.prototype, {
}
if (this._datepickerShowing) {
- showAnim = this._get(inst, 'showAnim');
- duration = this._get(inst, 'duration');
+ showAnim = this._get(inst, "showAnim");
+ duration = this._get(inst, "duration");
postProcess = function() {
$.datepicker._tidyDialog(inst);
};
// DEPRECATED: after BC for 1.8.x $.effects[ showAnim ] is not needed
if ( $.effects && ( $.effects.effect[ showAnim ] || $.effects[ showAnim ] ) ) {
- inst.dpDiv.hide(showAnim, $.datepicker._get(inst, 'showOptions'), duration, postProcess);
+ inst.dpDiv.hide(showAnim, $.datepicker._get(inst, "showOptions"), duration, postProcess);
} else {
- inst.dpDiv[(showAnim === 'slideDown' ? 'slideUp' :
- (showAnim === 'fadeIn' ? 'fadeOut' : 'hide'))]((showAnim ? duration : null), postProcess);
+ inst.dpDiv[(showAnim === "slideDown" ? "slideUp" :
+ (showAnim === "fadeIn" ? "fadeOut" : "hide"))]((showAnim ? duration : null), postProcess);
}
if (!showAnim) {
@@ -881,17 +881,17 @@ $.extend(Datepicker.prototype, {
}
this._datepickerShowing = false;
- onClose = this._get(inst, 'onClose');
+ onClose = this._get(inst, "onClose");
if (onClose) {
- onClose.apply((inst.input ? inst.input[0] : null), [(inst.input ? inst.input.val() : ''), inst]);
+ onClose.apply((inst.input ? inst.input[0] : null), [(inst.input ? inst.input.val() : ""), inst]);
}
this._lastInput = null;
if (this._inDialog) {
- this._dialogInput.css({ position: 'absolute', left: '0', top: '-100px' });
+ this._dialogInput.css({ position: "absolute", left: "0", top: "-100px" });
if ($.blockUI) {
$.unblockUI();
- $('body').append(this.dpDiv);
+ $("body").append(this.dpDiv);
}
}
this._inDialog = false;
@@ -900,7 +900,7 @@ $.extend(Datepicker.prototype, {
/* Tidy up after a dialog display. */
_tidyDialog: function(inst) {
- inst.dpDiv.removeClass(this._dialogClass).unbind('.ui-datepicker-calendar');
+ inst.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar");
},
/* Close date picker if clicked elsewhere. */
@@ -913,7 +913,7 @@ $.extend(Datepicker.prototype, {
inst = $.datepicker._getInst($target[0]);
if ( ( ( $target[0].id !== $.datepicker._mainDivId &&
- $target.parents('#' + $.datepicker._mainDivId).length === 0 &&
+ $target.parents("#" + $.datepicker._mainDivId).length === 0 &&
!$target.hasClass($.datepicker.markerClassName) &&
!$target.closest("." + $.datepicker._triggerClass).length &&
$.datepicker._datepickerShowing && !($.datepicker._inDialog && $.blockUI) ) ) ||
@@ -931,7 +931,7 @@ $.extend(Datepicker.prototype, {
return;
}
this._adjustInstDate(inst, offset +
- (period === 'M' ? this._get(inst, 'showCurrentAtPos') : 0), // undo positioning
+ (period === "M" ? this._get(inst, "showCurrentAtPos") : 0), // undo positioning
period);
this._updateDatepicker(inst);
},
@@ -942,7 +942,7 @@ $.extend(Datepicker.prototype, {
target = $(id),
inst = this._getInst(target[0]);
- if (this._get(inst, 'gotoCurrent') && inst.currentDay) {
+ if (this._get(inst, "gotoCurrent") && inst.currentDay) {
inst.selectedDay = inst.currentDay;
inst.drawMonth = inst.selectedMonth = inst.currentMonth;
inst.drawYear = inst.selectedYear = inst.currentYear;
@@ -961,8 +961,8 @@ $.extend(Datepicker.prototype, {
var target = $(id),
inst = this._getInst(target[0]);
- inst['selected' + (period === 'M' ? 'Month' : 'Year')] =
- inst['draw' + (period === 'M' ? 'Month' : 'Year')] =
+ inst["selected" + (period === "M" ? "Month" : "Year")] =
+ inst["draw" + (period === "M" ? "Month" : "Year")] =
parseInt(select.options[select.selectedIndex].value,10);
this._notifyChange(inst);
@@ -979,7 +979,7 @@ $.extend(Datepicker.prototype, {
}
inst = this._getInst(target[0]);
- inst.selectedDay = inst.currentDay = $('a', td).html();
+ inst.selectedDay = inst.currentDay = $("a", td).html();
inst.selectedMonth = inst.currentMonth = month;
inst.selectedYear = inst.currentYear = year;
this._selectDate(id, this._formatDate(inst,
@@ -989,7 +989,7 @@ $.extend(Datepicker.prototype, {
/* Erase the input field and hide the date picker. */
_clearDate: function(id) {
var target = $(id);
- this._selectDate(target, '');
+ this._selectDate(target, "");
},
/* Update the input field with the selected date. */
@@ -1004,11 +1004,11 @@ $.extend(Datepicker.prototype, {
}
this._updateAlternate(inst);
- onSelect = this._get(inst, 'onSelect');
+ onSelect = this._get(inst, "onSelect");
if (onSelect) {
onSelect.apply((inst.input ? inst.input[0] : null), [dateStr, inst]); // trigger custom callback
} else if (inst.input) {
- inst.input.trigger('change'); // fire the change event
+ inst.input.trigger("change"); // fire the change event
}
if (inst.inline){
@@ -1016,7 +1016,7 @@ $.extend(Datepicker.prototype, {
} else {
this._hideDatepicker();
this._lastInput = inst.input[0];
- if (typeof(inst.input[0]) !== 'object') {
+ if (typeof(inst.input[0]) !== "object") {
inst.input.focus(); // restore focus
}
this._lastInput = null;
@@ -1026,10 +1026,10 @@ $.extend(Datepicker.prototype, {
/* Update any alternate field to synchronise with the main field. */
_updateAlternate: function(inst) {
var altFormat, date, dateStr,
- altField = this._get(inst, 'altField');
+ altField = this._get(inst, "altField");
if (altField) { // update alternate field too
- altFormat = this._get(inst, 'altFormat') || this._get(inst, 'dateFormat');
+ altFormat = this._get(inst, "altFormat") || this._get(inst, "dateFormat");
date = this._getDate(inst);
dateStr = this.formatDate(altFormat, date, this._getFormatConfig(inst));
$(altField).each(function() { $(this).val(dateStr); });
@@ -1042,7 +1042,7 @@ $.extend(Datepicker.prototype, {
*/
noWeekends: function(date) {
var day = date.getDay();
- return [(day > 0 && day < 6), ''];
+ return [(day > 0 && day < 6), ""];
},
/* Set as calculateWeek to determine the week of the year based on the ISO 8601 definition.
@@ -1077,18 +1077,18 @@ $.extend(Datepicker.prototype, {
*/
parseDate: function (format, value, settings) {
if (format == null || value == null) {
- throw 'Invalid arguments';
+ throw "Invalid arguments";
}
- value = (typeof value === 'object' ? value.toString() : value + '');
- if (value === '') {
+ value = (typeof value === "object" ? value.toString() : value + "");
+ if (value === "") {
return null;
}
var iFormat, dim, extra,
iValue = 0,
shortYearCutoffTemp = (settings ? settings.shortYearCutoff : null) || this._defaults.shortYearCutoff,
- shortYearCutoff = (typeof shortYearCutoffTemp !== 'string' ? shortYearCutoffTemp :
+ shortYearCutoff = (typeof shortYearCutoffTemp !== "string" ? shortYearCutoffTemp :
new Date().getFullYear() % 100 + parseInt(shortYearCutoffTemp, 10)),
dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort,
dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames,
@@ -1111,12 +1111,12 @@ $.extend(Datepicker.prototype, {
// Extract a number from the string value
getNumber = function(match) {
var isDoubled = lookAhead(match),
- size = (match === '@' ? 14 : (match === '!' ? 20 :
- (match === 'y' && isDoubled ? 4 : (match === 'o' ? 3 : 2)))),
- digits = new RegExp('^\\d{1,' + size + '}'),
+ size = (match === "@" ? 14 : (match === "!" ? 20 :
+ (match === "y" && isDoubled ? 4 : (match === "o" ? 3 : 2)))),
+ digits = new RegExp("^\\d{1," + size + "}"),
num = value.substring(iValue).match(digits);
if (!num) {
- throw 'Missing number at position ' + iValue;
+ throw "Missing number at position " + iValue;
}
iValue += num[0].length;
return parseInt(num[0], 10);
@@ -1141,13 +1141,13 @@ $.extend(Datepicker.prototype, {
if (index !== -1) {
return index + 1;
} else {
- throw 'Unknown name at position ' + iValue;
+ throw "Unknown name at position " + iValue;
}
},
// Confirm that a literal character matches the string value
checkLiteral = function() {
if (value.charAt(iValue) !== format.charAt(iFormat)) {
- throw 'Unexpected literal at position ' + iValue;
+ throw "Unexpected literal at position " + iValue;
}
iValue++;
};
@@ -1161,32 +1161,32 @@ $.extend(Datepicker.prototype, {
}
} else {
switch (format.charAt(iFormat)) {
- case 'd':
- day = getNumber('d');
+ case "d":
+ day = getNumber("d");
break;
- case 'D':
- getName('D', dayNamesShort, dayNames);
+ case "D":
+ getName("D", dayNamesShort, dayNames);
break;
- case 'o':
- doy = getNumber('o');
+ case "o":
+ doy = getNumber("o");
break;
- case 'm':
- month = getNumber('m');
+ case "m":
+ month = getNumber("m");
break;
- case 'M':
- month = getName('M', monthNamesShort, monthNames);
+ case "M":
+ month = getName("M", monthNamesShort, monthNames);
break;
- case 'y':
- year = getNumber('y');
+ case "y":
+ year = getNumber("y");
break;
- case '@':
- date = new Date(getNumber('@'));
+ case "@":
+ date = new Date(getNumber("@"));
year = date.getFullYear();
month = date.getMonth() + 1;
day = date.getDate();
break;
- case '!':
- date = new Date((getNumber('!') - this._ticksTo1970) / 10000);
+ case "!":
+ date = new Date((getNumber("!") - this._ticksTo1970) / 10000);
year = date.getFullYear();
month = date.getMonth() + 1;
day = date.getDate();
@@ -1233,24 +1233,24 @@ $.extend(Datepicker.prototype, {
date = this._daylightSavingAdjust(new Date(year, month - 1, day));
if (date.getFullYear() !== year || date.getMonth() + 1 !== month || date.getDate() !== day) {
- throw 'Invalid date'; // E.g. 31/02/00
+ throw "Invalid date"; // E.g. 31/02/00
}
return date;
},
/* Standard date formats. */
- ATOM: 'yy-mm-dd', // RFC 3339 (ISO 8601)
- COOKIE: 'D, dd M yy',
- ISO_8601: 'yy-mm-dd',
- RFC_822: 'D, d M y',
- RFC_850: 'DD, dd-M-y',
- RFC_1036: 'D, d M y',
- RFC_1123: 'D, d M yy',
- RFC_2822: 'D, d M yy',
- RSS: 'D, d M y', // RFC 822
- TICKS: '!',
- TIMESTAMP: '@',
- W3C: 'yy-mm-dd', // ISO 8601
+ ATOM: "yy-mm-dd", // RFC 3339 (ISO 8601)
+ COOKIE: "D, dd M yy",
+ ISO_8601: "yy-mm-dd",
+ RFC_822: "D, d M y",
+ RFC_850: "DD, dd-M-y",
+ RFC_1036: "D, d M y",
+ RFC_1123: "D, d M yy",
+ RFC_2822: "D, d M yy",
+ RSS: "D, d M y", // RFC 822
+ TICKS: "!",
+ TIMESTAMP: "@",
+ W3C: "yy-mm-dd", // ISO 8601
_ticksTo1970: (((1970 - 1) * 365 + Math.floor(1970 / 4) - Math.floor(1970 / 100) +
Math.floor(1970 / 400)) * 24 * 60 * 60 * 10000000),
@@ -1271,7 +1271,7 @@ $.extend(Datepicker.prototype, {
* yy - year (four digit)
* @ - Unix timestamp (ms since 01/01/1970)
* ! - Windows ticks (100ns since 01/01/0001)
- * '...' - literal text
+ * "..." - literal text
* '' - single quote
*
* @param format string - the desired format of the date
@@ -1285,7 +1285,7 @@ $.extend(Datepicker.prototype, {
*/
formatDate: function (format, date, settings) {
if (!date) {
- return '';
+ return "";
}
var iFormat,
@@ -1303,10 +1303,10 @@ $.extend(Datepicker.prototype, {
},
// Format a number, with leading zero if necessary
formatNumber = function(match, value, len) {
- var num = '' + value;
+ var num = "" + value;
if (lookAhead(match)) {
while (num.length < len) {
- num = '0' + num;
+ num = "0" + num;
}
}
return num;
@@ -1315,7 +1315,7 @@ $.extend(Datepicker.prototype, {
formatName = function(match, value, shortNames, longNames) {
return (lookAhead(match) ? longNames[value] : shortNames[value]);
},
- output = '',
+ output = "",
literal = false;
if (date) {
@@ -1328,30 +1328,30 @@ $.extend(Datepicker.prototype, {
}
} else {
switch (format.charAt(iFormat)) {
- case 'd':
- output += formatNumber('d', date.getDate(), 2);
+ case "d":
+ output += formatNumber("d", date.getDate(), 2);
break;
- case 'D':
- output += formatName('D', date.getDay(), dayNamesShort, dayNames);
+ case "D":
+ output += formatName("D", date.getDay(), dayNamesShort, dayNames);
break;
- case 'o':
- output += formatNumber('o',
+ case "o":
+ output += formatNumber("o",
Math.round((new Date(date.getFullYear(), date.getMonth(), date.getDate()).getTime() - new Date(date.getFullYear(), 0, 0).getTime()) / 86400000), 3);
break;
- case 'm':
- output += formatNumber('m', date.getMonth() + 1, 2);
+ case "m":
+ output += formatNumber("m", date.getMonth() + 1, 2);
break;
- case 'M':
- output += formatName('M', date.getMonth(), monthNamesShort, monthNames);
+ case "M":
+ output += formatName("M", date.getMonth(), monthNamesShort, monthNames);
break;
- case 'y':
- output += (lookAhead('y') ? date.getFullYear() :
- (date.getYear() % 100 < 10 ? '0' : '') + date.getYear() % 100);
+ case "y":
+ output += (lookAhead("y") ? date.getFullYear() :
+ (date.getYear() % 100 < 10 ? "0" : "") + date.getYear() % 100);
break;
- case '@':
+ case "@":
output += date.getTime();
break;
- case '!':
+ case "!":
output += date.getTime() * 10000 + this._ticksTo1970;
break;
case "'":
@@ -1373,7 +1373,7 @@ $.extend(Datepicker.prototype, {
/* Extract all possible characters from the date format. */
_possibleChars: function (format) {
var iFormat,
- chars = '',
+ chars = "",
literal = false,
// Check whether a format character is doubled
lookAhead = function(match) {
@@ -1393,10 +1393,10 @@ $.extend(Datepicker.prototype, {
}
} else {
switch (format.charAt(iFormat)) {
- case 'd': case 'm': case 'y': case '@':
- chars += '0123456789';
+ case "d": case "m": case "y": case "@":
+ chars += "0123456789";
break;
- case 'D': case 'M':
+ case "D": case "M":
return null; // Accept anything
case "'":
if (lookAhead("'")) {
@@ -1425,7 +1425,7 @@ $.extend(Datepicker.prototype, {
return;
}
- var dateFormat = this._get(inst, 'dateFormat'),
+ var dateFormat = this._get(inst, "dateFormat"),
dates = inst.lastVal = inst.input ? inst.input.val() : null,
defaultDate = this._getDefaultDate(inst),
date = defaultDate,
@@ -1434,7 +1434,7 @@ $.extend(Datepicker.prototype, {
try {
date = this.parseDate(dateFormat, dates, settings) || defaultDate;
} catch (event) {
- dates = (noDefault ? '' : dates);
+ dates = (noDefault ? "" : dates);
}
inst.selectedDay = date.getDate();
inst.drawMonth = inst.selectedMonth = date.getMonth();
@@ -1448,7 +1448,7 @@ $.extend(Datepicker.prototype, {
/* Retrieve the default date shown on opening. */
_getDefaultDate: function(inst) {
return this._restrictMinMax(inst,
- this._determineDate(inst, this._get(inst, 'defaultDate'), new Date()));
+ this._determineDate(inst, this._get(inst, "defaultDate"), new Date()));
},
/* A date may be specified as an exact value or a relative one. */
@@ -1460,7 +1460,7 @@ $.extend(Datepicker.prototype, {
},
offsetString = function(offset) {
try {
- return $.datepicker.parseDate($.datepicker._get(inst, 'dateFormat'),
+ return $.datepicker.parseDate($.datepicker._get(inst, "dateFormat"),
offset, $.datepicker._getFormatConfig(inst));
}
catch (e) {
@@ -1476,16 +1476,16 @@ $.extend(Datepicker.prototype, {
matches = pattern.exec(offset);
while (matches) {
- switch (matches[2] || 'd') {
- case 'd' : case 'D' :
+ switch (matches[2] || "d") {
+ case "d" : case "D" :
day += parseInt(matches[1],10); break;
- case 'w' : case 'W' :
+ case "w" : case "W" :
day += parseInt(matches[1],10) * 7; break;
- case 'm' : case 'M' :
+ case "m" : case "M" :
month += parseInt(matches[1],10);
day = Math.min(day, $.datepicker._getDaysInMonth(year, month));
break;
- case 'y': case 'Y' :
+ case "y": case "Y" :
year += parseInt(matches[1],10);
day = Math.min(day, $.datepicker._getDaysInMonth(year, month));
break;
@@ -1494,10 +1494,10 @@ $.extend(Datepicker.prototype, {
}
return new Date(year, month, day);
},
- newDate = (date == null || date === '' ? defaultDate : (typeof date === 'string' ? offsetString(date) :
- (typeof date === 'number' ? (isNaN(date) ? defaultDate : offsetNumeric(date)) : new Date(date.getTime()))));
+ newDate = (date == null || date === "" ? defaultDate : (typeof date === "string" ? offsetString(date) :
+ (typeof date === "number" ? (isNaN(date) ? defaultDate : offsetNumeric(date)) : new Date(date.getTime()))));
- newDate = (newDate && newDate.toString() === 'Invalid Date' ? defaultDate : newDate);
+ newDate = (newDate && newDate.toString() === "Invalid Date" ? defaultDate : newDate);
if (newDate) {
newDate.setHours(0);
newDate.setMinutes(0);
@@ -1537,13 +1537,13 @@ $.extend(Datepicker.prototype, {
}
this._adjustInstDate(inst);
if (inst.input) {
- inst.input.val(clear ? '' : this._formatDate(inst));
+ inst.input.val(clear ? "" : this._formatDate(inst));
}
},
/* Retrieve the date(s) directly. */
_getDate: function(inst) {
- var startDate = (!inst.currentYear || (inst.input && inst.input.val() === '') ? null :
+ var startDate = (!inst.currentYear || (inst.input && inst.input.val() === "") ? null :
this._daylightSavingAdjust(new Date(
inst.currentYear, inst.currentMonth, inst.currentDay)));
return startDate;
@@ -1553,36 +1553,36 @@ $.extend(Datepicker.prototype, {
* they work with static code transformers like Caja.
*/
_attachHandlers: function(inst) {
- var stepMonths = this._get(inst, 'stepMonths'),
- id = '#' + inst.id.replace( /\\\\/g, "\\" );
- inst.dpDiv.find('[data-handler]').map(function () {
+ var stepMonths = this._get(inst, "stepMonths"),
+ id = "#" + inst.id.replace( /\\\\/g, "\\" );
+ inst.dpDiv.find("[data-handler]").map(function () {
var handler = {
prev: function () {
- window['DP_jQuery_' + dpuuid].datepicker._adjustDate(id, -stepMonths, 'M');
+ window["DP_jQuery_" + dpuuid].datepicker._adjustDate(id, -stepMonths, "M");
},
next: function () {
- window['DP_jQuery_' + dpuuid].datepicker._adjustDate(id, +stepMonths, 'M');
+ window["DP_jQuery_" + dpuuid].datepicker._adjustDate(id, +stepMonths, "M");
},
hide: function () {
- window['DP_jQuery_' + dpuuid].datepicker._hideDatepicker();
+ window["DP_jQuery_" + dpuuid].datepicker._hideDatepicker();
},
today: function () {
- window['DP_jQuery_' + dpuuid].datepicker._gotoToday(id);
+ window["DP_jQuery_" + dpuuid].datepicker._gotoToday(id);
},
selectDay: function () {
- window['DP_jQuery_' + dpuuid].datepicker._selectDay(id, +this.getAttribute('data-month'), +this.getAttribute('data-year'), this);
+ window["DP_jQuery_" + dpuuid].datepicker._selectDay(id, +this.getAttribute("data-month"), +this.getAttribute("data-year"), this);
return false;
},
selectMonth: function () {
- window['DP_jQuery_' + dpuuid].datepicker._selectMonthYear(id, this, 'M');
+ window["DP_jQuery_" + dpuuid].datepicker._selectMonthYear(id, this, "M");
return false;
},
selectYear: function () {
- window['DP_jQuery_' + dpuuid].datepicker._selectMonthYear(id, this, 'Y');
+ window["DP_jQuery_" + dpuuid].datepicker._selectMonthYear(id, this, "Y");
return false;
}
};
- $(this).bind(this.getAttribute('data-event'), handler[this.getAttribute('data-handler')]);
+ $(this).bind(this.getAttribute("data-event"), handler[this.getAttribute("data-handler")]);
});
},
@@ -1597,18 +1597,18 @@ $.extend(Datepicker.prototype, {
tempDate = new Date(),
today = this._daylightSavingAdjust(
new Date(tempDate.getFullYear(), tempDate.getMonth(), tempDate.getDate())), // clear time
- isRTL = this._get(inst, 'isRTL'),
- showButtonPanel = this._get(inst, 'showButtonPanel'),
- hideIfNoPrevNext = this._get(inst, 'hideIfNoPrevNext'),
- navigationAsDateFormat = this._get(inst, 'navigationAsDateFormat'),
+ isRTL = this._get(inst, "isRTL"),
+ showButtonPanel = this._get(inst, "showButtonPanel"),
+ hideIfNoPrevNext = this._get(inst, "hideIfNoPrevNext"),
+ navigationAsDateFormat = this._get(inst, "navigationAsDateFormat"),
numMonths = this._getNumberOfMonths(inst),
- showCurrentAtPos = this._get(inst, 'showCurrentAtPos'),
- stepMonths = this._get(inst, 'stepMonths'),
+ showCurrentAtPos = this._get(inst, "showCurrentAtPos"),
+ stepMonths = this._get(inst, "stepMonths"),
isMultiMonth = (numMonths[0] !== 1 || numMonths[1] !== 1),
currentDate = this._daylightSavingAdjust((!inst.currentDay ? new Date(9999, 9, 9) :
new Date(inst.currentYear, inst.currentMonth, inst.currentDay))),
- minDate = this._getMinMaxDate(inst, 'min'),
- maxDate = this._getMinMaxDate(inst, 'max'),
+ minDate = this._getMinMaxDate(inst, "min"),
+ maxDate = this._getMinMaxDate(inst, "max"),
drawMonth = inst.drawMonth - showCurrentAtPos,
drawYear = inst.drawYear;
@@ -1631,86 +1631,86 @@ $.extend(Datepicker.prototype, {
inst.drawMonth = drawMonth;
inst.drawYear = drawYear;
- prevText = this._get(inst, 'prevText');
+ prevText = this._get(inst, "prevText");
prevText = (!navigationAsDateFormat ? prevText : this.formatDate(prevText,
this._daylightSavingAdjust(new Date(drawYear, drawMonth - stepMonths, 1)),
this._getFormatConfig(inst)));
prev = (this._canAdjustMonth(inst, -1, drawYear, drawMonth) ?
- '
' + prevText + ' ' :
- (hideIfNoPrevNext ? '' : '
' + prevText + ' '));
+ "
" + prevText + " " :
+ (hideIfNoPrevNext ? "" : "
" + prevText + " "));
- nextText = this._get(inst, 'nextText');
+ nextText = this._get(inst, "nextText");
nextText = (!navigationAsDateFormat ? nextText : this.formatDate(nextText,
this._daylightSavingAdjust(new Date(drawYear, drawMonth + stepMonths, 1)),
this._getFormatConfig(inst)));
next = (this._canAdjustMonth(inst, +1, drawYear, drawMonth) ?
- '
' + nextText + ' ' :
- (hideIfNoPrevNext ? '' : '
' + nextText + ' '));
+ "
" + nextText + " " :
+ (hideIfNoPrevNext ? "" : "
" + nextText + " "));
- currentText = this._get(inst, 'currentText');
- gotoDate = (this._get(inst, 'gotoCurrent') && inst.currentDay ? currentDate : today);
+ currentText = this._get(inst, "currentText");
+ gotoDate = (this._get(inst, "gotoCurrent") && inst.currentDay ? currentDate : today);
currentText = (!navigationAsDateFormat ? currentText :
this.formatDate(currentText, gotoDate, this._getFormatConfig(inst)));
- controls = (!inst.inline ? '
' +
- this._get(inst, 'closeText') + ' ' : '');
+ controls = (!inst.inline ? "
" +
+ this._get(inst, "closeText") + " " : "");
- buttonPanel = (showButtonPanel) ? '
' + (isRTL ? controls : '') +
- (this._isInRange(inst, gotoDate) ? '' + currentText + ' ' : '') + (isRTL ? '' : controls) + '
' : '';
+ buttonPanel = (showButtonPanel) ? "
" + (isRTL ? controls : "") +
+ (this._isInRange(inst, gotoDate) ? "" + currentText + " " : "") + (isRTL ? "" : controls) + "
" : "";
- firstDay = parseInt(this._get(inst, 'firstDay'),10);
+ firstDay = parseInt(this._get(inst, "firstDay"),10);
firstDay = (isNaN(firstDay) ? 0 : firstDay);
- showWeek = this._get(inst, 'showWeek');
- dayNames = this._get(inst, 'dayNames');
- dayNamesMin = this._get(inst, 'dayNamesMin');
- monthNames = this._get(inst, 'monthNames');
- monthNamesShort = this._get(inst, 'monthNamesShort');
- beforeShowDay = this._get(inst, 'beforeShowDay');
- showOtherMonths = this._get(inst, 'showOtherMonths');
- selectOtherMonths = this._get(inst, 'selectOtherMonths');
+ showWeek = this._get(inst, "showWeek");
+ dayNames = this._get(inst, "dayNames");
+ dayNamesMin = this._get(inst, "dayNamesMin");
+ monthNames = this._get(inst, "monthNames");
+ monthNamesShort = this._get(inst, "monthNamesShort");
+ beforeShowDay = this._get(inst, "beforeShowDay");
+ showOtherMonths = this._get(inst, "showOtherMonths");
+ selectOtherMonths = this._get(inst, "selectOtherMonths");
defaultDate = this._getDefaultDate(inst);
- html = '';
+ html = "";
dow;
for (row = 0; row < numMonths[0]; row++) {
- group = '';
+ group = "";
this.maxRows = 4;
for (col = 0; col < numMonths[1]; col++) {
selectedDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, inst.selectedDay));
- cornerClass = ' ui-corner-all';
- calender = '';
+ cornerClass = " ui-corner-all";
+ calender = "";
if (isMultiMonth) {
- calender += '
';
+ calender += "'>";
}
- calender += '" +
+ ((numMonths[0] > 0 && col === numMonths[1]-1) ? "
" : "") : "");
group += calender;
}
html += group;
@@ -1775,41 +1775,41 @@ $.extend(Datepicker.prototype, {
secondary, monthNames, monthNamesShort) {
var inMinYear, inMaxYear, month, years, thisYear, determineYear, year, endYear,
- changeMonth = this._get(inst, 'changeMonth'),
- changeYear = this._get(inst, 'changeYear'),
- showMonthAfterYear = this._get(inst, 'showMonthAfterYear'),
- html = '
',
- monthHtml = '';
+ changeMonth = this._get(inst, "changeMonth"),
+ changeYear = this._get(inst, "changeYear"),
+ showMonthAfterYear = this._get(inst, "showMonthAfterYear"),
+ html = "
",
+ monthHtml = "";
// month selection
if (secondary || !changeMonth) {
- monthHtml += '' + monthNames[drawMonth] + ' ';
+ monthHtml += "" + monthNames[drawMonth] + " ";
} else {
inMinYear = (minDate && minDate.getFullYear() === drawYear);
inMaxYear = (maxDate && maxDate.getFullYear() === drawYear);
- monthHtml += '';
+ monthHtml += "";
for ( month = 0; month < 12; month++) {
if ((!inMinYear || month >= minDate.getMonth()) && (!inMaxYear || month <= maxDate.getMonth())) {
- monthHtml += '' + monthNamesShort[month] + ' ';
+ monthHtml += "" + monthNamesShort[month] + " ";
}
}
- monthHtml += ' ';
+ monthHtml += " ";
}
if (!showMonthAfterYear) {
- html += monthHtml + (secondary || !(changeMonth && changeYear) ? ' ' : '');
+ html += monthHtml + (secondary || !(changeMonth && changeYear) ? " " : "");
}
// year selection
if ( !inst.yearshtml ) {
- inst.yearshtml = '';
+ inst.yearshtml = "";
if (secondary || !changeYear) {
- html += '' + drawYear + ' ';
+ html += "" + drawYear + " ";
} else {
// determine range of years to display
- years = this._get(inst, 'yearRange').split(':');
+ years = this._get(inst, "yearRange").split(":");
thisYear = new Date().getFullYear();
determineYear = function(value) {
var year = (value.match(/c[+\-].*/) ? drawYear + parseInt(value.substring(1), 10) :
@@ -1818,56 +1818,56 @@ $.extend(Datepicker.prototype, {
return (isNaN(year) ? thisYear : year);
};
year = determineYear(years[0]);
- endYear = Math.max(year, determineYear(years[1] || ''));
+ endYear = Math.max(year, determineYear(years[1] || ""));
year = (minDate ? Math.max(year, minDate.getFullYear()) : year);
endYear = (maxDate ? Math.min(endYear, maxDate.getFullYear()) : endYear);
- inst.yearshtml += '';
+ inst.yearshtml += "";
for (; year <= endYear; year++) {
- inst.yearshtml += '' + year + ' ';
+ inst.yearshtml += "" + year + " ";
}
- inst.yearshtml += ' ';
+ inst.yearshtml += " ";
html += inst.yearshtml;
inst.yearshtml = null;
}
}
- html += this._get(inst, 'yearSuffix');
+ html += this._get(inst, "yearSuffix");
if (showMonthAfterYear) {
- html += (secondary || !(changeMonth && changeYear) ? ' ' : '') + monthHtml;
+ html += (secondary || !(changeMonth && changeYear) ? " " : "") + monthHtml;
}
- html += '
'; // Close datepicker_header
+ html += "
"; // Close datepicker_header
return html;
},
/* Adjust one of the date sub-fields. */
_adjustInstDate: function(inst, offset, period) {
- var year = inst.drawYear + (period === 'Y' ? offset : 0),
- month = inst.drawMonth + (period === 'M' ? offset : 0),
- day = Math.min(inst.selectedDay, this._getDaysInMonth(year, month)) + (period === 'D' ? offset : 0),
+ var year = inst.drawYear + (period === "Y" ? offset : 0),
+ month = inst.drawMonth + (period === "M" ? offset : 0),
+ day = Math.min(inst.selectedDay, this._getDaysInMonth(year, month)) + (period === "D" ? offset : 0),
date = this._restrictMinMax(inst, this._daylightSavingAdjust(new Date(year, month, day)));
inst.selectedDay = date.getDate();
inst.drawMonth = inst.selectedMonth = date.getMonth();
inst.drawYear = inst.selectedYear = date.getFullYear();
- if (period === 'M' || period === 'Y') {
+ if (period === "M" || period === "Y") {
this._notifyChange(inst);
}
},
/* Ensure a date is within any min/max bounds. */
_restrictMinMax: function(inst, date) {
- var minDate = this._getMinMaxDate(inst, 'min'),
- maxDate = this._getMinMaxDate(inst, 'max'),
+ var minDate = this._getMinMaxDate(inst, "min"),
+ maxDate = this._getMinMaxDate(inst, "max"),
newDate = (minDate && date < minDate ? minDate : date);
return (maxDate && newDate > maxDate ? maxDate : newDate);
},
/* Notify change of month/year. */
_notifyChange: function(inst) {
- var onChange = this._get(inst, 'onChangeMonthYear');
+ var onChange = this._get(inst, "onChangeMonthYear");
if (onChange) {
onChange.apply((inst.input ? inst.input[0] : null),
[inst.selectedYear, inst.selectedMonth + 1, inst]);
@@ -1876,13 +1876,13 @@ $.extend(Datepicker.prototype, {
/* Determine the number of months to show. */
_getNumberOfMonths: function(inst) {
- var numMonths = this._get(inst, 'numberOfMonths');
- return (numMonths == null ? [1, 1] : (typeof numMonths === 'number' ? [1, numMonths] : numMonths));
+ var numMonths = this._get(inst, "numberOfMonths");
+ return (numMonths == null ? [1, 1] : (typeof numMonths === "number" ? [1, numMonths] : numMonths));
},
/* Determine the current maximum date - ensure no time components are set. */
_getMinMaxDate: function(inst, minMax) {
- return this._determineDate(inst, this._get(inst, minMax + 'Date'), null);
+ return this._determineDate(inst, this._get(inst, minMax + "Date"), null);
},
/* Find the number of days in a given month. */
@@ -1910,32 +1910,32 @@ $.extend(Datepicker.prototype, {
/* Is the given date in the accepted range? */
_isInRange: function(inst, date) {
var yearSplit, currentYear,
- minDate = this._getMinMaxDate(inst, 'min'),
- maxDate = this._getMinMaxDate(inst, 'max'),
+ minDate = this._getMinMaxDate(inst, "min"),
+ maxDate = this._getMinMaxDate(inst, "max"),
minYear = null,
maxYear = null,
- years = this._get(inst, 'yearRange');
- if (years){
- yearSplit = years.split(':');
- currentYear = new Date().getFullYear();
- minYear = parseInt(yearSplit[0], 10) + currentYear;
- maxYear = parseInt(yearSplit[1], 10) + currentYear;
- }
+ years = this._get(inst, "yearRange");
+ if (years){
+ yearSplit = years.split(":");
+ currentYear = new Date().getFullYear();
+ minYear = parseInt(yearSplit[0], 10) + currentYear;
+ maxYear = parseInt(yearSplit[1], 10) + currentYear;
+ }
return ((!minDate || date.getTime() >= minDate.getTime()) &&
(!maxDate || date.getTime() <= maxDate.getTime()) &&
- (!minYear || date.getFullYear() >= minYear) &&
- (!maxYear || date.getFullYear() <= maxYear));
+ (!minYear || date.getFullYear() >= minYear) &&
+ (!maxYear || date.getFullYear() <= maxYear));
},
/* Provide the configuration settings for formatting/parsing. */
_getFormatConfig: function(inst) {
- var shortYearCutoff = this._get(inst, 'shortYearCutoff');
- shortYearCutoff = (typeof shortYearCutoff !== 'string' ? shortYearCutoff :
+ var shortYearCutoff = this._get(inst, "shortYearCutoff");
+ shortYearCutoff = (typeof shortYearCutoff !== "string" ? shortYearCutoff :
new Date().getFullYear() % 100 + parseInt(shortYearCutoff, 10));
return {shortYearCutoff: shortYearCutoff,
- dayNamesShort: this._get(inst, 'dayNamesShort'), dayNames: this._get(inst, 'dayNames'),
- monthNamesShort: this._get(inst, 'monthNamesShort'), monthNames: this._get(inst, 'monthNames')};
+ dayNamesShort: this._get(inst, "dayNamesShort"), dayNames: this._get(inst, "dayNames"),
+ monthNamesShort: this._get(inst, "monthNamesShort"), monthNames: this._get(inst, "monthNames")};
},
/* Format the given date for display. */
@@ -1945,10 +1945,10 @@ $.extend(Datepicker.prototype, {
inst.currentMonth = inst.selectedMonth;
inst.currentYear = inst.selectedYear;
}
- var date = (day ? (typeof day === 'object' ? day :
+ var date = (day ? (typeof day === "object" ? day :
this._daylightSavingAdjust(new Date(year, month, day))) :
this._daylightSavingAdjust(new Date(inst.currentYear, inst.currentMonth, inst.currentDay)));
- return this.formatDate(this._get(inst, 'dateFormat'), date, this._getFormatConfig(inst));
+ return this.formatDate(this._get(inst, "dateFormat"), date, this._getFormatConfig(inst));
}
});
@@ -1958,25 +1958,25 @@ $.extend(Datepicker.prototype, {
* Global instActive, set by _updateDatepicker allows the handlers to find their way back to the active picker.
*/
function bindHover(dpDiv) {
- var selector = 'button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a';
- return dpDiv.delegate(selector, 'mouseout', function() {
- $(this).removeClass('ui-state-hover');
- if (this.className.indexOf('ui-datepicker-prev') !== -1) {
- $(this).removeClass('ui-datepicker-prev-hover');
+ var selector = "button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a";
+ return dpDiv.delegate(selector, "mouseout", function() {
+ $(this).removeClass("ui-state-hover");
+ if (this.className.indexOf("ui-datepicker-prev") !== -1) {
+ $(this).removeClass("ui-datepicker-prev-hover");
}
- if (this.className.indexOf('ui-datepicker-next') !== -1) {
- $(this).removeClass('ui-datepicker-next-hover');
+ if (this.className.indexOf("ui-datepicker-next") !== -1) {
+ $(this).removeClass("ui-datepicker-next-hover");
}
})
- .delegate(selector, 'mouseover', function(){
+ .delegate(selector, "mouseover", function(){
if (!$.datepicker._isDisabledDatepicker( instActive.inline ? dpDiv.parent()[0] : instActive.input[0])) {
- $(this).parents('.ui-datepicker-calendar').find('a').removeClass('ui-state-hover');
- $(this).addClass('ui-state-hover');
- if (this.className.indexOf('ui-datepicker-prev') !== -1) {
- $(this).addClass('ui-datepicker-prev-hover');
+ $(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover");
+ $(this).addClass("ui-state-hover");
+ if (this.className.indexOf("ui-datepicker-prev") !== -1) {
+ $(this).addClass("ui-datepicker-prev-hover");
}
- if (this.className.indexOf('ui-datepicker-next') !== -1) {
- $(this).addClass('ui-datepicker-next-hover');
+ if (this.className.indexOf("ui-datepicker-next") !== -1) {
+ $(this).addClass("ui-datepicker-next-hover");
}
}
});
@@ -2012,21 +2012,21 @@ $.fn.datepicker = function(options){
/* Append datepicker main container to body if not exist. */
if ($("#"+$.datepicker._mainDivId).length === 0) {
- $('body').append($.datepicker.dpDiv);
+ $("body").append($.datepicker.dpDiv);
}
var otherArgs = Array.prototype.slice.call(arguments, 1);
- if (typeof options === 'string' && (options === 'isDisabled' || options === 'getDate' || options === 'widget')) {
- return $.datepicker['_' + options + 'Datepicker'].
+ if (typeof options === "string" && (options === "isDisabled" || options === "getDate" || options === "widget")) {
+ return $.datepicker["_" + options + "Datepicker"].
apply($.datepicker, [this[0]].concat(otherArgs));
}
- if (options === 'option' && arguments.length === 2 && typeof arguments[1] === 'string') {
- return $.datepicker['_' + options + 'Datepicker'].
+ if (options === "option" && arguments.length === 2 && typeof arguments[1] === "string") {
+ return $.datepicker["_" + options + "Datepicker"].
apply($.datepicker, [this[0]].concat(otherArgs));
}
return this.each(function() {
- typeof options === 'string' ?
- $.datepicker['_' + options + 'Datepicker'].
+ typeof options === "string" ?
+ $.datepicker["_" + options + "Datepicker"].
apply($.datepicker, [this].concat(otherArgs)) :
$.datepicker._attachDatepicker(this, options);
});
@@ -2039,6 +2039,6 @@ $.datepicker.version = "@VERSION";
// Workaround for #4055
// Add another global to avoid noConflict issues with inline event handlers
-window['DP_jQuery_' + dpuuid] = $;
+window["DP_jQuery_" + dpuuid] = $;
})(jQuery);
diff --git a/ui/jquery.ui.dialog.js b/ui/jquery.ui.dialog.js
index 26989959e..ad6cb6147 100644
--- a/ui/jquery.ui.dialog.js
+++ b/ui/jquery.ui.dialog.js
@@ -466,7 +466,7 @@ $.widget( "ui.dialog", {
// .ui-resizable has position: relative defined in the stylesheet
// but dialogs have to use absolute or fixed positioning
position = this.uiDialog.css("position"),
- resizeHandles = typeof handles === 'string' ?
+ resizeHandles = typeof handles === "string" ?
handles :
"n,e,s,w,se,sw,ne,nw";
diff --git a/ui/jquery.ui.draggable.js b/ui/jquery.ui.draggable.js
index fb3ee7ccc..12b2f7cbc 100644
--- a/ui/jquery.ui.draggable.js
+++ b/ui/jquery.ui.draggable.js
@@ -81,7 +81,7 @@ $.widget( "ui.draggable", $.ui.interaction, {
this.dragDimensions = null;
// 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.element;
@@ -208,7 +208,7 @@ $.widget( "ui.draggable", $.ui.interaction, {
// If user cancels stop, leave helper there
if ( this._trigger( "stop", event, this._fullHash( pointerPosition ) ) !== false ) {
if ( this.options.helper ) {
- delete this.element.data( 'uiDraggable' ).helper;
+ delete this.element.data( "uiDraggable" ).helper;
this.dragEl.remove();
}
this._resetDomPosition();
@@ -242,7 +242,7 @@ $.widget( "ui.draggable", $.ui.interaction, {
helper.appendTo( this._appendToEl() || this.document[0].body );
}
- this.element.data( 'uiDraggable' ).helper = helper;
+ this.element.data( "uiDraggable" ).helper = helper;
this._cacheDragDimensions( helper );
@@ -536,7 +536,7 @@ if ( $.uiBackCompat !== false ) {
var el = this.options.appendTo;
- if ( el === 'parent' ) {
+ if ( el === "parent" ) {
el = this.dragEl.parent();
}
@@ -556,11 +556,11 @@ if ( $.uiBackCompat !== false ) {
this._super();
- if ( this.options.helper === 'original' ) {
+ if ( this.options.helper === "original" ) {
this.options.helper = false;
}
- if ( this.options.helper === 'clone' ) {
+ if ( this.options.helper === "clone" ) {
this.options.helper = true;
}
@@ -580,15 +580,15 @@ if ( $.uiBackCompat !== false ) {
_setOption: function( key, value ) {
- if ( key !== 'helper' ) {
+ if ( key !== "helper" ) {
return this._super( key, value );
}
- if ( value === 'clone' ) {
+ if ( value === "clone" ) {
value = true;
}
- if ( value === 'original' ) {
+ if ( value === "original" ) {
value = false;
}
@@ -645,7 +645,7 @@ if ( $.uiBackCompat !== false ) {
_setOption: function( key, value ) {
- if ( key !== 'cancel' ) {
+ if ( key !== "cancel" ) {
return this._super( key, value );
}
@@ -831,10 +831,10 @@ if ( $.uiBackCompat !== false ) {
}
// 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
- self.dragEl.css( 'opacity', self.options.opacity );
+ self.dragEl.css( "opacity", self.options.opacity );
});
@@ -846,7 +846,7 @@ if ( $.uiBackCompat !== false ) {
}
// 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
- originalLeft = self.dragEl.css( 'left' );
- originalTop = self.dragEl.css( 'top' );
- originalPosition = self.dragEl.css( 'position' );
+ originalLeft = self.dragEl.css( "left" );
+ originalTop = self.dragEl.css( "top" );
+ originalPosition = self.dragEl.css( "position" );
});
@@ -924,10 +924,10 @@ if ( $.uiBackCompat !== false ) {
}
// 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
- 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
- self.dragEl.css( 'z-index', originalZIndex );
+ self.dragEl.css( "z-index", originalZIndex );
});
@@ -1055,7 +1055,7 @@ if ( $.uiBackCompat !== false ) {
$.widget( "ui.draggable", $.ui.draggable, {
options: {
snap: false,
- snapMode: 'both',
+ snapMode: "both",
snapTolerance: 20
},
@@ -1066,7 +1066,7 @@ if ( $.uiBackCompat !== false ) {
this._super();
- this.element.on( 'dragstart', function() {
+ this.element.on( "dragstart", function() {
// Nothing to do
if ( !inst.options.snap ) {
@@ -1077,7 +1077,7 @@ if ( $.uiBackCompat !== false ) {
snapElements = [];
// 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),
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
if ( !inst.options.snap ) {
@@ -1136,7 +1136,7 @@ if ( $.uiBackCompat !== false ) {
continue;
}
- if(o.snapMode !== 'inner') {
+ if(o.snapMode !== "inner") {
ts = Math.abs(t - y2) <= d;
bs = Math.abs(b - y1) <= d;
ls = Math.abs(l - x2) <= d;
@@ -1157,7 +1157,7 @@ if ( $.uiBackCompat !== false ) {
first = (ts || bs || ls || rs);
- if(o.snapMode !== 'outer') {
+ if(o.snapMode !== "outer") {
ts = Math.abs(t - y1) <= d;
bs = Math.abs(b - y2) <= d;
ls = Math.abs(l - x1) <= d;
@@ -1195,7 +1195,7 @@ if ( $.uiBackCompat !== false ) {
var mod = d === "absolute" ? 1 : -1,
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, {
parent: this._getParentOffset(),
@@ -1207,13 +1207,13 @@ if ( $.uiBackCompat !== false ) {
pos.top + // The absolute mouse position
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)
- ( ( this.cssPosition === 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod)
+ ( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod)
),
left: (
pos.left + // The absolute mouse position
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)
- ( ( 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
// 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
- 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.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
//Ugly IE fix
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 };
}
@@ -1278,7 +1278,7 @@ if ( $.uiBackCompat !== false ) {
this._super();
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
@@ -1289,7 +1289,7 @@ if ( $.uiBackCompat !== false ) {
}
drops.each( function() {
- $(this).sortable('refreshPositions');
+ $(this).sortable("refreshPositions");
});
@@ -1300,4 +1300,4 @@ if ( $.uiBackCompat !== false ) {
});
-}
\ No newline at end of file
+}
diff --git a/ui/jquery.ui.droppable.js b/ui/jquery.ui.droppable.js
index efb326d38..ecc9e14f9 100644
--- a/ui/jquery.ui.droppable.js
+++ b/ui/jquery.ui.droppable.js
@@ -123,11 +123,11 @@ $.extend( $.ui.droppable, {
var draggableProportions = $.ui.droppable.draggableProportions,
xHalf = ui.offset.left + draggableProportions.width / 2,
yHalf = ui.offset.top + draggableProportions.height / 2;
-
+
return this.offset.left < xHalf && edges.right > xHalf &&
this.offset.top < yHalf && edges.bottom > yHalf;
},
-
+
// Draggable overlaps droppable by at least one pixel
touch: function( event, edges, ui ) {
return this.offset.left < edges.draggableRight &&
@@ -135,7 +135,7 @@ $.extend( $.ui.droppable, {
this.offset.top < edges.draggableBottom &&
edges.bottom > ui.offset.top;
},
-
+
// Pointer overlaps droppable
pointer: function( event, edges, ui ) {
return ui.pointer.x >= this.offset.left && ui.pointer.x <= edges.right &&
diff --git a/ui/jquery.ui.effect-transfer.js b/ui/jquery.ui.effect-transfer.js
index 0bfffd7fb..473790ac6 100644
--- a/ui/jquery.ui.effect-transfer.js
+++ b/ui/jquery.ui.effect-transfer.js
@@ -28,7 +28,7 @@ $.effects.effect.transfer = function( o, done ) {
width: target.innerWidth()
},
startPosition = elem.offset(),
- transfer = $( '
' )
+ transfer = $( "
" )
.appendTo( document.body )
.addClass( o.className )
.css({
diff --git a/ui/jquery.ui.effect.js b/ui/jquery.ui.effect.js
index 83d78a9b4..edb63c14b 100644
--- a/ui/jquery.ui.effect.js
+++ b/ui/jquery.ui.effect.js
@@ -818,7 +818,7 @@ $.effects.animateClass = function( value, duration, easing, callback ) {
$.each( arguments, function() {
var el = this.el;
$.each( this.diff, function(key) {
- el.css( key, '' );
+ el.css( key, "" );
});
});
diff --git a/ui/jquery.ui.menu.js b/ui/jquery.ui.menu.js
index 7f37b6b06..a666e934d 100644
--- a/ui/jquery.ui.menu.js
+++ b/ui/jquery.ui.menu.js
@@ -15,8 +15,6 @@
*/
(function( $, undefined ) {
-var mouseHandled = false;
-
$.widget( "ui.menu", {
version: "@VERSION",
defaultElement: "
",
@@ -40,6 +38,9 @@ $.widget( "ui.menu", {
_create: function() {
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
.uniqueId()
.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 ) {
var target = $( event.target ).closest( ".ui-menu-item" );
- if ( !mouseHandled && target.not( ".ui-state-disabled" ).length ) {
- mouseHandled = true;
+ if ( !this.mouseHandled && target.not( ".ui-state-disabled" ).length ) {
+ this.mouseHandled = true;
this.select( event );
// Open submenu on click
@@ -130,7 +131,7 @@ $.widget( "ui.menu", {
}
// Reset the mouseHandled flag
- mouseHandled = false;
+ this.mouseHandled = false;
}
});
},
@@ -343,6 +344,15 @@ $.widget( "ui.menu", {
}[ 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 ) {
var nested, focused;
this.blur( event, event && event.type === "focus" );
diff --git a/ui/jquery.ui.mouse.js b/ui/jquery.ui.mouse.js
index 6abd5ceaf..095a4fad7 100644
--- a/ui/jquery.ui.mouse.js
+++ b/ui/jquery.ui.mouse.js
@@ -21,7 +21,7 @@ $( document ).mouseup( function() {
$.widget("ui.mouse", {
version: "@VERSION",
options: {
- cancel: 'input,textarea,button,select,option',
+ cancel: "input,textarea,button,select,option",
distance: 1,
delay: 0
},
@@ -29,12 +29,12 @@ $.widget("ui.mouse", {
var that = this;
this.element
- .bind('mousedown.'+this.widgetName, function(event) {
+ .bind("mousedown."+this.widgetName, function(event) {
return that._mouseDown(event);
})
- .bind('click.'+this.widgetName, function(event) {
- if (true === $.data(event.target, that.widgetName + '.preventClickEvent')) {
- $.removeData(event.target, that.widgetName + '.preventClickEvent');
+ .bind("click."+this.widgetName, function(event) {
+ if (true === $.data(event.target, that.widgetName + ".preventClickEvent")) {
+ $.removeData(event.target, that.widgetName + ".preventClickEvent");
event.stopImmediatePropagation();
return false;
}
@@ -46,11 +46,11 @@ $.widget("ui.mouse", {
// TODO: make sure destroying one instance of mouse doesn't mess with
// other instances of mouse
_mouseDestroy: function() {
- this.element.unbind('.'+this.widgetName);
+ this.element.unbind("."+this.widgetName);
if ( this._mouseMoveDelegate ) {
$(document)
- .unbind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
- .unbind('mouseup.'+this.widgetName, this._mouseUpDelegate);
+ .unbind("mousemove."+this.widgetName, this._mouseMoveDelegate)
+ .unbind("mouseup."+this.widgetName, this._mouseUpDelegate);
}
},
@@ -88,8 +88,8 @@ $.widget("ui.mouse", {
}
// Click event may never have fired (Gecko & Opera)
- if (true === $.data(event.target, this.widgetName + '.preventClickEvent')) {
- $.removeData(event.target, this.widgetName + '.preventClickEvent');
+ if (true === $.data(event.target, this.widgetName + ".preventClickEvent")) {
+ $.removeData(event.target, this.widgetName + ".preventClickEvent");
}
// these delegates are required to keep context
@@ -100,8 +100,8 @@ $.widget("ui.mouse", {
return that._mouseUp(event);
};
$(document)
- .bind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
- .bind('mouseup.'+this.widgetName, this._mouseUpDelegate);
+ .bind("mousemove."+this.widgetName, this._mouseMoveDelegate)
+ .bind("mouseup."+this.widgetName, this._mouseUpDelegate);
event.preventDefault();
@@ -131,14 +131,14 @@ $.widget("ui.mouse", {
_mouseUp: function(event) {
$(document)
- .unbind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
- .unbind('mouseup.'+this.widgetName, this._mouseUpDelegate);
+ .unbind("mousemove."+this.widgetName, this._mouseMoveDelegate)
+ .unbind("mouseup."+this.widgetName, this._mouseUpDelegate);
if (this._mouseStarted) {
this._mouseStarted = false;
if (event.target === this._mouseDownEvent.target) {
- $.data(event.target, this.widgetName + '.preventClickEvent', true);
+ $.data(event.target, this.widgetName + ".preventClickEvent", true);
}
this._mouseStop(event);
diff --git a/ui/jquery.ui.resizable.js b/ui/jquery.ui.resizable.js
index b417288d8..ce3efeb9d 100644
--- a/ui/jquery.ui.resizable.js
+++ b/ui/jquery.ui.resizable.js
@@ -57,7 +57,7 @@ $.widget("ui.resizable", $.ui.mouse, {
aspectRatio: o.aspectRatio,
originalElement: this.element,
_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
@@ -65,18 +65,18 @@ $.widget("ui.resizable", $.ui.mouse, {
//Create a wrapper element and set the wrapper to the new current internal element
this.element.wrap(
- $('
').css({
- position: this.element.css('position'),
+ $("
").css({
+ position: this.element.css("position"),
width: this.element.outerWidth(),
height: this.element.outerHeight(),
- top: this.element.css('top'),
- left: this.element.css('left')
+ top: this.element.css("top"),
+ left: this.element.css("left")
})
);
//Overwrite the original this.element
this.element = this.element.parent().data(
- "ui-resizable", this.element.data('ui-resizable')
+ "ui-resizable", this.element.data("ui-resizable")
);
this.elementIsWrapper = true;
@@ -86,25 +86,25 @@ $.widget("ui.resizable", $.ui.mouse, {
this.originalElement.css({ marginLeft: 0, marginTop: 0, marginRight: 0, marginBottom: 0});
//Prevent Safari textarea resize
- this.originalResizeStyle = this.originalElement.css('resize');
- this.originalElement.css('resize', 'none');
+ this.originalResizeStyle = this.originalElement.css("resize");
+ this.originalElement.css("resize", "none");
//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)
- this.originalElement.css({ margin: this.originalElement.css('margin') });
+ this.originalElement.css({ margin: this.originalElement.css("margin") });
// fix handlers offset
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 === 'all') {
- this.handles = 'n,e,s,w,se,sw,ne,nw';
+ if ( this.handles === "all") {
+ this.handles = "n,e,s,w,se,sw,ne,nw";
}
n = this.handles.split(",");
@@ -113,19 +113,19 @@ $.widget("ui.resizable", $.ui.mouse, {
for(i = 0; i < n.length; i++) {
handle = $.trim(n[i]);
- hname = 'ui-resizable-'+handle;
- axis = $('
');
+ hname = "ui-resizable-"+handle;
+ axis = $("
");
// Apply zIndex to all handles - see #7960
axis.css({ zIndex: o.zIndex });
//TODO : What's going on here?
- if ('se' === handle) {
- axis.addClass('ui-icon ui-icon-gripsmall-diagonal-se');
+ if ("se" === handle) {
+ axis.addClass("ui-icon ui-icon-gripsmall-diagonal-se");
}
//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);
}
@@ -152,10 +152,10 @@ $.widget("ui.resizable", $.ui.mouse, {
padWrapper = /sw|ne|nw|se|n|s/.test(i) ? axis.outerHeight() : axis.outerWidth();
//The padding type i have to apply...
- padPos = [ 'padding',
- /ne|nw|n/.test(i) ? 'Top' :
- /se|sw|s/.test(i) ? 'Bottom' :
- /^e$/.test(i) ? 'Right' : 'Left' ].join("");
+ padPos = [ "padding",
+ /ne|nw|n/.test(i) ? "Top" :
+ /se|sw|s/.test(i) ? "Bottom" :
+ /^e$/.test(i) ? "Right" : "Left" ].join("");
target.css(padPos, padWrapper);
@@ -173,7 +173,7 @@ $.widget("ui.resizable", $.ui.mouse, {
//TODO: make renderAxis a prototype function
this._renderAxis(this.element);
- this._handles = $('.ui-resizable-handle', this.element)
+ this._handles = $(".ui-resizable-handle", this.element)
.disableSelection();
//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, 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,
_destroy = function(exp) {
$(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
@@ -230,16 +230,16 @@ $.widget("ui.resizable", $.ui.mouse, {
_destroy(this.element);
wrapper = this.element;
this.originalElement.css({
- position: wrapper.css('position'),
+ position: wrapper.css("position"),
width: wrapper.outerWidth(),
height: wrapper.outerHeight(),
- top: wrapper.css('top'),
- left: wrapper.css('left')
+ top: wrapper.css("top"),
+ left: wrapper.css("left")
}).insertAfter( wrapper );
wrapper.remove();
}
- this.originalElement.css('resize', this.originalResizeStyle);
+ this.originalElement.css("resize", this.originalResizeStyle);
_destroy(this.originalElement);
return this;
@@ -269,16 +269,16 @@ $.widget("ui.resizable", $.ui.mouse, {
this.resizing = true;
// bugfix for http://dev.jquery.com/ticket/1749
- if ( (/absolute/).test( el.css('position') ) ) {
- el.css({ position: 'absolute', top: el.css('top'), left: el.css('left') });
- } else if (el.is('.ui-draggable')) {
- el.css({ position: 'absolute', top: iniPos.top, left: iniPos.left });
+ if ( (/absolute/).test( el.css("position") ) ) {
+ el.css({ position: "absolute", top: el.css("top"), left: el.css("left") });
+ } else if (el.is(".ui-draggable")) {
+ el.css({ position: "absolute", top: iniPos.top, left: iniPos.left });
}
this._renderProxy();
- curleft = num(this.helper.css('left'));
- curtop = num(this.helper.css('top'));
+ curleft = num(this.helper.css("left"));
+ curtop = num(this.helper.css("top"));
if (o.containment) {
curleft += $(o.containment).scrollLeft() || 0;
@@ -295,10 +295,10 @@ $.widget("ui.resizable", $.ui.mouse, {
this.originalMousePosition = { left: event.pageX, top: event.pageY };
//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');
- $('body').css('cursor', cursor === 'auto' ? this.axis + '-resize' : cursor);
+ cursor = $(".ui-resizable-" + this.axis).css("cursor");
+ $("body").css("cursor", cursor === "auto" ? this.axis + "-resize" : cursor);
el.addClass("ui-resizable-resizing");
this._propagate("start", event);
@@ -360,7 +360,7 @@ $.widget("ui.resizable", $.ui.mouse, {
// Call the user callback if the element was resized
if ( ! $.isEmptyObject(props) ) {
- this._trigger('resize', event, this.ui());
+ this._trigger("resize", event, this.ui());
}
return false;
@@ -376,12 +376,12 @@ $.widget("ui.resizable", $.ui.mouse, {
pr = this._proportionallyResizeElements;
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;
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;
- top = (parseInt(that.element.css('top'), 10) + (that.position.top - that.originalPosition.top)) || 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;
if (!o.animate) {
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");
@@ -472,11 +472,11 @@ $.widget("ui.resizable", $.ui.mouse, {
data.height = (data.width / this.aspectRatio);
}
- if (a === 'sw') {
+ if (a === "sw") {
data.left = cpos.left + (csize.width - data.width);
data.top = null;
}
- if (a === 'nw') {
+ if (a === "nw") {
data.top = cpos.top + (csize.height - data.height);
data.left = cpos.left + (csize.width - data.width);
}
@@ -544,8 +544,8 @@ $.widget("ui.resizable", $.ui.mouse, {
if (!this.borderDif) {
this.borderDif = [];
- 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')];
+ 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")];
for ( j = 0; j < borders.length; j++ ) {
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) {
- this.helper = this.helper || $('
');
+ this.helper = this.helper || $("
");
this.helper.addClass(this._helper).css({
width: this.element.outerWidth() - 1,
height: this.element.outerHeight() - 1,
- position: 'absolute',
- left: this.elementOffset.left +'px',
- top: this.elementOffset.top +'px',
+ position: "absolute",
+ left: this.elementOffset.left +"px",
+ top: this.elementOffset.top +"px",
zIndex: ++o.zIndex //TODO: Don't modify option
});
@@ -650,11 +650,11 @@ $.ui.plugin.add("resizable", "animate", {
o = that.options,
pr = that._proportionallyResizeElements,
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,
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,
- top = (parseInt(that.element.css('top'), 10) + (that.position.top - that.originalPosition.top)) || 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;
that.element.animate(
$.extend(style, top && left ? { top: top, left: left } : {}), {
@@ -663,10 +663,10 @@ $.ui.plugin.add("resizable", "animate", {
step: function() {
var data = {
- width: parseInt(that.element.css('width'), 10),
- height: parseInt(that.element.css('height'), 10),
- top: parseInt(that.element.css('top'), 10),
- left: parseInt(that.element.css('left'), 10)
+ width: parseInt(that.element.css("width"), 10),
+ height: parseInt(that.element.css("height"), 10),
+ top: parseInt(that.element.css("top"), 10),
+ left: parseInt(that.element.css("left"), 10)
};
if (pr && pr.length) {
@@ -740,7 +740,7 @@ $.ui.plugin.add("resizable", "containment", {
pRatio = that._aspectRatio || event.shiftKey,
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;
}
@@ -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 );
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) {
woset -= that.parentData.left;
@@ -799,11 +799,11 @@ $.ui.plugin.add("resizable", "containment", {
w = helper.outerWidth() - that.sizeDiff.width,
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 });
}
- 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 });
}
@@ -820,12 +820,12 @@ $.ui.plugin.add("resizable", "alsoResize", {
var el = $(this);
el.data("ui-resizable-alsoresize", {
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); }
else { $.each(o.alsoResize, function (exp) { _store(exp); }); }
}else{
@@ -846,7 +846,7 @@ $.ui.plugin.add("resizable", "alsoResize", {
_alsoResize = function (exp, c) {
$(exp).each(function() {
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) {
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); });
}else{
_alsoResize(o.alsoResize);
@@ -879,9 +879,9 @@ $.ui.plugin.add("resizable", "ghost", {
that.ghost = that.originalElement.clone();
that.ghost
- .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(typeof o.ghost === 'string' ? o.ghost : '');
+ .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(typeof o.ghost === "string" ? o.ghost : "");
that.ghost.appendTo(that.helper);
@@ -890,7 +890,7 @@ $.ui.plugin.add("resizable", "ghost", {
resize: function(){
var that = $(this).data("ui-resizable");
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 });
}
},
diff --git a/ui/jquery.ui.selectable.js b/ui/jquery.ui.selectable.js
index 164862d14..8e6d03c1f 100644
--- a/ui/jquery.ui.selectable.js
+++ b/ui/jquery.ui.selectable.js
@@ -18,11 +18,11 @@
$.widget("ui.selectable", $.ui.mouse, {
version: "@VERSION",
options: {
- appendTo: 'body',
+ appendTo: "body",
autoRefresh: true,
distance: 0,
- filter: '*',
- tolerance: 'touch'
+ filter: "*",
+ tolerance: "touch"
},
_create: function() {
var selectees,
@@ -47,9 +47,9 @@ $.widget("ui.selectable", $.ui.mouse, {
right: pos.left + $this.outerWidth(),
bottom: pos.top + $this.outerHeight(),
startselected: false,
- selected: $this.hasClass('ui-selected'),
- selecting: $this.hasClass('ui-selecting'),
- unselecting: $this.hasClass('ui-unselecting')
+ selected: $this.hasClass("ui-selected"),
+ selecting: $this.hasClass("ui-selecting"),
+ unselecting: $this.hasClass("ui-unselecting")
});
});
};
@@ -88,8 +88,8 @@ $.widget("ui.selectable", $.ui.mouse, {
$(options.appendTo).append(this.helper);
// position helper (lasso)
this.helper.css({
- "left": event.clientX,
- "top": event.clientY,
+ "left": event.pageX,
+ "top": event.pageY,
"width": 0,
"height": 0
});
@@ -98,13 +98,13 @@ $.widget("ui.selectable", $.ui.mouse, {
this.refresh();
}
- this.selectees.filter('.ui-selected').each(function() {
+ this.selectees.filter(".ui-selected").each(function() {
var selectee = $.data(this, "selectable-item");
selectee.startselected = true;
if (!event.metaKey && !event.ctrlKey) {
- selectee.$element.removeClass('ui-selected');
+ selectee.$element.removeClass("ui-selected");
selectee.selected = false;
- selectee.$element.addClass('ui-unselecting');
+ selectee.$element.addClass("ui-unselecting");
selectee.unselecting = true;
// selectable UNSELECTING callback
that._trigger("unselecting", event, {
@@ -117,7 +117,7 @@ $.widget("ui.selectable", $.ui.mouse, {
var doSelect,
selectee = $.data(this, "selectable-item");
if (selectee) {
- doSelect = (!event.metaKey && !event.ctrlKey) || !selectee.$element.hasClass('ui-selected');
+ doSelect = (!event.metaKey && !event.ctrlKey) || !selectee.$element.hasClass("ui-selected");
selectee.$element
.removeClass(doSelect ? "ui-unselecting" : "ui-selected")
.addClass(doSelect ? "ui-selecting" : "ui-unselecting");
@@ -169,24 +169,24 @@ $.widget("ui.selectable", $.ui.mouse, {
return;
}
- if (options.tolerance === 'touch') {
+ if (options.tolerance === "touch") {
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);
}
if (hit) {
// SELECT
if (selectee.selected) {
- selectee.$element.removeClass('ui-selected');
+ selectee.$element.removeClass("ui-selected");
selectee.selected = false;
}
if (selectee.unselecting) {
- selectee.$element.removeClass('ui-unselecting');
+ selectee.$element.removeClass("ui-unselecting");
selectee.unselecting = false;
}
if (!selectee.selecting) {
- selectee.$element.addClass('ui-selecting');
+ selectee.$element.addClass("ui-selecting");
selectee.selecting = true;
// selectable SELECTING callback
that._trigger("selecting", event, {
@@ -197,15 +197,15 @@ $.widget("ui.selectable", $.ui.mouse, {
// UNSELECT
if (selectee.selecting) {
if ((event.metaKey || event.ctrlKey) && selectee.startselected) {
- selectee.$element.removeClass('ui-selecting');
+ selectee.$element.removeClass("ui-selecting");
selectee.selecting = false;
- selectee.$element.addClass('ui-selected');
+ selectee.$element.addClass("ui-selected");
selectee.selected = true;
} else {
- selectee.$element.removeClass('ui-selecting');
+ selectee.$element.removeClass("ui-selecting");
selectee.selecting = false;
if (selectee.startselected) {
- selectee.$element.addClass('ui-unselecting');
+ selectee.$element.addClass("ui-unselecting");
selectee.unselecting = true;
}
// selectable UNSELECTING callback
@@ -216,10 +216,10 @@ $.widget("ui.selectable", $.ui.mouse, {
}
if (selectee.selected) {
if (!event.metaKey && !event.ctrlKey && !selectee.startselected) {
- selectee.$element.removeClass('ui-selected');
+ selectee.$element.removeClass("ui-selected");
selectee.selected = false;
- selectee.$element.addClass('ui-unselecting');
+ selectee.$element.addClass("ui-unselecting");
selectee.unselecting = true;
// selectable UNSELECTING callback
that._trigger("unselecting", event, {
@@ -238,18 +238,18 @@ $.widget("ui.selectable", $.ui.mouse, {
this.dragged = false;
- $('.ui-unselecting', this.element[0]).each(function() {
+ $(".ui-unselecting", this.element[0]).each(function() {
var selectee = $.data(this, "selectable-item");
- selectee.$element.removeClass('ui-unselecting');
+ selectee.$element.removeClass("ui-unselecting");
selectee.unselecting = false;
selectee.startselected = false;
that._trigger("unselected", event, {
unselected: selectee.element
});
});
- $('.ui-selecting', this.element[0]).each(function() {
+ $(".ui-selecting", this.element[0]).each(function() {
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.selected = true;
selectee.startselected = true;
diff --git a/ui/jquery.ui.sortable.js b/ui/jquery.ui.sortable.js
index e6ac81071..1d4145b5c 100644
--- a/ui/jquery.ui.sortable.js
+++ b/ui/jquery.ui.sortable.js
@@ -28,7 +28,7 @@ function copy( obj ) {
$.widget( "ui.sortable", $.ui.interaction, {
version: "@VERSION",
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)
// position: final CSS position of dragEl
@@ -100,14 +100,14 @@ $.widget( "ui.sortable", $.ui.interaction, {
// Create placeholder for while element is dragging
// TODO: what do we do about IDs?
// TODO: possibly use CSS for visibility portion
- this.placeholder = this.dragEl.clone().removeAttr('id').css({
- visibility : 'hidden',
- position : this.originalCssPosition || ''
+ this.placeholder = this.dragEl.clone().removeAttr("id").css({
+ visibility : "hidden",
+ position : this.originalCssPosition || ""
});
this.dragEl.after( this.placeholder );
- this.dragEl.css( 'position', 'absolute' );
+ this.dragEl.css( "position", "absolute" );
// // _createHelper() ensures that helpers are in the correct position
// // 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 ( 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
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
- this.dragEl.css( 'left', '' );
- this.dragEl.css( 'top', '' );
+ this.dragEl.css( "left", "" );
+ this.dragEl.css( "top", "" );
this.placeholder.remove();
@@ -474,4 +474,4 @@ $.widget( "ui.sortable", $.ui.interaction, {
this._super();
}
});
-})( jQuery );
\ No newline at end of file
+})( jQuery );
diff --git a/ui/jquery.ui.spinner.js b/ui/jquery.ui.spinner.js
index 406eefb91..1881c99ed 100644
--- a/ui/jquery.ui.spinner.js
+++ b/ui/jquery.ui.spinner.js
@@ -368,6 +368,14 @@ $.widget( "ui.spinner", {
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 );
@@ -445,14 +453,20 @@ $.widget( "ui.spinner", {
this._stepUp( 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 ) {
this._stepDown( 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 ) {