"jquery",
"./accordion_test_helpers",
"ui/accordion"
-], function( $, accordionTestHelper ) {
+], function( $, testHelper ) {
-var setupTeardown = accordionTestHelper.setupTeardown,
- state = accordionTestHelper.state;
+var setupTeardown = testHelper.setupTeardown,
+ state = testHelper.state;
module( "accordion: core", setupTeardown() );
"jquery",
"./accordion_test_helpers",
"ui/accordion"
-], function( $, accordionTestHelper ) {
+], function( $, testHelper ) {
-var setupTeardown = accordionTestHelper.setupTeardown,
- state = accordionTestHelper.state;
+var setupTeardown = testHelper.setupTeardown,
+ state = testHelper.state;
module( "accordion: events", setupTeardown() );
"jquery",
"./accordion_test_helpers",
"ui/accordion"
-], function( $, accordionTestHelper ) {
+], function( $, testHelper ) {
-var equalHeight = accordionTestHelper.equalHeight,
- setupTeardown = accordionTestHelper.setupTeardown,
- state = accordionTestHelper.state;
+var equalHeight = testHelper.equalHeight,
+ setupTeardown = testHelper.setupTeardown,
+ state = testHelper.state;
module( "accordion: methods", setupTeardown() );
"jquery",
"./accordion_test_helpers",
"ui/accordion"
-], function( $, accordionTestHelper ) {
+], function( $, testHelper ) {
-var equalHeight = accordionTestHelper.equalHeight,
- setupTeardown = accordionTestHelper.setupTeardown,
- state = accordionTestHelper.state;
+var equalHeight = testHelper.equalHeight,
+ setupTeardown = testHelper.setupTeardown,
+ state = testHelper.state;
module( "accordion: options", setupTeardown() );
-define( function() {
+define( [
+ "jquery",
+ "lib/helper",
+ "ui/accordion"
+], function( $, helper ) {
-return {
+return $.extend( helper, {
equalHeight: function( accordion, height ) {
accordion.find( ".ui-accordion-content" ).each(function() {
equal( $( this ).outerHeight(), height );
}).get();
QUnit.push( QUnit.equiv(actual, expected), actual, expected );
}
-
-};
+} );
} );
"./datepicker_test_helpers",
"ui/datepicker",
"ui/i18n/datepicker-he"
-], function( $, common, datepickerTestHelpers ) {
+], function( $, common, testHelper ) {
module( "datepicker: core", {
setup: function() {
asyncTest( "baseStructure", function() {
expect( 58 );
var header, title, table, thead, week, panel, inl, child,
- inp = datepickerTestHelpers.initNewInput(),
+ inp = testHelper.initNewInput(),
dp = $( "#ui-datepicker-div" );
function step1() {
- datepickerTestHelpers.onFocus( inp, function() {
+ testHelper.onFocus( inp, 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" );
function step2() {
// Editable month/year and button panel
- inp = datepickerTestHelpers.initNewInput({
+ inp = testHelper.initNewInput({
changeMonth: true,
changeYear: true,
showButtonPanel: true
});
- datepickerTestHelpers.onFocus( inp, function() {
+ testHelper.onFocus( inp, 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" );
function step3() {
// Multi-month 2
- inp = datepickerTestHelpers.initNewInput({ numberOfMonths: 2 });
- datepickerTestHelpers.onFocus( inp, function() {
+ inp = testHelper.initNewInput({ numberOfMonths: 2 });
+ testHelper.onFocus( inp, function() {
ok( dp.is( ".ui-datepicker-multi" ), "Structure multi [2] - multi-month" );
equal( dp.children().length, 3, "Structure multi [2] - child count" );
function step4() {
// Multi-month 3
- inp = datepickerTestHelpers.initNewInput({ numberOfMonths: 3 });
- datepickerTestHelpers.onFocus( inp, function() {
+ inp = testHelper.initNewInput({ numberOfMonths: 3 });
+ testHelper.onFocus( inp, 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" );
function step5() {
// Multi-month [2, 2]
- inp = datepickerTestHelpers.initNewInput({ numberOfMonths: [ 2, 2 ] });
- datepickerTestHelpers.onFocus( inp, function() {
+ inp = testHelper.initNewInput({ numberOfMonths: [ 2, 2 ] });
+ testHelper.onFocus( inp, function() {
ok( dp.is( ".ui-datepicker-multi" ), "Structure multi - multi-month" );
equal( dp.children().length, 6, "Structure multi [2,2] - child count" );
inp.datepicker( "hide" ).datepicker( "destroy" );
// Inline
- inl = datepickerTestHelpers.init( "#inl" );
+ inl = testHelper.init( "#inl" );
dp = inl.children();
ok( dp.is( ".ui-datepicker-inline" ), "Structure inline - main div" );
inl.datepicker( "destroy" );
// Inline multi-month
- inl = datepickerTestHelpers.init( "#inl", { numberOfMonths: 2 } );
+ inl = testHelper.init( "#inl", { numberOfMonths: 2 } );
dp = inl.children();
ok( dp.is( ".ui-datepicker-inline" ) && dp.is( ".ui-datepicker-multi" ), "Structure inline multi - main div" );
asyncTest( "customStructure", function() {
expect( 20 );
var header, panel, title, thead,
- inp = datepickerTestHelpers.initNewInput( $.datepicker.regional.he ),
+ inp = testHelper.initNewInput( $.datepicker.regional.he ),
dp = $( "#ui-datepicker-div" );
function step1() {
inp.datepicker( "option", "showButtonPanel", true );
- datepickerTestHelpers.onFocus( inp, function() {
+ testHelper.onFocus( inp, function() {
ok( dp.is( ".ui-datepicker-rtl" ), "Structure RTL - right-to-left" );
header = dp.children( ":first" );
// Hide prev/next
function step2() {
- inp = datepickerTestHelpers.initNewInput({
+ inp = testHelper.initNewInput({
hideIfNoPrevNext: true,
minDate: new Date( 2008, 2 - 1, 4 ),
maxDate: new Date( 2008, 2 - 1, 14 )
});
inp.val( "02/10/2008" );
- datepickerTestHelpers.onFocus( inp, function() {
+ testHelper.onFocus( inp, function() {
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" );
// Changeable Month with read-only year
function step3() {
- inp = datepickerTestHelpers.initNewInput({ changeMonth: true });
+ inp = testHelper.initNewInput({ changeMonth: true });
- datepickerTestHelpers.onFocus( inp, function() {
+ testHelper.onFocus( inp, function() {
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" );
// Changeable year with read-only month
function step4() {
- inp = datepickerTestHelpers.initNewInput({ changeYear: true });
+ inp = testHelper.initNewInput({ changeYear: true });
- datepickerTestHelpers.onFocus( inp, function() {
+ testHelper.onFocus( inp, function() {
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" );
// Read-only first day of week
function step5() {
- inp = datepickerTestHelpers.initNewInput({ changeFirstDay: false });
+ inp = testHelper.initNewInput({ changeFirstDay: false });
- datepickerTestHelpers.onFocus( inp, function() {
+ testHelper.onFocus( inp, function() {
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" );
test("keystrokes", function() {
expect( 26 );
- var inp = datepickerTestHelpers.init("#inp"),
+ var inp = testHelper.init("#inp"),
date = new Date();
inp.val("").datepicker("show").
simulate("keydown", {keyCode: $.ui.keyCode.ENTER});
- datepickerTestHelpers.equalsDate(inp.datepicker("getDate"), date, "Keystroke enter");
+ testHelper.equalsDate(inp.datepicker("getDate"), date, "Keystroke enter");
inp.val("02/04/2008").datepicker("show").
simulate("keydown", {keyCode: $.ui.keyCode.ENTER});
- datepickerTestHelpers.equalsDate(inp.datepicker("getDate"), new Date(2008, 2 - 1, 4),
+ testHelper.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});
- datepickerTestHelpers.equalsDate(inp.datepicker("getDate"), date, "Keystroke ctrl+home");
+ testHelper.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");
ok(inp.datepicker("getDate") == null, "Keystroke esc");
inp.val("02/04/2008").datepicker("show").
simulate("keydown", {keyCode: $.ui.keyCode.ESCAPE});
- datepickerTestHelpers.equalsDate(inp.datepicker("getDate"), new Date(2008, 2 - 1, 4),
+ testHelper.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});
- datepickerTestHelpers.equalsDate(inp.datepicker("getDate"), new Date(2008, 2 - 1, 4),
+ testHelper.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});
date.setDate(date.getDate() - 1);
- datepickerTestHelpers.equalsDate(inp.datepicker("getDate"), date, "Keystroke ctrl+left");
+ testHelper.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);
- datepickerTestHelpers.equalsDate(inp.datepicker("getDate"), date, "Keystroke left");
+ testHelper.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);
- datepickerTestHelpers.equalsDate(inp.datepicker("getDate"), date, "Keystroke ctrl+right");
+ testHelper.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);
- datepickerTestHelpers.equalsDate(inp.datepicker("getDate"), date, "Keystroke right");
+ testHelper.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);
- datepickerTestHelpers.equalsDate(inp.datepicker("getDate"), date, "Keystroke ctrl+up");
+ testHelper.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);
- datepickerTestHelpers.equalsDate(inp.datepicker("getDate"), date, "Keystroke up");
+ testHelper.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);
- datepickerTestHelpers.equalsDate(inp.datepicker("getDate"), date, "Keystroke ctrl+down");
+ testHelper.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);
- datepickerTestHelpers.equalsDate(inp.datepicker("getDate"), date, "Keystroke down");
+ testHelper.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});
- datepickerTestHelpers.equalsDate(inp.datepicker("getDate"), new Date(2008, 1 - 1, 4),
+ testHelper.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});
- datepickerTestHelpers.equalsDate(inp.datepicker("getDate"), new Date(2008, 3 - 1, 4),
+ testHelper.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});
- datepickerTestHelpers.equalsDate(inp.datepicker("getDate"), new Date(2007, 2 - 1, 4),
+ testHelper.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});
- datepickerTestHelpers.equalsDate(inp.datepicker("getDate"), new Date(2009, 2 - 1, 4),
+ testHelper.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});
- datepickerTestHelpers.equalsDate(inp.datepicker("getDate"), new Date(2008, 2 - 1, 29),
+ testHelper.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});
- datepickerTestHelpers.equalsDate(inp.datepicker("getDate"), new Date(2008, 2 - 1, 29),
+ testHelper.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});
- datepickerTestHelpers.equalsDate(inp.datepicker("getDate"), new Date(2007, 2 - 1, 28),
+ testHelper.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});
- datepickerTestHelpers.equalsDate(inp.datepicker("getDate"), new Date(2009, 2 - 1, 28),
+ testHelper.equalsDate(inp.datepicker("getDate"), new Date(2009, 2 - 1, 28),
"Keystroke ctrl+pgdn - Feb");
// Goto current
inp.datepicker("option", {gotoCurrent: true}).
simulate("keydown", {keyCode: $.ui.keyCode.PAGE_DOWN}).
simulate("keydown", {ctrlKey: true, keyCode: $.ui.keyCode.HOME}).
simulate("keydown", {keyCode: $.ui.keyCode.ENTER});
- datepickerTestHelpers.equalsDate(inp.datepicker("getDate"), new Date(2008, 2 - 1, 4),
+ testHelper.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});
- datepickerTestHelpers.equalsDate(inp.datepicker("getDate"), new Date(2007, 12 - 1, 4),
+ testHelper.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});
- datepickerTestHelpers.equalsDate(inp.datepicker("getDate"), new Date(2008, 4 - 1, 4),
+ testHelper.equalsDate(inp.datepicker("getDate"), new Date(2008, 4 - 1, 4),
"Keystroke pgdn step 2");
});
test("mouse", function() {
expect( 15 );
var inl,
- inp = datepickerTestHelpers.init("#inp"),
+ inp = testHelper.init("#inp"),
dp = $("#ui-datepicker-div"),
date = new Date();
inp.val("").datepicker("show");
$(".ui-datepicker-calendar tbody a:contains(10)", dp).simulate("click", {});
date.setDate(10);
- datepickerTestHelpers.equalsDate(inp.datepicker("getDate"), date, "Mouse click");
+ testHelper.equalsDate(inp.datepicker("getDate"), date, "Mouse click");
inp.val("02/04/2008").datepicker("show");
$(".ui-datepicker-calendar tbody a:contains(12)", dp).simulate("click", {});
- datepickerTestHelpers.equalsDate(inp.datepicker("getDate"), new Date(2008, 2 - 1, 12),
+ testHelper.equalsDate(inp.datepicker("getDate"), new Date(2008, 2 - 1, 12),
"Mouse click - preset");
inp.val("02/04/2008").datepicker("show");
inp.val("").datepicker("show");
ok(inp.datepicker("getDate") == null, "Mouse click - close");
inp.val("02/04/2008").datepicker("show");
$("button.ui-datepicker-close", dp).simulate("click", {});
- datepickerTestHelpers.equalsDate(inp.datepicker("getDate"), new Date(2008, 2 - 1, 4),
+ testHelper.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", {});
- datepickerTestHelpers.equalsDate(inp.datepicker("getDate"), new Date(2008, 2 - 1, 4),
+ testHelper.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", {});
date.setDate(14);
- datepickerTestHelpers.equalsDate(inp.datepicker("getDate"), date, "Mouse click - current");
+ testHelper.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");
- datepickerTestHelpers.equalsDate(inp.datepicker("getDate"), new Date(2008, 1 - 1, 16),
+ testHelper.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");
- datepickerTestHelpers.equalsDate(inp.datepicker("getDate"), new Date(2008, 3 - 1, 18),
+ testHelper.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");
- datepickerTestHelpers.equalsDate(inp.datepicker("getDate"), new Date(2008, 2 - 1, 16),
+ testHelper.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");
- datepickerTestHelpers.equalsDate(inp.datepicker("getDate"), new Date(2008, 2 - 1, 18),
+ testHelper.equalsDate(inp.datepicker("getDate"), new Date(2008, 2 - 1, 18),
"Mouse click - next + min/max");
// Inline
- inl = datepickerTestHelpers.init("#inl");
+ inl = testHelper.init("#inl");
dp = $(".ui-datepicker-inline", inl);
date = new Date();
inl.datepicker("setDate", date);
$(".ui-datepicker-calendar tbody a:contains(10)", dp).simulate("click", {});
date.setDate(10);
- datepickerTestHelpers.equalsDate(inl.datepicker("getDate"), date, "Mouse click inline");
+ testHelper.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", {});
- datepickerTestHelpers.equalsDate(inl.datepicker("getDate"), new Date(2008, 2 - 1, 12), "Mouse click inline - preset");
+ testHelper.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);
- datepickerTestHelpers.equalsDate(inl.datepicker("getDate"), date, "Mouse click inline - current");
+ testHelper.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");
- datepickerTestHelpers.equalsDate(inl.datepicker("getDate"), new Date(2008, 1 - 1, 16),
+ testHelper.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");
- datepickerTestHelpers.equalsDate(inl.datepicker("getDate"), new Date(2008, 3 - 1, 18),
+ testHelper.equalsDate(inl.datepicker("getDate"), new Date(2008, 3 - 1, 18),
"Mouse click inline - next");
});
"jquery",
"./datepicker_test_helpers",
"ui/datepicker"
-], function( $, datepickerTestHelpers ) {
+], function( $, testHelper ) {
module("datepicker: events");
test("events", function() {
expect( 26 );
var dateStr, newMonthYear, inp2,
- inp = datepickerTestHelpers.init("#inp", {onSelect: callback}),
+ inp = testHelper.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], datepickerTestHelpers.PROP_NAME), "Callback selected inst");
+ equal(selectedInst, $.data(inp[0], testHelper.PROP_NAME), "Callback selected inst");
equal(selectedDate, $.datepicker.formatDate("mm/dd/yy", date),
"Callback selected date");
inp.val("").datepicker("show").
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], datepickerTestHelpers.PROP_NAME), "Callback change month/year inst");
+ equal(selectedInst, $.data(inp[0], testHelper.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});
val("").datepicker("show").
simulate("keydown", {keyCode: $.ui.keyCode.ESCAPE});
equal(selectedThis, inp[0], "Callback close this");
- equal(selectedInst, $.data(inp[0], datepickerTestHelpers.PROP_NAME), "Callback close inst");
+ equal(selectedInst, $.data(inp[0], testHelper.PROP_NAME), "Callback close inst");
equal(selectedDate, "", "Callback close date - esc");
inp.val("").datepicker("show").
simulate("keydown", {keyCode: $.ui.keyCode.ENTER});
simulate("keydown", {ctrlKey: true, keyCode: $.ui.keyCode.END});
equal(selectedDate, "", "Callback close date - ctrl+end");
- inp2 = datepickerTestHelpers.init("#inp2");
+ inp2 = testHelper.init("#inp2");
inp2.datepicker().datepicker("option", {onClose: callback}).datepicker("show");
inp.datepicker("show");
equal(selectedThis, inp2[0], "Callback close this");
test("beforeShowDay-getDate", function() {
expect( 3 );
- var inp = datepickerTestHelpers.init("#inp", {beforeShowDay: function() { inp.datepicker("getDate"); return [true, ""]; }}),
+ var inp = testHelper.init("#inp", {beforeShowDay: function() { inp.datepicker("getDate"); return [true, ""]; }}),
dp = $("#ui-datepicker-div");
inp.val("01/01/2010").datepicker("show");
// contains non-breaking space
"jquery",
"./datepicker_test_helpers",
"ui/datepicker"
-], function( $, datepickerTestHelpers ) {
+], function( $, testHelper ) {
module("datepicker: methods");
test("destroy", function() {
expect( 33 );
var inl,
- inp = datepickerTestHelpers.init("#inp");
+ inp = testHelper.init("#inp");
ok(inp.is(".hasDatepicker"), "Default - marker class set");
- ok($.data(inp[0], datepickerTestHelpers.PROP_NAME), "Default - instance present");
+ ok($.data(inp[0], testHelper.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], datepickerTestHelpers.PROP_NAME), "Default - instance absent");
+ ok(!$.data(inp[0], testHelper.PROP_NAME), "Default - instance absent");
ok(inp.next().is("#alt"), "Default - button absent");
// With button
- inp= datepickerTestHelpers.init("#inp", {showOn: "both"});
+ inp= testHelper.init("#inp", {showOn: "both"});
ok(inp.is(".hasDatepicker"), "Button - marker class set");
- ok($.data(inp[0], datepickerTestHelpers.PROP_NAME), "Button - instance present");
+ ok($.data(inp[0], testHelper.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], datepickerTestHelpers.PROP_NAME), "Button - instance absent");
+ ok(!$.data(inp[0], testHelper.PROP_NAME), "Button - instance absent");
ok(inp.next().is("#alt"), "Button - button removed");
// With append text
- inp = datepickerTestHelpers.init("#inp", {appendText: "Testing"});
+ inp = testHelper.init("#inp", {appendText: "Testing"});
ok(inp.is(".hasDatepicker"), "Append - marker class set");
- ok($.data(inp[0], datepickerTestHelpers.PROP_NAME), "Append - instance present");
+ ok($.data(inp[0], testHelper.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], datepickerTestHelpers.PROP_NAME), "Append - instance absent");
+ ok(!$.data(inp[0], testHelper.PROP_NAME), "Append - instance absent");
ok(inp.next().is("#alt"), "Append - append text removed");
// With both
- inp= datepickerTestHelpers.init("#inp", {showOn: "both", buttonImageOnly: true,
+ inp= testHelper.init("#inp", {showOn: "both", buttonImageOnly: true,
buttonImage: "images/calendar.gif", appendText: "Testing"});
ok(inp.is(".hasDatepicker"), "Both - marker class set");
- ok($.data(inp[0], datepickerTestHelpers.PROP_NAME), "Both - instance present");
+ ok($.data(inp[0], testHelper.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], datepickerTestHelpers.PROP_NAME), "Both - instance absent");
+ ok(!$.data(inp[0], testHelper.PROP_NAME), "Both - instance absent");
ok(inp.next().is("#alt"), "Both - button and append text absent");
// Inline
- inl = datepickerTestHelpers.init("#inl");
+ inl = testHelper.init("#inl");
ok(inl.is(".hasDatepicker"), "Inline - marker class set");
ok(inl.html() !== "", "Inline - datepicker present");
- ok($.data(inl[0], datepickerTestHelpers.PROP_NAME), "Inline - instance present");
+ ok($.data(inl[0], testHelper.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], datepickerTestHelpers.PROP_NAME), "Inline - instance absent");
+ ok(!$.data(inl[0], testHelper.PROP_NAME), "Inline - instance absent");
ok(inl.next().length === 0 || inl.next().is("p"), "Inline - button absent");
});
test("enableDisable", function() {
expect( 33 );
var inl, dp,
- inp = datepickerTestHelpers.init("#inp");
+ inp = testHelper.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[0].disabled, "Enable/disable - field now enabled");
inp.datepicker("destroy");
// With a button
- inp = datepickerTestHelpers.init("#inp", {showOn: "button"});
+ inp = testHelper.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");
ok(!inp.next("button")[0].disabled, "Enable/disable button - button now enabled");
inp.datepicker("destroy");
// With an image button
- inp = datepickerTestHelpers.init("#inp", {showOn: "button", buttonImageOnly: true,
+ inp = testHelper.init("#inp", {showOn: "button", buttonImageOnly: true,
buttonImage: "images/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 now enabled");
inp.datepicker("destroy");
// Inline
- inl = datepickerTestHelpers.init("#inl", {changeYear: true});
+ inl = testHelper.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");
"ui/i18n/datepicker-fr",
"ui/i18n/datepicker-he",
"ui/i18n/datepicker-zh-CN"
-], function( $, datepickerTestHelpers ) {
+], function( $, testHelper ) {
module("datepicker: options");
test("setDefaults", function() {
expect( 3 );
- datepickerTestHelpers.init("#inp");
+ testHelper.init("#inp");
equal($.datepicker._defaults.showOn, "focus", "Initial showOn");
$.datepicker.setDefaults({showOn: "button"});
equal($.datepicker._defaults.showOn, "button", "Change default showOn");
test("option", function() {
expect( 17 );
- var inp = datepickerTestHelpers.init("#inp"),
- inst = $.data(inp[0], datepickerTestHelpers.PROP_NAME);
+ var inp = testHelper.init("#inp"),
+ inst = $.data(inp[0], testHelper.PROP_NAME);
// Set option
equal(inst.settings.showOn, null, "Initial setting showOn");
equal($.datepicker._get(inst, "showOn"), "focus", "Initial instance showOn");
equal($.datepicker._get(inst, "showOn"), "focus", "Restore instance showOn");
equal($.datepicker._defaults.showOn, "focus", "Retain default showOn");
// Get option
- inp = datepickerTestHelpers.init("#inp");
+ inp = testHelper.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");
test( "disabled", function() {
expect(8);
- var inp = datepickerTestHelpers.init("#inp");
+ var inp = testHelper.init("#inp");
ok(!inp.datepicker("isDisabled"), "Initially marked as enabled");
ok(!inp[0].disabled, "Field initially enabled");
inp.datepicker("option", "disabled", true);
ok(!inp[0].disabled, "Field now enabled");
inp.datepicker("destroy");
- inp = datepickerTestHelpers.init("#inp", { disabled: true });
+ inp = testHelper.init("#inp", { disabled: true });
ok(inp.datepicker("isDisabled"), "Initially marked as disabled");
ok(inp[0].disabled, "Field initially disabled");
});
test("change", function() {
expect( 12 );
- var inp = datepickerTestHelpers.init("#inp"),
- inst = $.data(inp[0], datepickerTestHelpers.PROP_NAME);
+ var inp = testHelper.init("#inp"),
+ inst = $.data(inp[0], testHelper.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");
expect( isOldIE ? 25 : 29 );
function step0() {
- var inp = datepickerTestHelpers.initNewInput(),
+ var inp = testHelper.initNewInput(),
dp = $( "#ui-datepicker-div" );
button = inp.siblings( "button" );
image = inp.siblings( "img" );
ok( image.length === 0, "Focus - image absent" );
- datepickerTestHelpers.onFocus( inp, function() {
+ testHelper.onFocus( inp, function() {
ok( dp.is( ":visible" ), "Focus - rendered on focus" );
inp.simulate( "keydown", { keyCode: $.ui.keyCode.ESCAPE } );
ok( !dp.is( ":visible" ), "Focus - hidden on exit" );
function step1() {
- var inp = datepickerTestHelpers.initNewInput(),
+ var inp = testHelper.initNewInput(),
dp = $( "#ui-datepicker-div" );
- datepickerTestHelpers.onFocus( inp, function() {
+ testHelper.onFocus( inp, function() {
ok( dp.is( ":visible" ), "Focus - rendered on focus" );
body.simulate( "mousedown", {} );
ok( !dp.is( ":visible" ), "Focus - hidden on external click" );
}
function step2() {
- var inp = datepickerTestHelpers.initNewInput({
+ var inp = testHelper.initNewInput({
showOn: "button",
buttonText: "Popup"
}),
ok( image.length === 0, "Button - image absent" );
equal( button.text(), "Popup", "Button - button text" );
- datepickerTestHelpers.onFocus( inp, function() {
+ testHelper.onFocus( inp, function() {
ok( !dp.is( ":visible" ), "Button - not rendered on focus" );
button.click();
ok( dp.is( ":visible" ), "Button - rendered on button click" );
}
function step3() {
- var inp = datepickerTestHelpers.initNewInput({
+ var inp = testHelper.initNewInput({
showOn: "button",
buttonImageOnly: true,
buttonImage: "images/calendar.gif",
ok( /images\/calendar\.gif$/.test( image.attr( "src" ) ), "Image button - image source" );
equal( image.attr( "title" ), "Cal", "Image button - image text" );
- datepickerTestHelpers.onFocus( inp, function() {
+ testHelper.onFocus( inp, function() {
ok( !dp.is( ":visible" ), "Image button - not rendered on focus" );
image.click();
ok( dp.is( ":visible" ), "Image button - rendered on image click" );
}
function step4() {
- var inp = datepickerTestHelpers.initNewInput({
+ var inp = testHelper.initNewInput({
showOn: "both",
buttonImage: "images/calendar.gif"
}),
// TODO: This test occasionally fails to focus in IE8 in BrowserStack
if ( !isOldIE ) {
- datepickerTestHelpers.onFocus( inp, function() {
+ testHelper.onFocus( inp, function() {
ok( dp.is( ":visible" ), "Both - rendered on focus" );
body.simulate( "mousedown", {} );
ok( !dp.is( ":visible" ), "Both - hidden on external click" );
test("otherMonths", function() {
expect( 8 );
- var inp = datepickerTestHelpers.init("#inp"),
+ var inp = testHelper.init("#inp"),
pop = $("#ui-datepicker-div");
inp.val("06/01/2009").datepicker("show");
equal(pop.find("tbody").text(),
test("defaultDate", function() {
expect( 16 );
- var inp = datepickerTestHelpers.init("#inp"),
+ var inp = testHelper.init("#inp"),
date = new Date();
inp.val("").datepicker("show").
simulate("keydown", {keyCode: $.ui.keyCode.ENTER});
- datepickerTestHelpers.equalsDate(inp.datepicker("getDate"), date, "Default date null");
+ testHelper.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});
date.setDate(date.getDate() - 2);
- datepickerTestHelpers.equalsDate(inp.datepicker("getDate"), date, "Default date -2");
+ testHelper.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});
date.setDate(date.getDate() + 3);
- datepickerTestHelpers.equalsDate(inp.datepicker("getDate"), date, "Default date 3");
+ testHelper.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});
- datepickerTestHelpers.equalsDate(inp.datepicker("getDate"), date, "Default date NaN");
+ testHelper.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});
date.setDate(date.getDate() - 1);
- datepickerTestHelpers.equalsDate(inp.datepicker("getDate"), date, "Default date -1d");
+ testHelper.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);
- datepickerTestHelpers.equalsDate(inp.datepicker("getDate"), date, "Default date +3D");
+ testHelper.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);
- datepickerTestHelpers.equalsDate(inp.datepicker("getDate"), date, "Default date -2 w");
+ testHelper.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);
- datepickerTestHelpers.equalsDate(inp.datepicker("getDate"), date, "Default date +1 W");
+ testHelper.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 = datepickerTestHelpers.addMonths(new Date(), -1);
- datepickerTestHelpers.equalsDate(inp.datepicker("getDate"), date, "Default date -1 m");
+ date = testHelper.addMonths(new Date(), -1);
+ testHelper.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 = datepickerTestHelpers.addMonths(new Date(), 2);
- datepickerTestHelpers.equalsDate(inp.datepicker("getDate"), date, "Default date +2M");
+ date = testHelper.addMonths(new Date(), 2);
+ testHelper.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);
- datepickerTestHelpers.equalsDate(inp.datepicker("getDate"), date, "Default date -2y");
+ testHelper.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);
- datepickerTestHelpers.equalsDate(inp.datepicker("getDate"), date, "Default date +1 Y");
+ testHelper.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 = datepickerTestHelpers.addMonths(new Date(), 1);
+ date = testHelper.addMonths(new Date(), 1);
date.setDate(date.getDate() + 10);
- datepickerTestHelpers.equalsDate(inp.datepicker("getDate"), date, "Default date +1M +10d");
+ testHelper.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});
date = new Date(2007, 7 - 1, 4);
- datepickerTestHelpers.equalsDate(inp.datepicker("getDate"), date, "Default date 07/04/2007");
+ testHelper.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);
- datepickerTestHelpers.equalsDate(inp.datepicker("getDate"), date, "Default date 2007-04-02");
+ testHelper.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});
- datepickerTestHelpers.equalsDate(inp.datepicker("getDate"), date, "Default date 01/26/2007");
+ testHelper.equalsDate(inp.datepicker("getDate"), date, "Default date 01/26/2007");
});
test("miscellaneous", function() {
expect( 19 );
var curYear, longNames, shortNames, date,
dp = $("#ui-datepicker-div"),
- inp = datepickerTestHelpers.init("#inp");
+ inp = testHelper.init("#inp");
// Year range
function genRange(start, offset) {
var i = start,
test("minMax", function() {
expect( 23 );
var date,
- inp = datepickerTestHelpers.init("#inp"),
+ inp = testHelper.init("#inp"),
dp = $("#ui-datepicker-div"),
lastYear = new Date(2007, 6 - 1, 4),
nextYear = new Date(2009, 6 - 1, 4),
inp.val("06/04/2008").datepicker("show");
inp.simulate("keydown", {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_UP}).
simulate("keydown", {keyCode: $.ui.keyCode.ENTER});
- datepickerTestHelpers.equalsDate(inp.datepicker("getDate"), lastYear,
+ testHelper.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});
- datepickerTestHelpers.equalsDate(inp.datepicker("getDate"), nextYear,
+ testHelper.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});
- datepickerTestHelpers.equalsDate(inp.datepicker("getDate"), minDate,
+ testHelper.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});
- datepickerTestHelpers.equalsDate(inp.datepicker("getDate"), nextYear,
+ testHelper.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});
- datepickerTestHelpers.equalsDate(inp.datepicker("getDate"), minDate,
+ testHelper.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});
- datepickerTestHelpers.equalsDate(inp.datepicker("getDate"), maxDate,
+ testHelper.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});
- datepickerTestHelpers.equalsDate(inp.datepicker("getDate"), lastYear,
+ testHelper.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});
- datepickerTestHelpers.equalsDate(inp.datepicker("getDate"), maxDate,
+ testHelper.equalsDate(inp.datepicker("getDate"), maxDate,
"Min/max - null, 12/07/2008 - ctrl+pgdn");
// Relative dates
date = new Date();
datepicker("hide").val("").datepicker("show");
inp.simulate("keydown", {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_UP}).
simulate("keydown", {keyCode: $.ui.keyCode.ENTER});
- datepickerTestHelpers.equalsDate(inp.datepicker("getDate"), date,
+ testHelper.equalsDate(inp.datepicker("getDate"), date,
"Min/max - -1w, +1 M +10 D - ctrl+pgup");
- date = datepickerTestHelpers.addMonths(new Date(), 1);
+ date = testHelper.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});
- datepickerTestHelpers.equalsDate(inp.datepicker("getDate"), date,
+ testHelper.equalsDate(inp.datepicker("getDate"), date,
"Min/max - -1w, +1 M +10 D - ctrl+pgdn");
// With existing date
- inp = datepickerTestHelpers.init("#inp");
+ inp = testHelper.init("#inp");
inp.val("06/04/2008").datepicker("option", {minDate: minDate});
- datepickerTestHelpers.equalsDate(inp.datepicker("getDate"), new Date(2008, 6 - 1, 4), "Min/max - setDate > min");
+ testHelper.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});
- datepickerTestHelpers.equalsDate(inp.datepicker("getDate"), minDate, "Min/max - setDate < min");
+ testHelper.equalsDate(inp.datepicker("getDate"), minDate, "Min/max - setDate < min");
inp.datepicker("option", {minDate: null}).val("06/04/2008").datepicker("option", {maxDate: maxDate});
- datepickerTestHelpers.equalsDate(inp.datepicker("getDate"), new Date(2008, 6 - 1, 4), "Min/max - setDate < max");
+ testHelper.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});
- datepickerTestHelpers.equalsDate(inp.datepicker("getDate"), maxDate, "Min/max - setDate > max");
+ testHelper.equalsDate(inp.datepicker("getDate"), maxDate, "Min/max - setDate > max");
inp.datepicker("option", {maxDate: null}).val("01/04/2008").datepicker("option", {minDate: minDate, maxDate: maxDate});
- datepickerTestHelpers.equalsDate(inp.datepicker("getDate"), minDate, "Min/max - setDate < min");
+ testHelper.equalsDate(inp.datepicker("getDate"), minDate, "Min/max - setDate < min");
inp.datepicker("option", {maxDate: null}).val("06/04/2008").datepicker("option", {minDate: minDate, maxDate: maxDate});
- datepickerTestHelpers.equalsDate(inp.datepicker("getDate"), new Date(2008, 6 - 1, 4), "Min/max - setDate > min, < max");
+ testHelper.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});
- datepickerTestHelpers.equalsDate(inp.datepicker("getDate"), maxDate, "Min/max - setDate > max");
+ testHelper.equalsDate(inp.datepicker("getDate"), maxDate, "Min/max - setDate > max");
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");
test("setDate", function() {
expect( 24 );
var inl, alt, minDate, maxDate, dateAndTimeToSet, dateAndTimeClone,
- inp = datepickerTestHelpers.init("#inp"),
+ inp = testHelper.init("#inp"),
date1 = new Date(2008, 6 - 1, 4),
date2 = new Date();
ok(inp.datepicker("getDate") == null, "Set date - default");
inp.datepicker("setDate", date1);
- datepickerTestHelpers.equalsDate(inp.datepicker("getDate"), date1, "Set date - 2008-06-04");
+ testHelper.equalsDate(inp.datepicker("getDate"), date1, "Set date - 2008-06-04");
date1 = new Date();
date1.setDate(date1.getDate() + 7);
inp.datepicker("setDate", +7);
- datepickerTestHelpers.equalsDate(inp.datepicker("getDate"), date1, "Set date - +7");
+ testHelper.equalsDate(inp.datepicker("getDate"), date1, "Set date - +7");
date2.setFullYear(date2.getFullYear() + 2);
inp.datepicker("setDate", "+2y");
- datepickerTestHelpers.equalsDate(inp.datepicker("getDate"), date2, "Set date - +2y");
+ testHelper.equalsDate(inp.datepicker("getDate"), date2, "Set date - +2y");
inp.datepicker("setDate", date1, date2);
- datepickerTestHelpers.equalsDate(inp.datepicker("getDate"), date1, "Set date - two dates");
+ testHelper.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");
- datepickerTestHelpers.equalsDate(inp.datepicker("getDate"), date1, "Set date - c +7");
+ testHelper.equalsDate(inp.datepicker("getDate"), date1, "Set date - c +7");
date1.setDate(date1.getDate() + 7);
inp.datepicker("setDate", "c+7");
- datepickerTestHelpers.equalsDate(inp.datepicker("getDate"), date1, "Set date - c+7");
+ testHelper.equalsDate(inp.datepicker("getDate"), date1, "Set date - c+7");
date1.setDate(date1.getDate() - 21);
inp.datepicker("setDate", "c -3 w");
- datepickerTestHelpers.equalsDate(inp.datepicker("getDate"), date1, "Set date - c -3 w");
+ testHelper.equalsDate(inp.datepicker("getDate"), date1, "Set date - c -3 w");
// Inline
- inl = datepickerTestHelpers.init("#inl");
+ inl = testHelper.init("#inl");
date1 = new Date(2008, 6 - 1, 4);
date2 = new Date();
- datepickerTestHelpers.equalsDate(inl.datepicker("getDate"), date2, "Set date inline - default");
+ testHelper.equalsDate(inl.datepicker("getDate"), date2, "Set date inline - default");
inl.datepicker("setDate", date1);
- datepickerTestHelpers.equalsDate(inl.datepicker("getDate"), date1, "Set date inline - 2008-06-04");
+ testHelper.equalsDate(inl.datepicker("getDate"), date1, "Set date inline - 2008-06-04");
date1 = new Date();
date1.setDate(date1.getDate() + 7);
inl.datepicker("setDate", +7);
- datepickerTestHelpers.equalsDate(inl.datepicker("getDate"), date1, "Set date inline - +7");
+ testHelper.equalsDate(inl.datepicker("getDate"), date1, "Set date inline - +7");
date2.setFullYear(date2.getFullYear() + 2);
inl.datepicker("setDate", "+2y");
- datepickerTestHelpers.equalsDate(inl.datepicker("getDate"), date2, "Set date inline - +2y");
+ testHelper.equalsDate(inl.datepicker("getDate"), date2, "Set date inline - +2y");
inl.datepicker("setDate", date1, date2);
- datepickerTestHelpers.equalsDate(inl.datepicker("getDate"), date1, "Set date inline - two dates");
+ testHelper.equalsDate(inl.datepicker("getDate"), date1, "Set date inline - two dates");
inl.datepicker("setDate");
ok(inl.datepicker("getDate") == null, "Set date inline - null");
// Alternate field
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 = datepickerTestHelpers.init("#inp");
+ inp = testHelper.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);
- datepickerTestHelpers.equalsDate(inp.datepicker("getDate"), date2, "Set date min/max - setDate > min");
+ testHelper.equalsDate(inp.datepicker("getDate"), date2, "Set date min/max - setDate > min");
inp.datepicker("setDate", date1);
- datepickerTestHelpers.equalsDate(inp.datepicker("getDate"), minDate, "Set date min/max - setDate < min");
+ testHelper.equalsDate(inp.datepicker("getDate"), minDate, "Set date min/max - setDate < min");
inp.val("").datepicker("option", {maxDate: maxDate, minDate: null}).datepicker("setDate", date1);
- datepickerTestHelpers.equalsDate(inp.datepicker("getDate"), date1, "Set date min/max - setDate < max");
+ testHelper.equalsDate(inp.datepicker("getDate"), date1, "Set date min/max - setDate < max");
inp.datepicker("setDate", date2);
- datepickerTestHelpers.equalsDate(inp.datepicker("getDate"), maxDate, "Set date min/max - setDate > max");
+ testHelper.equalsDate(inp.datepicker("getDate"), maxDate, "Set date min/max - setDate > max");
inp.val("").datepicker("option", {minDate: minDate}).datepicker("setDate", date1);
- datepickerTestHelpers.equalsDate(inp.datepicker("getDate"), minDate, "Set date min/max - setDate < min");
+ testHelper.equalsDate(inp.datepicker("getDate"), minDate, "Set date min/max - setDate < min");
inp.datepicker("setDate", date2);
- datepickerTestHelpers.equalsDate(inp.datepicker("getDate"), maxDate, "Set date min/max - setDate > max");
+ testHelper.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);
test("altField", function() {
expect( 10 );
- var inp = datepickerTestHelpers.init("#inp"),
+ var inp = testHelper.init("#inp"),
alt = $("#alt");
// No alternate field set
alt.val("");
test("autoSize", function() {
expect( 15 );
- var inp = datepickerTestHelpers.init("#inp");
+ var inp = testHelper.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");
test("daylightSaving", function() {
expect( 25 );
- var inp = datepickerTestHelpers.init("#inp"),
+ var inp = testHelper.init("#inp"),
dp = $("#ui-datepicker-div");
ok(true, "Daylight saving - " + new Date());
// Australia, Sydney - AM change, southern hemisphere
expect( 13 );
// Before show
var dp, day20, day21,
- inp = datepickerTestHelpers.init("#inp", {beforeShow: beforeAll}),
+ inp = testHelper.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");
deepEqual(beforeShowInst, inst, "Before show - inst OK");
inp.datepicker("hide").datepicker("destroy");
// Before show day
- inp = datepickerTestHelpers.init("#inp", {beforeShowDay: beforeDay});
+ inp = testHelper.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");
test("beforeShowDay - tooltips with quotes", function() {
expect( 1 );
var inp, dp;
- inp = datepickerTestHelpers.init("#inp", {
+ inp = testHelper.init("#inp", {
beforeShowDay: function() {
return [ true, "", "'" ];
}
test("localisation", function() {
expect( 24 );
var dp, month, day, date,
- inp = datepickerTestHelpers.init("#inp", $.datepicker.regional.fr);
+ inp = testHelper.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");
test("parseDate", function() {
expect( 26 );
- datepickerTestHelpers.init("#inp");
+ testHelper.init("#inp");
var currentYear, gmtDate, fr, settings, zh;
ok($.datepicker.parseDate("d m y", "") == null, "Parse date empty");
- datepickerTestHelpers.equalsDate($.datepicker.parseDate("d m y", "3 2 01"),
+ testHelper.equalsDate($.datepicker.parseDate("d m y", "3 2 01"),
new Date(2001, 2 - 1, 3), "Parse date d m y");
- datepickerTestHelpers.equalsDate($.datepicker.parseDate("dd mm yy", "03 02 2001"),
+ testHelper.equalsDate($.datepicker.parseDate("dd mm yy", "03 02 2001"),
new Date(2001, 2 - 1, 3), "Parse date dd mm yy");
- datepickerTestHelpers.equalsDate($.datepicker.parseDate("d m y", "13 12 01"),
+ testHelper.equalsDate($.datepicker.parseDate("d m y", "13 12 01"),
new Date(2001, 12 - 1, 13), "Parse date d m y");
- datepickerTestHelpers.equalsDate($.datepicker.parseDate("dd mm yy", "13 12 2001"),
+ testHelper.equalsDate($.datepicker.parseDate("dd mm yy", "13 12 2001"),
new Date(2001, 12 - 1, 13), "Parse date dd mm yy");
- datepickerTestHelpers.equalsDate($.datepicker.parseDate("y-o", "01-34"),
+ testHelper.equalsDate($.datepicker.parseDate("y-o", "01-34"),
new Date(2001, 2 - 1, 3), "Parse date y-o");
- datepickerTestHelpers.equalsDate($.datepicker.parseDate("yy-oo", "2001-347"),
+ testHelper.equalsDate($.datepicker.parseDate("yy-oo", "2001-347"),
new Date(2001, 12 - 1, 13), "Parse date yy-oo");
- datepickerTestHelpers.equalsDate($.datepicker.parseDate("oo yy", "348 2004"),
+ testHelper.equalsDate($.datepicker.parseDate("oo yy", "348 2004"),
new Date(2004, 12 - 1, 13), "Parse date oo yy");
- datepickerTestHelpers.equalsDate($.datepicker.parseDate("D d M y", "Sat 3 Feb 01"),
+ testHelper.equalsDate($.datepicker.parseDate("D d M y", "Sat 3 Feb 01"),
new Date(2001, 2 - 1, 3), "Parse date D d M y");
- datepickerTestHelpers.equalsDate($.datepicker.parseDate("d MM DD yy", "3 February Saturday 2001"),
+ testHelper.equalsDate($.datepicker.parseDate("d MM DD yy", "3 February Saturday 2001"),
new Date(2001, 2 - 1, 3), "Parse date dd MM DD yy");
- datepickerTestHelpers.equalsDate($.datepicker.parseDate("DD, MM d, yy", "Saturday, February 3, 2001"),
+ testHelper.equalsDate($.datepicker.parseDate("DD, MM d, yy", "Saturday, February 3, 2001"),
new Date(2001, 2 - 1, 3), "Parse date DD, MM d, yy");
- datepickerTestHelpers.equalsDate($.datepicker.parseDate("'day' d 'of' MM (''DD''), yy",
+ testHelper.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();
- datepickerTestHelpers.equalsDate($.datepicker.parseDate("y-m-d", (currentYear - 2000) + "-02-03"),
+ testHelper.equalsDate($.datepicker.parseDate("y-m-d", (currentYear - 2000) + "-02-03"),
new Date(currentYear, 2 - 1, 3), "Parse date y-m-d - default cutuff");
- datepickerTestHelpers.equalsDate($.datepicker.parseDate("y-m-d", (currentYear - 2000 + 10) + "-02-03"),
+ testHelper.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");
- datepickerTestHelpers.equalsDate($.datepicker.parseDate("y-m-d", (currentYear - 2000 + 11) + "-02-03"),
+ testHelper.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");
- datepickerTestHelpers.equalsDate($.datepicker.parseDate("y-m-d", "80-02-03", {shortYearCutoff: 80}),
+ testHelper.equalsDate($.datepicker.parseDate("y-m-d", "80-02-03", {shortYearCutoff: 80}),
new Date(2080, 2 - 1, 3), "Parse date y-m-d - cutoff 80");
- datepickerTestHelpers.equalsDate($.datepicker.parseDate("y-m-d", "81-02-03", {shortYearCutoff: 80}),
+ testHelper.equalsDate($.datepicker.parseDate("y-m-d", "81-02-03", {shortYearCutoff: 80}),
new Date(1981, 2 - 1, 3), "Parse date y-m-d - cutoff 80");
- datepickerTestHelpers.equalsDate($.datepicker.parseDate("y-m-d", (currentYear - 2000 + 60) + "-02-03", {shortYearCutoff: "+60"}),
+ testHelper.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");
- datepickerTestHelpers.equalsDate($.datepicker.parseDate("y-m-d", (currentYear - 2000 + 61) + "-02-03", {shortYearCutoff: "+60"}),
+ testHelper.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());
- datepickerTestHelpers.equalsDate($.datepicker.parseDate("@", "981158400000"), gmtDate, "Parse date @");
- datepickerTestHelpers.equalsDate($.datepicker.parseDate("!", "631167552000000000"), gmtDate, "Parse date !");
+ testHelper.equalsDate($.datepicker.parseDate("@", "981158400000"), gmtDate, "Parse date @");
+ testHelper.equalsDate($.datepicker.parseDate("!", "631167552000000000"), gmtDate, "Parse date !");
fr = $.datepicker.regional.fr;
settings = {dayNamesShort: fr.dayNamesShort, dayNames: fr.dayNames,
monthNamesShort: fr.monthNamesShort, monthNames: fr.monthNames};
- datepickerTestHelpers.equalsDate($.datepicker.parseDate("D d M y", "Lun. 9 avr. 01", settings),
+ testHelper.equalsDate($.datepicker.parseDate("D d M y", "Lun. 9 avr. 01", settings),
new Date(2001, 4 - 1, 9), "Parse date D M y with settings");
- datepickerTestHelpers.equalsDate($.datepicker.parseDate("d MM DD yy", "9 Avril Lundi 2001", settings),
+ testHelper.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");
- datepickerTestHelpers.equalsDate($.datepicker.parseDate("DD, MM d, yy", "Lundi, Avril 9, 2001", settings),
+ testHelper.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");
- datepickerTestHelpers.equalsDate($.datepicker.parseDate("'jour' d 'de' MM (''DD''), yy", "jour 9 de Avril ('Lundi'), 2001", settings),
+ testHelper.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"];
- datepickerTestHelpers.equalsDate($.datepicker.parseDate("yy M d", "2011 十一月 22", zh),
+ testHelper.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() {
expect( 18 );
- datepickerTestHelpers.init("#inp");
+ testHelper.init("#inp");
var fr, settings;
function expectError(expr, value, error) {
try {
test("formatDate", function() {
expect( 16 );
- datepickerTestHelpers.init("#inp");
+ testHelper.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");
var inp, dp;
- inp = datepickerTestHelpers.init( "#inp", {
+ inp = testHelper.init( "#inp", {
beforeShow: function() {
}
});
equal( dp.css( "display" ), "block", "beforeShow returns nothing" );
inp.datepicker( "hide" ).datepicker( "destroy" );
- inp = datepickerTestHelpers.init( "#inp", {
+ inp = testHelper.init( "#inp", {
beforeShow: function() {
return true;
}
inp.datepicker( "hide" );
inp.datepicker( "destroy" );
- inp = datepickerTestHelpers.init( "#inp", {
+ inp = testHelper.init( "#inp", {
beforeShow: function() {
return false;
}
define( [
+ "jquery",
"lib/helper",
"ui/datepicker"
-], function( testHelpers ) {
+], function( $, helper ) {
-var datepickerTestHelpers = {
+return $.extend( helper, {
addMonths: function(date, offset) {
var maxDay = 32 - new Date(date.getFullYear(), date.getMonth() + offset, 32).getDate();
date.setDate(Math.min(date.getDate(), maxDay));
date.setMonth(date.getMonth() + offset);
return date;
},
+
equalsDate: function(d1, d2, message) {
if (!d1 || !d2) {
ok(false, message + " - missing date");
d2 = new Date(d2.getFullYear(), d2.getMonth(), d2.getDate());
equal(d1.toString(), d2.toString(), message);
},
+
init: function( id, options ) {
$.datepicker.setDefaults( $.datepicker.regional[ "" ] );
return $( id ).datepicker( $.extend( { showAnim: "" }, options || {} ) );
},
+
initNewInput: function( options ) {
var id = $( "<input>" ).appendTo( "#qunit-fixture" );
- return datepickerTestHelpers.init( id, options );
+ return this.init( id, options );
},
- onFocus: testHelpers.onFocus,
- PROP_NAME: "datepicker"
-};
-return datepickerTestHelpers;
+ PROP_NAME: "datepicker"
+} );
} );
"jquery",
"./dialog_test_helpers",
"ui/dialog"
-], function( $, dialogTestHelpers ) {
+], function( $, testHelper ) {
module("dialog: events");
});
handle = $(".ui-dialog-titlebar", element.dialog("widget"));
- dialogTestHelpers.drag(element, handle, 50, 50);
+ testHelper.drag(element, handle, 50, 50);
element.remove();
});
});
handle = $(".ui-dialog-titlebar", element.dialog("widget"));
- dialogTestHelpers.drag(element, handle, 50, 50);
+ testHelper.drag(element, handle, 50, 50);
element.remove();
});
});
handle = $(".ui-dialog-titlebar", element.dialog("widget"));
- dialogTestHelpers.drag(element, handle, 50, 50);
+ testHelper.drag(element, handle, 50, 50);
element.remove();
});
});
handle = $(".ui-resizable-se", element.dialog("widget"));
- dialogTestHelpers.drag(element, handle, 50, 50);
+ testHelper.drag(element, handle, 50, 50);
element.remove();
});
});
handle = $(".ui-resizable-se", element.dialog("widget"));
- dialogTestHelpers.drag(element, handle, 50, 50);
+ testHelper.drag(element, handle, 50, 50);
element.remove();
});
});
handle = $(".ui-resizable-se", element.dialog("widget"));
- dialogTestHelpers.drag(element, handle, 50, 50);
+ testHelper.drag(element, handle, 50, 50);
element.remove();
});
"ui/dialog",
"ui/effect-blind",
"ui/effect-explode"
-], function( $, dialogTestHelpers ) {
+], function( $, testHelper ) {
module("dialog: options");
var element = $("<div></div>").dialog({ draggable: false });
- dialogTestHelpers.testDrag(element, 50, -50, 0, 0);
+ testHelper.testDrag(element, 50, -50, 0, 0);
element.dialog("option", "draggable", true);
- dialogTestHelpers.testDrag(element, 50, -50, 50, -50);
+ testHelper.testDrag(element, 50, -50, 50, -50);
element.remove();
element = $("<div></div>").dialog({ draggable: true });
- dialogTestHelpers.testDrag(element, 50, -50, 50, -50);
+ testHelper.testDrag(element, 50, -50, 50, -50);
element.dialog("option", "draggable", false);
- dialogTestHelpers.testDrag(element, 50, -50, 0, 0);
+ testHelper.testDrag(element, 50, -50, 0, 0);
element.remove();
});
expect(3);
var element = $("<div></div>").dialog({ maxHeight: 200 });
- dialogTestHelpers.drag(element, ".ui-resizable-s", 1000, 1000);
+ testHelper.drag(element, ".ui-resizable-s", 1000, 1000);
assert.close(element.dialog("widget").height(), 200, 1, "maxHeight");
element.remove();
element = $("<div></div>").dialog({ maxHeight: 200 });
- dialogTestHelpers.drag(element, ".ui-resizable-n", -1000, -1000);
+ testHelper.drag(element, ".ui-resizable-n", -1000, -1000);
assert.close(element.dialog("widget").height(), 200, 1, "maxHeight");
element.remove();
element = $("<div></div>").dialog({ maxHeight: 200 }).dialog("option", "maxHeight", 300);
- dialogTestHelpers.drag(element, ".ui-resizable-s", 1000, 1000);
+ testHelper.drag(element, ".ui-resizable-s", 1000, 1000);
assert.close(element.dialog("widget").height(), 300, 1, "maxHeight");
element.remove();
});
expect(3);
var element = $("<div></div>").dialog({ maxWidth: 200 });
- dialogTestHelpers.drag(element, ".ui-resizable-e", 1000, 1000);
+ testHelper.drag(element, ".ui-resizable-e", 1000, 1000);
assert.close(element.dialog("widget").width(), 200, 1, "maxWidth");
element.remove();
element = $("<div></div>").dialog({ maxWidth: 200 });
- dialogTestHelpers.drag(element, ".ui-resizable-w", -1000, -1000);
+ testHelper.drag(element, ".ui-resizable-w", -1000, -1000);
assert.close(element.dialog("widget").width(), 200, 1, "maxWidth");
element.remove();
element = $("<div></div>").dialog({ maxWidth: 200 }).dialog("option", "maxWidth", 300);
- dialogTestHelpers.drag(element, ".ui-resizable-w", -1000, -1000);
+ testHelper.drag(element, ".ui-resizable-w", -1000, -1000);
assert.close(element.dialog("widget").width(), 300, 1, "maxWidth");
element.remove();
});
expect(3);
var element = $("<div></div>").dialog({ minHeight: 10 });
- dialogTestHelpers.drag(element, ".ui-resizable-s", -1000, -1000);
+ testHelper.drag(element, ".ui-resizable-s", -1000, -1000);
assert.close(element.dialog("widget").height(), 10, 1, "minHeight");
element.remove();
element = $("<div></div>").dialog({ minHeight: 10 });
- dialogTestHelpers.drag(element, ".ui-resizable-n", 1000, 1000);
+ testHelper.drag(element, ".ui-resizable-n", 1000, 1000);
assert.close(element.dialog("widget").height(), 10, 1, "minHeight");
element.remove();
element = $("<div></div>").dialog({ minHeight: 10 }).dialog("option", "minHeight", 30);
- dialogTestHelpers.drag(element, ".ui-resizable-n", 1000, 1000);
+ testHelper.drag(element, ".ui-resizable-n", 1000, 1000);
assert.close(element.dialog("widget").height(), 30, 1, "minHeight");
element.remove();
});
expect(3);
var element = $("<div></div>").dialog({ minWidth: 10 });
- dialogTestHelpers.drag(element, ".ui-resizable-e", -1000, -1000);
+ testHelper.drag(element, ".ui-resizable-e", -1000, -1000);
assert.close(element.dialog("widget").width(), 10, 1, "minWidth");
element.remove();
element = $("<div></div>").dialog({ minWidth: 10 });
- dialogTestHelpers.drag(element, ".ui-resizable-w", 1000, 1000);
+ testHelper.drag(element, ".ui-resizable-w", 1000, 1000);
assert.close(element.dialog("widget").width(), 10, 1, "minWidth");
element.remove();
element = $("<div></div>").dialog({ minWidth: 30 }).dialog("option", "minWidth", 30);
- dialogTestHelpers.drag(element, ".ui-resizable-w", 1000, 1000);
+ testHelper.drag(element, ".ui-resizable-w", 1000, 1000);
assert.close(element.dialog("widget").width(), 30, 1, "minWidth");
element.remove();
});
expect(4);
var element = $("<div></div>").dialog();
- dialogTestHelpers.shouldResize(element, 50, 50, "[default]");
+ testHelper.shouldResize(element, 50, 50, "[default]");
element.dialog("option", "resizable", false);
- dialogTestHelpers.shouldResize(element, 0, 0, "disabled after init");
+ testHelper.shouldResize(element, 0, 0, "disabled after init");
element.remove();
element = $("<div></div>").dialog({ resizable: false });
- dialogTestHelpers.shouldResize(element, 0, 0, "disabled in init options");
+ testHelper.shouldResize(element, 0, 0, "disabled in init options");
element.dialog("option", "resizable", true);
- dialogTestHelpers.shouldResize(element, 50, 50, "enabled after init");
+ testHelper.shouldResize(element, 50, 50, "enabled after init");
element.remove();
});
var i,
element = $("<div></div>").dialog({ resizable: false });
- dialogTestHelpers.shouldResize(element, 0, 0, "[default]");
+ testHelper.shouldResize(element, 0, 0, "[default]");
for (i=0; i<2; i++) {
element.dialog("close").dialog("open");
- dialogTestHelpers.shouldResize(element, 0, 0, "initialized with resizable false toggle ("+ (i+1) +")");
+ testHelper.shouldResize(element, 0, 0, "initialized with resizable false toggle ("+ (i+1) +")");
}
element.remove();
element = $("<div></div>").dialog({ resizable: true });
- dialogTestHelpers.shouldResize(element, 50, 50, "[default]");
+ testHelper.shouldResize(element, 50, 50, "[default]");
for (i=0; i<2; i++) {
element.dialog("close").dialog("option", "resizable", false).dialog("open");
- dialogTestHelpers.shouldResize(element, 0, 0, "set option resizable false toggle ("+ (i+1) +")");
+ testHelper.shouldResize(element, 0, 0, "set option resizable false toggle ("+ (i+1) +")");
}
element.remove();
-define( function() {
+define( [
+ "jquery",
+ "lib/helper",
+ "ui/dialog"
+], function( $, helper ) {
-var dialogTestHelpers = {
+return $.extend( helper, {
drag: function(element, handle, dx, dy) {
var d = element.dialog("widget");
//this mouseover is to work around a limitation in resizable
handle = $(".ui-dialog-titlebar", d),
offsetBefore = d.offset();
- dialogTestHelpers.drag(element, handle, dx, dy);
+ this.drag(element, handle, dx, dy);
offsetAfter = d.offset();
heightBefore = element.height(),
widthBefore = element.width();
- dialogTestHelpers.drag(element, handle, 50, 50);
+ this.drag(element, handle, 50, 50);
heightAfter = element.height();
widthAfter = element.width();
expected = { width: widthBefore + dw, height: heightBefore + dh };
deepEqual(actual, expected, "resized[" + 50 + ", " + 50 + "] " + msg);
}
-};
-
-return dialogTestHelpers;
+} );
} );
define( [
"jquery",
- "lib/helper",
"./draggable_test_helpers",
"ui/draggable",
"ui/droppable",
"ui/resizable"
-], function( $, testHelpers, draggableTestHelpers ) {
+], function( $, testHelper ) {
module( "draggable: core" );
test( "No options, relative", function() {
expect( 2 );
- draggableTestHelpers.shouldMove( $( "#draggable1" ).draggable(), "no options, relative" );
+ testHelper.shouldMove( $( "#draggable1" ).draggable(), "no options, relative" );
});
test( "No options, absolute", function() {
expect( 2 );
- draggableTestHelpers.shouldMove( $( "#draggable2" ).draggable(), "no options, absolute" );
+ testHelper.shouldMove( $( "#draggable2" ).draggable(), "no options, absolute" );
});
test( "resizable handle with complex markup (#8756 / #8757)", function() {
});
// Support: Opera 12.10, Safari 5.1, jQuery <1.8
- if ( draggableTestHelpers.unreliableContains ) {
+ if ( testHelper.unreliableContains ) {
ok( true, "Opera <12.14 and Safari <6.0 report wrong values for $.contains in jQuery < 1.8" );
ok( true, "Opera <12.14 and Safari <6.0 report wrong values for $.contains in jQuery < 1.8" );
} else {
$( document ).simulate( "mousemove", { button: -1 });
});
- draggableTestHelpers.shouldMove( element, "element is draggable" );
+ testHelper.shouldMove( element, "element is draggable" );
});
test( "#6258: not following mouse when scrolled and using overflow-y: scroll", function() {
oldOverflowY = $( "html" ).css( "overflow-y" ),
oldOverflowX = $( "html" ).css( "overflow-x" );
- testHelpers.forceScrollableWindow();
+ testHelper.forceScrollableWindow();
$( "html" )
.css( "overflow-y", "scroll" )
}
});
- testHelpers.forceScrollableWindow();
+ testHelper.forceScrollableWindow();
$( "html" ).scrollTop( 300 ).scrollLeft( 300 );
}
});
- testHelpers.forceScrollableWindow();
+ testHelper.forceScrollableWindow();
$( "#wrapper" ).css( "position", "fixed" );
$( "#wrapper2" ).css( "position", "absolute" );
equal( draggable1.closest( iframeBody ).length, 1 );
// TODO: fix draggable within an IFRAME to fire events on the element properly
- // and these draggableTestHelpers.shouldMove relies on events for testing
- //draggableTestHelpers.shouldMove( draggable1, "draggable from an iframe" );
+ // and these testHelper.shouldMove relies on events for testing
+ //testHelper.shouldMove( draggable1, "draggable from an iframe" );
});
test( "#8399: A draggable should become the active element after you are finished interacting with it, but not before.", function() {
notStrictEqual( document.activeElement, element.get( 0 ), "moving a draggable anchor did not make it the active element" );
});
- draggableTestHelpers.move( element, 50, 50 );
+ testHelper.move( element, 50, 50 );
strictEqual( document.activeElement, element.get( 0 ), "finishing moving a draggable anchor made it the active element" );
});
var element = $( "#draggable1" ).draggable(),
focusElement = $( "<div tabindex='1'></div>" ).appendTo( element );
- testHelpers.onFocus( focusElement, function() {
+ testHelper.onFocus( focusElement, function() {
strictEqual( document.activeElement, focusElement.get( 0 ), "test element is focused before mousing down on a draggable" );
- draggableTestHelpers.move( focusElement, 1, 1 );
+ testHelper.move( focusElement, 1, 1 );
// http://bugs.jqueryui.com/ticket/10527
// Draggable: Can't select option in modal dialog (IE8)
strictEqual( document.activeElement, focusElement.get( 0 ), "test element is focused after mousing down on itself" );
- draggableTestHelpers.move( element, 50, 50 );
+ testHelper.move( element, 50, 50 );
// http://bugs.jqueryui.com/ticket/4261
// active element should blur when mousing down on a draggable
"jquery",
"./draggable_test_helpers",
"ui/draggable"
-], function( $, draggableTestHelpers ) {
+], function( $, testHelper ) {
var element;
expect( 11 );
element.draggable({ disabled: true });
- draggableTestHelpers.shouldNotDrag( element, ".draggable({ disabled: true })" );
+ testHelper.shouldNotDrag( element, ".draggable({ disabled: true })" );
element.draggable("enable");
- draggableTestHelpers.shouldMove( element, ".draggable('enable')" );
+ testHelper.shouldMove( element, ".draggable('enable')" );
equal( element.draggable( "option", "disabled" ), false, "disabled option getter" );
element.draggable("destroy");
element.draggable({ disabled: true });
- draggableTestHelpers.shouldNotDrag( element, ".draggable({ disabled: true })" );
+ testHelper.shouldNotDrag( element, ".draggable({ disabled: true })" );
element.draggable( "option", "disabled", false );
equal(element.draggable( "option", "disabled" ), false, "disabled option setter" );
- draggableTestHelpers.shouldMove( element, ".draggable('option', 'disabled', false)" );
+ testHelper.shouldMove( element, ".draggable('option', 'disabled', false)" );
var expected = element.draggable(),
actual = expected.draggable("enable");
expect( 14 );
element = $( "#draggable2" ).draggable({ disabled: false });
- draggableTestHelpers.shouldMove( element, ".draggable({ disabled: false })" );
+ testHelper.shouldMove( element, ".draggable({ disabled: false })" );
element.draggable( "disable" );
- draggableTestHelpers.shouldNotDrag( element, ".draggable('disable')" );
+ testHelper.shouldNotDrag( element, ".draggable('disable')" );
equal( element.draggable( "option", "disabled" ), true, "disabled option getter" );
element.draggable( "destroy" );
element.draggable({ disabled: false });
- draggableTestHelpers.shouldMove( element, ".draggable({ disabled: false })" );
+ testHelper.shouldMove( element, ".draggable({ disabled: false })" );
element.draggable( "option", "disabled", true );
equal( element.draggable( "option", "disabled" ), true, "disabled option setter" );
- draggableTestHelpers.shouldNotDrag( element, ".draggable('option', 'disabled', true)" );
+ testHelper.shouldNotDrag( element, ".draggable('option', 'disabled', true)" );
assert.lacksClasses( element.draggable( "widget" ), "ui-state-disabled" );
ok( !element.draggable( "widget" ).attr( "aria-disabled" ), "element does not get aria-disabled" );
"ui/draggable",
"ui/droppable",
"ui/sortable"
-], function( $, draggableTestHelpers ) {
+], function( $, testHelper ) {
// TODO: This doesn't actually test whether append happened, possibly remove
test( "{ appendTo: 'parent' }, default, no clone", function() {
expect( 4 );
var element = $( "#draggable2" ).draggable({ appendTo: "parent" });
- draggableTestHelpers.shouldMove( element, "absolute appendTo: parent" );
+ testHelper.shouldMove( element, "absolute appendTo: parent" );
element = $( "#draggable1" ).draggable({ appendTo: "parent" });
- draggableTestHelpers.shouldMove( element, "relative appendTo: parent" );
+ testHelper.shouldMove( element, "relative appendTo: parent" );
});
// TODO: This doesn't actually test whether append happened, possibly remove
expect( 4 );
var element = $( "#draggable2" ).draggable({ appendTo: $( "#draggable2" ).parent()[ 0 ] });
- draggableTestHelpers.shouldMove( element, "absolute appendTo: Element" );
+ testHelper.shouldMove( element, "absolute appendTo: Element" );
element = $( "#draggable1" ).draggable({ appendTo: $( "#draggable2" ).parent()[ 0 ] });
- draggableTestHelpers.shouldMove( element, "relative appendTo: Element" );
+ testHelper.shouldMove( element, "relative appendTo: Element" );
});
// TODO: This doesn't actually test whether append happened, possibly remove
test( "{ appendTo: Selector }, no clone", function() {
expect( 4 );
var element = $( "#draggable2" ).draggable({ appendTo: "#main" });
- draggableTestHelpers.shouldMove( element, "absolute appendTo: Selector" );
+ testHelper.shouldMove( element, "absolute appendTo: Selector" );
element = $( "#draggable1" ).draggable({ appendTo: "#main" });
- draggableTestHelpers.shouldMove( element, "relative appendTo: Selector" );
+ testHelper.shouldMove( element, "relative appendTo: Selector" );
});
test( "{ appendTo: 'parent' }, default", function() {
var element = $( "#draggable1" ).draggable();
- draggableTestHelpers.trackAppendedParent( element );
+ testHelper.trackAppendedParent( element );
equal( element.draggable( "option", "appendTo" ), "parent" );
- draggableTestHelpers.move( element, 1, 1 );
+ testHelper.move( element, 1, 1 );
equal( element.data( "last_dragged_parent" ), $( "#main" )[ 0 ] );
});
var appendTo = $( "#draggable2" ).parent()[ 0 ],
element = $( "#draggable1" ).draggable({ appendTo: appendTo });
- draggableTestHelpers.trackAppendedParent( element );
+ testHelper.trackAppendedParent( element );
- draggableTestHelpers.move( element, 1, 1 );
+ testHelper.move( element, 1, 1 );
equal( element.data( "last_dragged_parent" ), appendTo );
});
var appendTo = $( "#draggable2" ).parent(),
element = $( "#draggable1" ).draggable({ appendTo: appendTo });
- draggableTestHelpers.trackAppendedParent( element );
+ testHelper.trackAppendedParent( element );
- draggableTestHelpers.move( element, 1, 1 );
+ testHelper.move( element, 1, 1 );
equal( element.data( "last_dragged_parent" ), appendTo[ 0 ] );
});
var appendTo = "#main",
element = $( "#draggable1" ).draggable({ appendTo: appendTo });
- draggableTestHelpers.trackAppendedParent( element );
+ testHelper.trackAppendedParent( element );
- draggableTestHelpers.move( element, 1, 1 );
+ testHelper.move( element, 1, 1 );
equal( element.data( "last_dragged_parent" ), $(appendTo)[ 0 ] );
});
var element = $( "#draggable1" ).draggable({ helper: "clone" });
- draggableTestHelpers.trackAppendedParent( element );
+ testHelper.trackAppendedParent( element );
// Move and make sure element was appended to fixture
- draggableTestHelpers.move( element, 1, 1 );
+ testHelper.move( element, 1, 1 );
equal( element.data( "last_dragged_parent" ), $( "#main" )[ 0 ] );
// Move and make sure element was appended to main
element.draggable( "option", "appendTo", $( "#qunit-fixture" ) );
- draggableTestHelpers.move( element, 2, 2 );
+ testHelper.move( element, 2, 2 );
equal( element.data( "last_dragged_parent" ), $( "#qunit-fixture" )[ 0 ] );
});
test( "{ axis: false }, default", function() {
expect( 2 );
var element = $( "#draggable2" ).draggable({ axis: false });
- draggableTestHelpers.shouldMove( element, "axis: false" );
+ testHelper.shouldMove( element, "axis: false" );
});
test( "{ axis: 'x' }", function() {
expect( 2 );
var element = $( "#draggable2" ).draggable({ axis: "x" });
- draggableTestHelpers.testDrag( element, element, 50, 50, 50, 0, "axis: x" );
+ testHelper.testDrag( element, element, 50, 50, 50, 0, "axis: x" );
});
test( "{ axis: 'y' }", function() {
expect( 2 );
var element = $( "#draggable2" ).draggable({ axis: "y" });
- draggableTestHelpers.testDrag( element, element, 50, 50, 0, 50, "axis: y" );
+ testHelper.testDrag( element, element, 50, 50, 0, 50, "axis: y" );
});
test( "{ axis: ? }, unexpected", function() {
$.each(unexpected, function(key, val) {
element = $( "#draggable2" ).draggable({ axis: val });
- draggableTestHelpers.shouldMove( element, "axis: " + key );
+ testHelper.shouldMove( element, "axis: " + key );
element.draggable( "destroy" );
});
});
var element = $( "#draggable1" ).draggable({ axis: false });
// Any Direction
- draggableTestHelpers.shouldMove( element, "axis: default" );
+ testHelper.shouldMove( element, "axis: default" );
// Only horizontal
element.draggable( "option", "axis", "x" );
- draggableTestHelpers.testDrag( element, element, 50, 50, 50, 0, "axis: x as option" );
+ testHelper.testDrag( element, element, 50, 50, 50, 0, "axis: x as option" );
// Vertical only
element.draggable( "option", "axis", "y" );
- draggableTestHelpers.testDrag( element, element, 50, 50, 0, 50, "axis: y as option" );
+ testHelper.testDrag( element, element, 50, 50, 0, 50, "axis: y as option" );
});
$( "<div id='draggable-option-cancel-default'><input type='text'></div>" ).appendTo( "#qunit-fixture" );
var element = $( "#draggable-option-cancel-default" ).draggable({ cancel: "input,textarea,button,select,option" });
- draggableTestHelpers.shouldMove( element, "cancel: default, element dragged" );
+ testHelper.shouldMove( element, "cancel: default, element dragged" );
element.draggable( "destroy" );
element = $( "#draggable-option-cancel-default" ).draggable({ cancel: "input,textarea,button,select,option" });
- draggableTestHelpers.shouldNotDrag( element, "cancel: default, input dragged", "#draggable-option-cancel-default input" );
+ testHelper.shouldNotDrag( element, "cancel: default, input dragged", "#draggable-option-cancel-default input" );
element.draggable( "destroy" );
});
expect( 4 );
var element = $( "#draggable2" ).draggable();
- draggableTestHelpers.shouldMove( element, "cancel: default, span dragged", "#draggable2 span" );
+ testHelper.shouldMove( element, "cancel: default, span dragged", "#draggable2 span" );
element.draggable( "destroy" );
element = $( "#draggable2" ).draggable({ cancel: "span" });
- draggableTestHelpers.shouldNotDrag( element, "cancel: span, span dragged", "#draggable2 span" );
+ testHelper.shouldNotDrag( element, "cancel: span, span dragged", "#draggable2 span" );
});
test( "{ cancel: ? }, unexpected", function() {
$.each( unexpected, function( key, val ) {
element = $( "#draggable2" ).draggable({ cancel: val });
- draggableTestHelpers.shouldMove( element, "cancel: " + key );
+ testHelper.shouldMove( element, "cancel: " + key );
element.draggable( "destroy" );
});
});
$( "#wrapping a" ).append( element );
- draggableTestHelpers.shouldMove( element, "drag span child", "#draggable2 span" );
- draggableTestHelpers.shouldNotDrag( $( "#draggable2 span a" ), "drag span a" );
- draggableTestHelpers.shouldNotDrag( $( "#wrapping a" ), "drag wrapping a" );
+ testHelper.shouldMove( element, "drag span child", "#draggable2 span" );
+ testHelper.shouldNotDrag( $( "#draggable2 span a" ), "drag span a" );
+ testHelper.shouldNotDrag( $( "#wrapping a" ), "drag wrapping a" );
$( "#draggable2" ).draggable( "option", "cancel", "span > a" );
$( "#draggable2" ).find( "a" ).append( "<a>" );
- draggableTestHelpers.shouldMove( element, "drag span child", $( "#draggable2 span a" ).last() );
- draggableTestHelpers.shouldNotDrag( $( "#draggable2 span a" ).first(), "drag span a first child" );
+ testHelper.shouldMove( element, "drag span child", $( "#draggable2 span a" ).last() );
+ testHelper.shouldNotDrag( $( "#draggable2 span a" ).first(), "drag span a first child" );
});
*/
var input = $( "#draggable-option-cancel-default input" ),
element = $( "#draggable-option-cancel-default" ).draggable();
- draggableTestHelpers.shouldNotDrag( element, "cancel: default, input dragged", input );
+ testHelper.shouldNotDrag( element, "cancel: default, input dragged", input );
element.draggable( "option", "cancel", "textarea" );
- draggableTestHelpers.shouldMove( element, "cancel: textarea, input dragged", input );
+ testHelper.shouldMove( element, "cancel: textarea, input dragged", input );
element.draggable( "option", "cancel", "input" );
- draggableTestHelpers.shouldNotDrag( element, "cancel: input, input dragged", input );
+ testHelper.shouldNotDrag( element, "cancel: input, input dragged", input );
});
test( "connectToSortable, dragging out of a sortable", function() {
p = element.parent(),
po = p.offset(),
expected = {
- left: po.left + draggableTestHelpers.border( p, "left" ) + draggableTestHelpers.margin( element, "left" ),
- top: po.top + draggableTestHelpers.border( p, "top" ) + draggableTestHelpers.margin( element, "top" )
+ left: po.left + testHelper.border( p, "left" ) + testHelper.margin( element, "left" ),
+ top: po.top + testHelper.border( p, "top" ) + testHelper.margin( element, "top" )
};
element.simulate( "drag", {
p = element.parent(),
po = p.offset(),
expected = {
- left: po.left + draggableTestHelpers.border( p, "left" ) + draggableTestHelpers.margin( element, "left" ),
- top: po.top + draggableTestHelpers.border( p, "top" ) + draggableTestHelpers.margin( element, "top" )
+ left: po.left + testHelper.border( p, "left" ) + testHelper.margin( element, "left" ),
+ top: po.top + testHelper.border( p, "top" ) + testHelper.margin( element, "top" )
};
element.simulate( "drag", {
element.draggable( "option", "containment", [ eo.left, eo.top, eo.left + element.width() + 5, eo.top + element.height() + 5 ] );
- draggableTestHelpers.testDrag( element, element, -100, -100, 0, 0, "containment: [x1, y1, x2, y2]" );
+ testHelper.testDrag( element, element, -100, -100, 0, 0, "containment: [x1, y1, x2, y2]" );
});
test( "{ containment: 'parent' }, relative", function() {
p = element.parent(),
po = p.offset(),
expected = {
- left: po.left + draggableTestHelpers.border( p, "left" ) + draggableTestHelpers.margin( element, "left" ),
- top: po.top + draggableTestHelpers.border( p, "top" ) + draggableTestHelpers.margin( element, "top" )
+ left: po.left + testHelper.border( p, "left" ) + testHelper.margin( element, "left" ),
+ top: po.top + testHelper.border( p, "top" ) + testHelper.margin( element, "top" )
};
element.simulate( "drag", {
p = element.parent(),
po = p.offset(),
expected = {
- left: po.left + draggableTestHelpers.border( p, "left" ) + draggableTestHelpers.margin( element, "left" ),
- top: po.top + draggableTestHelpers.border( p, "top" ) + draggableTestHelpers.margin( element, "top" )
+ left: po.left + testHelper.border( p, "left" ) + testHelper.margin( element, "left" ),
+ top: po.top + testHelper.border( p, "top" ) + testHelper.margin( element, "top" )
};
element.simulate( "drag", {
}),
parentBottom = parent.offset().top + parent.outerHeight(),
parentRight = parent.offset().left + parent.outerWidth(),
- parentBorderBottom = draggableTestHelpers.border( parent, "bottom" ),
- parentBorderRight = draggableTestHelpers.border( parent, "right" );
+ parentBorderBottom = testHelper.border( parent, "bottom" ),
+ parentBorderRight = testHelper.border( parent, "right" );
el.css({
height: "5px",
po = element.parent().offset(),
containment = [ po.left - 100, po.top - 100, po.left + 500, po.top + 500 ];
- draggableTestHelpers.testDrag( element, element, -100, -100, -100, -100, "containment: default" );
+ testHelper.testDrag( element, element, -100, -100, -100, -100, "containment: default" );
element.draggable( "option", "containment", "parent" ).css({ top: 0, left: 0 });
- draggableTestHelpers.testDrag( element, element, -100, -100, 0, 0, "containment: parent as option" );
+ testHelper.testDrag( element, element, -100, -100, 0, 0, "containment: parent as option" );
element.draggable( "option", "containment", containment ).css({ top: 0, left: 0 });
- draggableTestHelpers.testDrag( element, element, -100, -100, -100, -100, "containment: array as option" );
+ testHelper.testDrag( element, element, -100, -100, -100, -100, "containment: array as option" );
element.draggable( "option", "containment", false );
- draggableTestHelpers.testDrag( element, element, -100, -100, -100, -100, "containment: false as option" );
+ testHelper.testDrag( element, element, -100, -100, -100, -100, "containment: false as option" );
});
test( "{ cursor: 'auto' }, default", function() {
}),
expected = getCursor();
- if ( draggableTestHelpers.unreliableContains ) {
+ if ( testHelper.unreliableContains ) {
ok( true, "Opera <12.14 and Safari <6.0 report wrong values for $.contains in jQuery < 1.8" );
ok( true, "Opera <12.14 and Safari <6.0 report wrong values for $.contains in jQuery < 1.8" );
} else {
var element = $( "#draggable1" ).draggable();
- draggableTestHelpers.trackMouseCss( element );
+ testHelper.trackMouseCss( element );
- draggableTestHelpers.move( element, 1, 1 );
+ testHelper.move( element, 1, 1 );
equal( element.data( "last_dragged_cursor" ), "auto" );
element.draggable( "option", "cursor", "move" );
- draggableTestHelpers.move( element, 1, 1 );
+ testHelper.move( element, 1, 1 );
equal( element.data( "last_dragged_cursor" ), "move" );
element.draggable( "option", "cursor", "ns-resize" );
- draggableTestHelpers.move( element, 1, 1 );
+ testHelper.move( element, 1, 1 );
equal( element.data( "last_dragged_cursor" ), "ns-resize" );
});
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 - draggableTestHelpers.unreliableOffset, testName + " " + position + " left" );
- equal( ui.helper.height() - ( event.clientY - ui.offset.top ), testData.y - draggableTestHelpers.unreliableOffset, testName + " " + position + " top" );
+ equal( ui.helper.width() - ( event.clientX - ui.offset.left ), testData.x - testHelper.unreliableOffset, testName + " " + position + " left" );
+ equal( ui.helper.height() - ( event.clientY - ui.offset.top ), testData.y - testHelper.unreliableOffset, testName + " " + position + " top" );
} else {
- equal( event.clientX - ui.offset.left, testData.x + draggableTestHelpers.unreliableOffset, testName + " " + position + " left" );
- equal( event.clientY - ui.offset.top, testData.y + draggableTestHelpers.unreliableOffset, testName + " " + position + " top" );
+ equal( event.clientX - ui.offset.left, testData.x + testHelper.unreliableOffset, testName + " " + position + " left" );
+ equal( event.clientY - ui.offset.top, testData.y + testHelper.unreliableOffset, testName + " " + position + " top" );
}
}
});
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 - draggableTestHelpers.unreliableOffset, testName + " " + position + " left" );
- equal( ui.helper.height() - ( event.clientY - ui.offset.top ), testData.y - draggableTestHelpers.unreliableOffset, testName + " " + position + " top" );
+ equal( ui.helper.width() - ( event.clientX - ui.offset.left ), testData.x - testHelper.unreliableOffset, testName + " " + position + " left" );
+ equal( ui.helper.height() - ( event.clientY - ui.offset.top ), testData.y - testHelper.unreliableOffset, testName + " " + position + " top" );
} else {
- equal( event.clientX - ui.offset.left, testData.x + draggableTestHelpers.unreliableOffset, testName + " " + position + " left" );
- equal( event.clientY - ui.offset.top, testData.y + draggableTestHelpers.unreliableOffset, testName + " " + position + " top" );
+ equal( event.clientX - ui.offset.left, testData.x + testHelper.unreliableOffset, testName + " " + position + " left" );
+ equal( event.clientY - ui.offset.top, testData.y + testHelper.unreliableOffset, testName + " " + position + " top" );
}
}
});
var element = $( "#draggable1" ).draggable();
- draggableTestHelpers.shouldMove( element, "disabled: default" );
+ testHelper.shouldMove( element, "disabled: default" );
element.draggable( "option", "disabled", true );
- draggableTestHelpers.shouldNotDrag( element, "option: disabled true" );
+ testHelper.shouldNotDrag( element, "option: disabled true" );
element.draggable( "option", "disabled", false );
- draggableTestHelpers.shouldMove( element, "option: disabled false" );
+ testHelper.shouldMove( element, "option: disabled false" );
});
test( "{ grid: [50, 50] }, relative", function() {
expect( 4 );
var element = $( "#draggable1" ).draggable({ grid: [ 50, 50 ] });
- draggableTestHelpers.testDrag( element, element, 24, 24, 0, 0, "grid: [50, 50] relative" );
- draggableTestHelpers.testDrag( element, element, 26, 25, 50, 50, "grid: [50, 50] relative" );
+ testHelper.testDrag( element, element, 24, 24, 0, 0, "grid: [50, 50] relative" );
+ testHelper.testDrag( element, element, 26, 25, 50, 50, "grid: [50, 50] relative" );
});
test( "{ grid: [50, 50] }, absolute", function() {
expect( 4 );
var element = $( "#draggable2" ).draggable({ grid: [ 50, 50 ] });
- draggableTestHelpers.testDrag( element, element, 24, 24, 0, 0, "grid: [50, 50] absolute" );
- draggableTestHelpers.testDrag( element, element, 26, 25, 50, 50, "grid: [50, 50] absolute" );
+ testHelper.testDrag( element, element, 24, 24, 0, 0, "grid: [50, 50] absolute" );
+ testHelper.testDrag( element, element, 26, 25, 50, 50, "grid: [50, 50] absolute" );
});
test( "grid, switching after initialization", function() {
var element = $( "#draggable1" ).draggable();
// Forward
- draggableTestHelpers.testDrag( element, element, 24, 24, 24, 24, "grid: default" );
- draggableTestHelpers.testDrag( element, element, 0, 0, 0, 0, "grid: default" );
+ testHelper.testDrag( element, element, 24, 24, 24, 24, "grid: default" );
+ testHelper.testDrag( element, element, 0, 0, 0, 0, "grid: default" );
element.draggable( "option", "grid", [ 50, 50 ] );
- draggableTestHelpers.testDrag( element, element, 24, 24, 0, 0, "grid: [50, 50] as option" );
- draggableTestHelpers.testDrag( element, element, 26, 25, 50, 50, "grid: [50, 50] as option" );
+ testHelper.testDrag( element, element, 24, 24, 0, 0, "grid: [50, 50] as option" );
+ testHelper.testDrag( element, element, 26, 25, 50, 50, "grid: [50, 50] as option" );
});
test( "{ handle: 'span' }", function() {
var element = $( "#draggable2" ).draggable({ handle: "span" });
- draggableTestHelpers.shouldMove( element, "handle: span", "#draggable2 span");
- draggableTestHelpers.shouldMove( element, "handle: span child", "#draggable2 span em" );
- draggableTestHelpers.shouldNotDrag( element, "handle: span element" );
+ testHelper.shouldMove( element, "handle: span", "#draggable2 span");
+ testHelper.shouldMove( element, "handle: span child", "#draggable2 span em" );
+ testHelper.shouldNotDrag( element, "handle: span element" );
});
test( "handle, default, switching after initialization", function() {
var element = $( "#draggable2" ).draggable();
- draggableTestHelpers.shouldMove( element, "handle: default, element dragged" );
- draggableTestHelpers.shouldMove( element, "handle: default, span dragged", "#draggable2 span" );
+ testHelper.shouldMove( element, "handle: default, element dragged" );
+ testHelper.shouldMove( element, "handle: default, span dragged", "#draggable2 span" );
// Switch
element.draggable( "option", "handle", "span" );
- draggableTestHelpers.shouldNotDrag( element, "handle: span as option, element dragged" );
- draggableTestHelpers.shouldMove( element, "handle: span as option, span dragged", "#draggable2 span" );
+ testHelper.shouldNotDrag( element, "handle: span as option, element dragged" );
+ testHelper.shouldMove( element, "handle: span as option, span dragged", "#draggable2 span" );
// And back
element.draggable( "option", "handle", false );
- draggableTestHelpers.shouldMove( element, "handle: false as option, element dragged" );
- draggableTestHelpers.shouldMove( element, "handle: false as option, span dragged", "#draggable2 span" );
+ testHelper.shouldMove( element, "handle: false as option, element dragged" );
+ testHelper.shouldMove( element, "handle: false as option, span dragged", "#draggable2 span" );
});
test( "helper, default, switching after initialization", function() {
expect( 6 );
var element = $( "#draggable1" ).draggable();
- draggableTestHelpers.shouldMove( element, "helper: default" );
+ testHelper.shouldMove( element, "helper: default" );
element.draggable( "option", "helper", "clone" );
- draggableTestHelpers.shouldMove( element, "helper: clone" );
+ testHelper.shouldMove( element, "helper: clone" );
element.draggable( "option", "helper", "original" );
- draggableTestHelpers.shouldMove( element, "helper: original" );
+ testHelper.shouldMove( element, "helper: original" );
});
// http://bugs.jqueryui.com/ticket/9446
}
});
- draggableTestHelpers.testDragHelperOffset( element, 100, 100, 100, 100, "original element is draggable" );
+ testHelper.testDragHelperOffset( element, 100, 100, 100, 100, "original element is draggable" );
element.simulate( "drag", {
dx: 100,
});
if ( scrollElements.length === 1 && scrollElements[ 0 ] === "#scrollParent" ) {
- draggableTestHelpers.setScrollable( "#main", false );
- draggableTestHelpers.setScrollable( "#scrollParent", true );
+ testHelper.setScrollable( "#main", false );
+ testHelper.setScrollable( "#scrollParent", true );
}
for ( j = 0; j < scrollPositions.length; j++ ) {
for ( i = 0; i < scrollElements.length; i++ ) {
- draggableTestHelpers.setScroll( scrollElements[ i ] );
+ testHelper.setScroll( scrollElements[ i ] );
}
- draggableTestHelpers.testScroll( element, scrollPositions[ j ] );
+ testHelper.testScroll( element, scrollPositions[ j ] );
for ( i = 0; i < scrollElements.length; i++ ) {
- draggableTestHelpers.restoreScroll( scrollElements[ i ] );
+ testHelper.restoreScroll( scrollElements[ i ] );
}
}
if ( scrollElements.length === 1 && scrollElements[ 1 ] === "#scrollParent" ) {
- draggableTestHelpers.setScrollable( "#main", true );
- draggableTestHelpers.setScrollable( "#scrollParent", false );
+ testHelper.setScrollable( "#main", true );
+ testHelper.setScrollable( "#scrollParent", false );
}
});
}
}
});
- draggableTestHelpers.move( element, 1, 1 );
+ testHelper.move( element, 1, 1 );
equal( opacity, 1 );
element.draggable( "option", "opacity", 0.5 );
- draggableTestHelpers.move( element, 2, 1 );
+ testHelper.move( element, 2, 1 );
equal( opacity, 0.5 );
element.draggable( "option", "opacity", false );
- draggableTestHelpers.move( element, 3, 1 );
+ testHelper.move( element, 3, 1 );
equal( opacity, 1 );
});
revert: true,
revertDuration: 0
});
- draggableTestHelpers.shouldMovePositionButNotOffset( element, "revert: true, revertDuration: 0 should revert immediately" );
+ testHelper.shouldMovePositionButNotOffset( element, "revert: true, revertDuration: 0 should revert immediately" );
$( "#draggable2" ).draggable( "option", "revert", "invalid" );
- draggableTestHelpers.shouldMovePositionButNotOffset( element, "revert: invalid, revertDuration: 0 should revert immediately" );
+ testHelper.shouldMovePositionButNotOffset( element, "revert: invalid, revertDuration: 0 should revert immediately" );
$( "#draggable2" ).draggable( "option", "revert", false );
- draggableTestHelpers.shouldMove( element, "revert: false should allow movement" );
+ testHelper.shouldMove( element, "revert: false should allow movement" );
$( "#draggable2" ).draggable( "option", {
revert: true,
});
// animation are async, so test for it asynchronously
- draggableTestHelpers.move( element, 50, 50 );
+ testHelper.move( element, 50, 50 );
setTimeout( function() {
ok( $( "#draggable2" ).is( ":animated" ), "revert: true with revertDuration should animate" );
});
$( "#droppable" ).droppable();
- draggableTestHelpers.shouldMovePositionButNotOffset( element, "revert: valid reverts when dropped on a droppable" );
+ testHelper.shouldMovePositionButNotOffset( element, "revert: valid reverts when dropped on a droppable" );
});
test( "scope", function() {
$( "#droppable" ).droppable({ scope: "tasks" });
- draggableTestHelpers.shouldMovePositionButNotOffset( element, "revert: valid reverts when dropped on a droppable in scope" );
+ testHelper.shouldMovePositionButNotOffset( element, "revert: valid reverts when dropped on a droppable in scope" );
$( "#droppable" ).droppable( "destroy" ).droppable({ scope: "nottasks" });
- draggableTestHelpers.shouldMove( element, "revert: valid reverts when dropped on a droppable out of scope" );
+ testHelper.shouldMove( element, "revert: valid reverts when dropped on a droppable out of scope" );
});
test( "scroll, scrollSensitivity, and scrollSpeed", function() {
expect( 2 );
- draggableTestHelpers.setScrollable( "#main", false );
+ testHelper.setScrollable( "#main", false );
var currentScrollTop,
viewportHeight = $( window ).height(),
moves: 1
});
- draggableTestHelpers.restoreScroll( document );
+ testHelper.restoreScroll( document );
});
test( "scroll ignores containers that are overflow: hidden", function() {
test( "#6817: auto scroll goes double distance when dragging", function( assert ) {
expect( 2 );
- draggableTestHelpers.restoreScroll( document );
+ testHelper.restoreScroll( document );
var offsetBefore,
distance = 10,
moves: 1
});
- draggableTestHelpers.restoreScroll( document );
+ testHelper.restoreScroll( document );
});
test( "snap, snapMode, and snapTolerance", function( assert ) {
});
// Support: Opera 12.10, Safari 5.1, jQuery <1.8
- if ( draggableTestHelpers.unreliableContains ) {
+ if ( testHelper.unreliableContains ) {
ok( true, "Opera <12.14 and Safari <6.0 report wrong values for $.contains in jQuery < 1.8" );
ok( true, "Opera <12.14 and Safari <6.0 report wrong values for $.contains in jQuery < 1.8" );
} else {
stack: "#draggable1, #draggable2"
});
- draggableTestHelpers.move( element, 1, 1 );
+ testHelper.move( element, 1, 1 );
equal( element.css( "zIndex" ), "2", "stack increments zIndex correctly" );
- draggableTestHelpers.move( element2, 1, 1 );
+ testHelper.move( element2, 1, 1 );
equal( element2.css( "zIndex" ), "3", "stack increments zIndex correctly" );
});
element.css( "z-index", 1 );
- draggableTestHelpers.move( element, 1, 1 );
+ testHelper.move( element, 1, 1 );
equal( zindex, 1 );
element.draggable( "option", "zIndex", 5 );
- draggableTestHelpers.move( element, 2, 1 );
+ testHelper.move( element, 2, 1 );
equal( zindex, 5 );
element.draggable( "option", "zIndex", false );
- draggableTestHelpers.move( element, 3, 1 );
+ testHelper.move( element, 3, 1 );
equal( zindex, 1 );
});
-define( function() {
+define( [
+ "jquery",
+ "lib/helper",
+ "ui/draggable"
+], function( $, helper ) {
-var draggableTestHelpers = {
+return $.extend( helper, {
// TODO: remove the unreliable offset hacks
unreliableOffset: $.ui.ie && ( !document.documentMode || document.documentMode < 8 ) ? 2 : 0,
// Support: Opera 12.10, Safari 5.1, jQuery <1.8
+
unreliableContains: (function() {
var element = $( "<div>" );
return $.contains( element[ 0 ].ownerDocument, element[ 0 ] );
})(),
+
testDragPosition: function( el, dx, dy, expectedDX, expectedDY, msg ) {
msg = msg ? msg + "." : "";
deepEqual( ui.position, positionExpected, "position dragged[" + dx + ", " + dy + "] " + msg );
});
},
+
testDragOffset: function( el, dx, dy, expectedDX, expectedDY, msg ) {
msg = msg ? msg + "." : "";
deepEqual( ui.offset, offsetExpected, "offset dragged[" + dx + ", " + dy + "] " + msg );
});
},
+
testDragHelperOffset: function( el, dx, dy, expectedDX, expectedDY, msg ) {
msg = msg ? msg + "." : "";
deepEqual( ui.helper.offset(), offsetExpected, "offset dragged[" + dx + ", " + dy + "] " + msg );
});
},
+
testDrag: function( el, handle, dx, dy, expectedDX, expectedDY, msg ) {
- draggableTestHelpers.testDragPosition( el, dx, dy, expectedDX, expectedDY, msg );
- draggableTestHelpers.testDragOffset( el, dx, dy, expectedDX, expectedDY, msg );
+ this.testDragPosition( el, dx, dy, expectedDX, expectedDY, msg );
+ this.testDragOffset( el, dx, dy, expectedDX, expectedDY, msg );
$( handle ).simulate( "drag", {
dx: dx,
dy: dy
});
},
+
shouldMovePositionButNotOffset: function( el, msg, handle ) {
handle = handle || el;
- draggableTestHelpers.testDragPosition( el, 100, 100, 100, 100, msg );
- draggableTestHelpers.testDragHelperOffset( el, 100, 100, 0, 0, msg );
+ this.testDragPosition( el, 100, 100, 100, 100, msg );
+ this.testDragHelperOffset( el, 100, 100, 0, 0, msg );
$( handle ).simulate( "drag", {
dx: 100,
dy: 100
});
},
+
shouldMove: function( el, msg, handle ) {
handle = handle || el;
- draggableTestHelpers.testDrag( el, handle, 100, 100, 100, 100, msg );
+ this.testDrag( el, handle, 100, 100, 100, 100, msg );
},
+
shouldNotMove: function( el, msg, handle ) {
handle = handle || el;
- draggableTestHelpers.testDrag( el, handle, 100, 100, 0, 0, msg );
+ this.testDrag( el, handle, 100, 100, 0, 0, msg );
},
+
shouldNotDrag: function( el, msg, handle ) {
handle = handle || el;
element.unbind( "dragstop" );
},
+
setScrollable: function( what, isScrollable ) {
var overflow = isScrollable ? "scroll" : "hidden";
$( what ).css({ overflow: overflow, overflowX: overflow, overflowY: overflow });
},
+
testScroll: function( el, position ) {
var oldPosition = $( "#main" ).css( "position" );
$( "#main" ).css({ position: position, top: "0px", left: "0px" });
- draggableTestHelpers.shouldMove( el, position + " parent" );
+ this.shouldMove( el, position + " parent" );
$( "#main" ).css( "position", oldPosition );
},
+
restoreScroll: function( what ) {
$( what ).scrollTop( 0 ).scrollLeft( 0 );
},
+
setScroll: function( what ) {
$( what ).scrollTop( 100 ).scrollLeft( 100 );
},
+
border: function( el, side ) {
return parseInt( el.css( "border-" + side + "-width" ), 10 ) || 0;
},
+
margin: function( el, side ) {
return parseInt( el.css( "margin-" + side ), 10 ) || 0;
},
+
move: function( el, x, y ) {
$( el ).simulate( "drag", {
dx: x,
dy: y
});
},
+
trackMouseCss: function( el ) {
el.bind( "drag", function() {
el.data( "last_dragged_cursor", $( "body" ).css( "cursor" ) );
});
},
+
trackAppendedParent: function( el ) {
// TODO: appendTo is currently ignored if helper is original (see #7044)
el.draggable( "option", "helper", "clone" );
el.data( "last_dragged_parent", ui.helper.parent()[ 0 ] );
});
}
-};
-
-return draggableTestHelpers;
+} );
} );
"jquery",
"./droppable_test_helpers",
"ui/droppable"
-], function( $, droppableTestHelpers ) {
+], function( $, testHelper ) {
module("droppable: core");
(typeName === "table" && el.append("<tr><td>content</td></tr>"));
el.droppable();
- droppableTestHelpers.shouldDrop();
+ testHelper.shouldDrop();
el.droppable("destroy");
el.remove();
});
"jquery",
"./droppable_test_helpers",
"ui/droppable"
-], function( $, droppableTestHelpers ) {
+], function( $, testHelper ) {
module("droppable: methods");
var el, expected, actual;
el = $("#droppable1").droppable({ disabled: true });
- droppableTestHelpers.shouldNotDrop();
+ testHelper.shouldNotDrop();
el.droppable("enable");
- droppableTestHelpers.shouldDrop();
+ testHelper.shouldDrop();
equal(el.droppable("option", "disabled"), false, "disabled option getter");
el.droppable("destroy");
el.droppable({ disabled: true });
- droppableTestHelpers.shouldNotDrop();
+ testHelper.shouldNotDrop();
el.droppable("option", "disabled", false);
equal(el.droppable("option", "disabled"), false, "disabled option setter");
- droppableTestHelpers.shouldDrop();
+ testHelper.shouldDrop();
expected = $("<div></div>").droppable(),
actual = expected.droppable("enable");
var actual, expected,
element = $( "#droppable1" ).droppable({ disabled: false });
- droppableTestHelpers.shouldDrop();
+ testHelper.shouldDrop();
element.droppable( "disable" );
- droppableTestHelpers.shouldNotDrop();
+ testHelper.shouldNotDrop();
equal( element.droppable( "option", "disabled" ), true, "disabled option getter" );
element.droppable( "destroy" );
element.droppable({ disabled: false });
- droppableTestHelpers.shouldDrop();
+ testHelper.shouldDrop();
element.droppable( "option", "disabled", true );
assert.lacksClasses( element.droppable( "widget" ), "ui-state-disabled" );
ok( !element.droppable( "widget" ).attr( "aria-disabled" ), "element does not get aria-disabled" );
assert.hasClasses( element.droppable( "widget" ), "ui-droppable-disabled" );
equal( element.droppable( "option", "disabled" ), true, "disabled option setter" );
- droppableTestHelpers.shouldNotDrop();
+ testHelper.shouldNotDrop();
expected = $( "<div></div>" ).droppable();
actual = expected.droppable( "disable" );
define( [
"jquery",
- "./droppable_test_helpers",
"ui/droppable"
], function( $ ) {
-define( function() {
+define( [
+ "jquery",
+ "lib/helper"
+], function( $, helper ) {
-return {
+return $.extend( helper, {
shouldDrop: function() {
// todo: actually implement this
ok(true, "missing test - untested code is broken code");
},
+
shouldNotDrop: function() {
// todo: actually implement this
ok(true, "missing test - untested code is broken code");
}
-};
+} );
} );
"jquery",
"./menu_test_helpers",
"ui/menu"
-], function( $, menuTestHelpers ) {
+], function( $, testHelper ) {
module( "menu: core" );
$( "#test9044" ).focus();
});
- menuTestHelpers.click( element, "3" );
+ testHelper.click( element, "3" );
setTimeout( function() {
equal( document.activeElement.id, "test9044", "Focus was swallowed by menu" );
$( "#test9044" ).remove();
"jquery",
"./menu_test_helpers",
"ui/menu"
-], function( $, menuTestHelpers ) {
+], function( $, testHelper ) {
-var log = menuTestHelpers.log,
- logOutput = menuTestHelpers.logOutput,
- click = menuTestHelpers.click;
+var log = testHelper.log,
+ logOutput = testHelper.logOutput,
+ click = testHelper.click;
module( "menu: events", {
setup: function() {
- menuTestHelpers.clearLog();
+ testHelper.clearLog();
}
});
"jquery",
"./menu_test_helpers",
"ui/menu"
-], function( $, menuTestHelpers ) {
+], function( $, testHelper ) {
-var log = menuTestHelpers.log,
- logOutput = menuTestHelpers.logOutput,
- click = menuTestHelpers.click;
+var log = testHelper.log,
+ logOutput = testHelper.logOutput,
+ click = testHelper.click;
module( "menu: methods", {
setup: function() {
- menuTestHelpers.clearLog();
+ testHelper.clearLog();
}
});
"jquery",
"./menu_test_helpers",
"ui/menu"
-], function( $, menuTestHelpers ) {
+], function( $, testHelper ) {
-var log = menuTestHelpers.log,
- logOutput = menuTestHelpers.logOutput,
- click = menuTestHelpers.click;
+var log = testHelper.log,
+ logOutput = testHelper.logOutput,
+ click = testHelper.click;
module( "menu: options", {
setup: function() {
- menuTestHelpers.clearLog();
+ testHelper.clearLog();
}
});
-define( function() {
+define( [
+ "jquery",
+ "lib/helper"
+], function( $, helper ) {
var lastItem,
log = [];
-return {
+return $.extend( helper, {
log: function( message, clear ) {
if ( clear ) {
log.length = 0;
.children( ".ui-menu-item-wrapper" )
.trigger( "click" );
}
-};
+} );
} );
"jquery",
"./resizable_test_helpers",
"ui/resizable"
-], function( $, resizableTestHelpers ) {
+], function( $, testHelper ) {
module("resizable: core");
var handle = ".ui-resizable-n", target = $("#resizable1").resizable({ handles: "all" });
- resizableTestHelpers.drag(handle, 0, -50);
+ testHelper.drag(handle, 0, -50);
equal( target.height(), 150, "compare height" );
- resizableTestHelpers.drag(handle, 0, 50);
+ testHelper.drag(handle, 0, 50);
equal( target.height(), 100, "compare height" );
equal( target[0].style.left, "", "left should not be modified" );
var handle = ".ui-resizable-s", target = $("#resizable1").resizable({ handles: "all" });
- resizableTestHelpers.drag(handle, 0, 50);
+ testHelper.drag(handle, 0, 50);
equal( target.height(), 150, "compare height" );
- resizableTestHelpers.drag(handle, 0, -50);
+ testHelper.drag(handle, 0, -50);
equal( target.height(), 100, "compare height" );
equal( target[0].style.top, "", "top should not be modified" );
var handle = ".ui-resizable-e", target = $("#resizable1").resizable({ handles: "all" });
- resizableTestHelpers.drag(handle, 50);
+ testHelper.drag(handle, 50);
equal( target.width(), 150, "compare width");
- resizableTestHelpers.drag(handle, -50);
+ testHelper.drag(handle, -50);
equal( target.width(), 100, "compare width" );
equal( target[0].style.height, "", "height should not be modified" );
var handle = ".ui-resizable-w", target = $("#resizable1").resizable({ handles: "all" });
- resizableTestHelpers.drag(handle, -50);
+ testHelper.drag(handle, -50);
equal( target.width(), 150, "compare width" );
- resizableTestHelpers.drag(handle, 50);
+ testHelper.drag(handle, 50);
equal( target.width(), 100, "compare width" );
equal( target[0].style.height, "", "height should not be modified" );
var handle = ".ui-resizable-ne", target = $("#resizable1").css({ overflow: "hidden" }).resizable({ handles: "all" });
- resizableTestHelpers.drag(handle, -50, -50);
+ testHelper.drag(handle, -50, -50);
equal( target.width(), 50, "compare width" );
equal( target.height(), 150, "compare height" );
- resizableTestHelpers.drag(handle, 50, 50);
+ testHelper.drag(handle, 50, 50);
equal( target.width(), 100, "compare width" );
equal( target.height(), 100, "compare height" );
var handle = ".ui-resizable-se", target = $("#resizable1").resizable({ handles: "all" });
- resizableTestHelpers.drag(handle, 50, 50);
+ testHelper.drag(handle, 50, 50);
equal( target.width(), 150, "compare width" );
equal( target.height(), 150, "compare height" );
- resizableTestHelpers.drag(handle, -50, -50);
+ testHelper.drag(handle, -50, -50);
equal( target.width(), 100, "compare width" );
equal( target.height(), 100, "compare height" );
var handle = ".ui-resizable-sw", target = $("#resizable1").resizable({ handles: "all" });
- resizableTestHelpers.drag(handle, -50, -50);
+ testHelper.drag(handle, -50, -50);
equal( target.width(), 150, "compare width" );
equal( target.height(), 50, "compare height" );
- resizableTestHelpers.drag(handle, 50, 50);
+ testHelper.drag(handle, 50, 50);
equal( target.width(), 100, "compare width" );
equal( target.height(), 100, "compare height" );
var handle = ".ui-resizable-nw", target = $("#resizable1").resizable({ handles: "all" });
- resizableTestHelpers.drag(handle, -50, -50);
+ testHelper.drag(handle, -50, -50);
equal( target.width(), 150, "compare width" );
equal( target.height(), 150, "compare height" );
- resizableTestHelpers.drag(handle, 50, 50);
+ testHelper.drag(handle, 50, 50);
equal( target.width(), 100, "compare width" );
equal( target.height(), 100, "compare height" );
});
var handle = ".ui-resizable-w div", target = $("#resizable1").resizable({ handles: "all" });
- resizableTestHelpers.drag(handle, -50);
+ testHelper.drag(handle, -50);
equal( target.width(), 150, "compare width" );
- resizableTestHelpers.drag(handle, 50);
+ testHelper.drag(handle, 50);
equal( target.width(), 100, "compare width" );
});
left = el.css("left");
top = el.css("top");
- resizableTestHelpers.drag(handle, 50, 50);
+ testHelper.drag(handle, 50, 50);
deepEqual( el.position(), position, "position stays the same when resized" );
equal( el.css("left"), left, "css('left') stays the same when resized" );
equal( el.css("top"), top, "css('top') stays the same when resized" );
grid: [ 10, 10 ]
});
- resizableTestHelpers.drag( handle, 1, 1 );
+ testHelper.drag( handle, 1, 1 );
equal( target.width(), 100, "compare width" );
equal( target.height(), 100, "compare height" );
});
innerHandle = $( "#inner > .ui-resizable-e" );
outerHandle = $( "#outer > .ui-resizable-e" );
- resizableTestHelpers.drag( innerHandle, 10 );
+ testHelper.drag( innerHandle, 10 );
equal( inner.width(), 40, "compare width of inner element" );
- resizableTestHelpers.drag( innerHandle, -10 );
+ testHelper.drag( innerHandle, -10 );
equal( inner.width(), 30, "compare width of inner element" );
- resizableTestHelpers.drag( outerHandle, 10 );
+ testHelper.drag( outerHandle, 10 );
equal( outer.width(), 60, "compare width of outer element" );
- resizableTestHelpers.drag( outerHandle, -10 );
+ testHelper.drag( outerHandle, -10 );
equal( outer.width(), 50, "compare width of outer element" );
inner.remove();
"jquery",
"./resizable_test_helpers",
"ui/resizable"
-], function( $, resizableTestHelpers ) {
+], function( $, testHelper ) {
module("resizable: events");
}
});
- resizableTestHelpers.drag(handle, 50, 50);
+ testHelper.drag(handle, 50, 50);
equal(count, 1, "start callback should happen exactly once");
}
});
- resizableTestHelpers.drag( handle, 50, 50 );
+ testHelper.drag( handle, 50, 50 );
equal( count, 2, "resize callback should happen exactly once per size adjustment" );
}
});
- resizableTestHelpers.drag( handle, -200, -200 );
+ testHelper.drag( handle, -200, -200 );
equal( count, 1, "resize callback should happen exactly once per size adjustment" );
});
// Prove you can't resize outside containment by dragging southeast corner southeast
- resizableTestHelpers.drag( handle, 100, 100 );
+ testHelper.drag( handle, 100, 100 );
// Prove you can't resize outside containment by dragging southeast corner northwest
- resizableTestHelpers.drag( handle, -200, -200 );
+ testHelper.drag( handle, -200, -200 );
equal( count, 1, "resize callback should happen exactly once per size adjustment" );
}
});
- resizableTestHelpers.drag(handle, 50, 50);
+ testHelper.drag(handle, 50, 50);
equal(count, 1, "resize callback should happen exactly once per grid-unit size adjustment");
}
});
- resizableTestHelpers.drag( handle, 50, 50 );
+ testHelper.drag( handle, 50, 50 );
equal( element.width(), 100, "resize event can control width" );
equal( element.height(), 200, "resize event can control height" );
}
});
- resizableTestHelpers.drag(handle, 50, 50);
+ testHelper.drag(handle, 50, 50);
equal(count, 1, "stop callback should happen exactly once");
widthBefore = target.width();
- resizableTestHelpers.drag( handle, increaseWidthBy, 0 );
+ testHelper.drag( handle, increaseWidthBy, 0 );
widthAfter = target.width();
"jquery",
"./resizable_test_helpers",
"ui/resizable"
-], function( $, resizableTestHelpers ) {
+], function( $, testHelper ) {
module("resizable: options");
}),
handle = ".ui-resizable-e";
- resizableTestHelpers.drag( handle, 80 );
+ testHelper.drag( handle, 80 );
equal( element.width(), 180, "resizable width" );
equal( other.width(), 130, "alsoResize width" );
});
var handle = ".ui-resizable-e", target = $("#resizable1").resizable({ aspectRatio: "preserve", handles: "all", minWidth: 70, minHeight: 50, maxWidth: 150, maxHeight: 130 });
- resizableTestHelpers.drag(handle, 80);
+ testHelper.drag(handle, 80);
equal( target.width(), 130, "compare maxWidth");
equal( target.height(), 130, "compare maxHeight");
- resizableTestHelpers.drag(handle, -130);
+ testHelper.drag(handle, -130);
equal( target.width(), 70, "compare minWidth");
equal( target.height(), 70, "compare minHeight");
});
var handle = ".ui-resizable-w", target = $("#resizable1").resizable({ aspectRatio: "preserve", handles: "all", minWidth: 70, minHeight: 50, maxWidth: 150, maxHeight: 130 });
- resizableTestHelpers.drag(handle, -80);
+ testHelper.drag(handle, -80);
equal( target.width(), 130, "compare maxWidth");
equal( target.height(), 130, "compare maxHeight");
- resizableTestHelpers.drag(handle, 130);
+ testHelper.drag(handle, 130);
equal( target.width(), 70, "compare minWidth");
equal( target.height(), 70, "compare minHeight");
});
var handle = ".ui-resizable-n", target = $("#resizable1").resizable({ aspectRatio: "preserve", handles: "all", minWidth: 70, minHeight: 50, maxWidth: 150, maxHeight: 130 });
- resizableTestHelpers.drag(handle, 0, -80);
+ testHelper.drag(handle, 0, -80);
equal( target.width(), 130, "compare maxWidth");
equal( target.height(), 130, "compare maxHeight");
- resizableTestHelpers.drag(handle, 0, 80);
+ testHelper.drag(handle, 0, 80);
equal( target.width(), 70, "compare minWidth");
equal( target.height(), 70, "compare minHeight");
});
var handle = ".ui-resizable-s", target = $("#resizable1").resizable({ aspectRatio: "preserve", handles: "all", minWidth: 70, minHeight: 50, maxWidth: 150, maxHeight: 130 });
- resizableTestHelpers.drag(handle, 0, 80);
+ testHelper.drag(handle, 0, 80);
equal( target.width(), 130, "compare maxWidth");
equal( target.height(), 130, "compare maxHeight");
- resizableTestHelpers.drag(handle, 0, -80);
+ testHelper.drag(handle, 0, -80);
equal( target.width(), 70, "compare minWidth");
equal( target.height(), 70, "compare minHeight");
});
var handle = ".ui-resizable-se", target = $("#resizable1").resizable({ aspectRatio: "preserve", handles: "all", minWidth: 70, minHeight: 50, maxWidth: 150, maxHeight: 130 });
- resizableTestHelpers.drag(handle, 80, 80);
+ testHelper.drag(handle, 80, 80);
equal( target.width(), 130, "compare maxWidth");
equal( target.height(), 130, "compare maxHeight");
- resizableTestHelpers.drag(handle, -80, -80);
+ testHelper.drag(handle, -80, -80);
equal( target.width(), 70, "compare minWidth");
equal( target.height(), 70, "compare minHeight");
});
var handle = ".ui-resizable-sw", target = $("#resizable1").resizable({ aspectRatio: "preserve", handles: "all", minWidth: 70, minHeight: 50, maxWidth: 150, maxHeight: 130 });
- resizableTestHelpers.drag(handle, -80, 80);
+ testHelper.drag(handle, -80, 80);
equal( target.width(), 130, "compare maxWidth");
equal( target.height(), 130, "compare maxHeight");
- resizableTestHelpers.drag(handle, 80, -80);
+ testHelper.drag(handle, 80, -80);
equal( target.width(), 70, "compare minWidth");
equal( target.height(), 70, "compare minHeight");
});
var handle = ".ui-resizable-ne", target = $("#resizable1").resizable({ aspectRatio: "preserve", handles: "all", minWidth: 70, minHeight: 50, maxWidth: 150, maxHeight: 130 });
- resizableTestHelpers.drag(handle, 80, -80);
+ testHelper.drag(handle, 80, -80);
equal( target.width(), 130, "compare maxWidth");
equal( target.height(), 130, "compare maxHeight");
- resizableTestHelpers.drag(handle, -80, 80);
+ testHelper.drag(handle, -80, 80);
equal( target.width(), 70, "compare minWidth");
equal( target.height(), 70, "compare minHeight");
});
$( "#container" ).css({ width: 200, height: 300 });
$( "#resizable1" ).css({ width: 100, height: 100, left: 75, top: 200 });
- resizableTestHelpers.drag( handleW, -20 );
+ testHelper.drag( handleW, -20 );
equal( target.width(), 100, "compare width - no size change" );
equal( target.height(), 100, "compare height - no size change" );
equal( target.position().left, 75, "compare left - no movement" );
$( "#container" ).css({ width: 200, height: 300, position: "absolute", left: 100, top: 100 });
$( "#resizable1" ).css({ width: 100, height: 100, left: 0, top: 0 });
- resizableTestHelpers.drag( handleNW, -20, -20 );
+ testHelper.drag( handleNW, -20, -20 );
equal( target.width(), 100, "compare width - no size change" );
equal( target.height(), 100, "compare height - no size change" );
equal( target.position().left, 0, "compare left - no movement" );
containment: "#container"
});
- resizableTestHelpers.drag( ".ui-resizable-se", 20, 30 );
+ testHelper.drag( ".ui-resizable-se", 20, 30 );
equal( element.width(), 120, "unconstrained width within container" );
equal( element.height(), 130, "unconstrained height within container" );
- resizableTestHelpers.drag( ".ui-resizable-se", 400, 400 );
+ testHelper.drag( ".ui-resizable-se", 400, 400 );
equal( element.width(), 300, "constrained width at containment edge" );
equal( element.height(), 200, "constrained height at containment edge" );
});
handles: "all"
});
- resizableTestHelpers.drag( ".ui-resizable-e", 300, 0 );
+ testHelper.drag( ".ui-resizable-e", 300, 0 );
equal( element.width(), 400, "Relative, contained within container width" );
- resizableTestHelpers.drag( ".ui-resizable-s", 0, 300 );
+ testHelper.drag( ".ui-resizable-s", 0, 300 );
equal( element.height(), 400, "Relative, contained within container height" );
$( "#child" ).css( { left: 50, top: 50 } );
handles: "all"
});
- resizableTestHelpers.drag( ".ui-resizable-e", 400, 0 );
+ testHelper.drag( ".ui-resizable-e", 400, 0 );
equal( element.width(), 300, "Relative with Left, contained within container width" );
- resizableTestHelpers.drag( ".ui-resizable-s", 0, 400 );
+ testHelper.drag( ".ui-resizable-s", 0, 400 );
equal( element.height(), 300, "Relative with Top, contained within container height" );
});
handles: "all"
});
- resizableTestHelpers.drag( ".ui-resizable-e", 400, 0 );
+ testHelper.drag( ".ui-resizable-e", 400, 0 );
equal( element.width(), 300, "Relative, contained within container width" );
- resizableTestHelpers.drag( ".ui-resizable-s", 0, 400 );
+ testHelper.drag( ".ui-resizable-s", 0, 400 );
equal( element.height(), 300, "Relative, contained within container height" );
$( "#child" ).css( { left: 50, top: 50 } );
handles: "all"
});
- resizableTestHelpers.drag( ".ui-resizable-e", 400, 0 );
+ testHelper.drag( ".ui-resizable-e", 400, 0 );
equal( element.width(), 250, "Relative with Left, contained within container width" );
- resizableTestHelpers.drag( ".ui-resizable-s", 0, 400 );
+ testHelper.drag( ".ui-resizable-s", 0, 400 );
equal( element.height(), 250, "Relative with Top, contained within container height" );
});
var handle = ".ui-resizable-se", target = $("#resizable1").resizable({ handles: "all", grid: [ 0, 20 ] });
- resizableTestHelpers.drag(handle, 3, 9);
+ testHelper.drag(handle, 3, 9);
equal( target.width(), 103, "compare width");
equal( target.height(), 100, "compare height");
- resizableTestHelpers.drag(handle, 15, 11);
+ testHelper.drag(handle, 15, 11);
equal( target.width(), 118, "compare width");
equal( target.height(), 120, "compare height");
});
var handle = ".ui-resizable-se", target = $("#resizable1").resizable({ handles: "all", grid: 20, minWidth: 65, minHeight: 65, maxWidth: 135, maxHeight: 135 });
- resizableTestHelpers.drag(handle, 50, 50);
+ testHelper.drag(handle, 50, 50);
equal( target.width(), 120, "grid should respect maxWidth");
equal( target.height(), 120, "grid should respect maxHeight");
- resizableTestHelpers.drag(handle, -100, -100);
+ testHelper.drag(handle, -100, -100);
equal( target.width(), 80, "grid should respect minWidth");
equal( target.height(), 80, "grid should respect minHeight");
});
var handle = ".ui-resizable-se", target = $("#resizable2").resizable({ handles: "all", grid: [ 0, 20 ] });
- resizableTestHelpers.drag(handle, 3, 9);
+ testHelper.drag(handle, 3, 9);
equal( target.width(), 103, "compare width");
equal( target.height(), 100, "compare height");
- resizableTestHelpers.drag(handle, 15, 11);
+ testHelper.drag(handle, 15, 11);
equal( target.width(), 118, "compare width");
equal( target.height(), 120, "compare height");
});
grid: 50
});
- resizableTestHelpers.drag( handle, 50, 50 );
+ testHelper.drag( handle, 50, 50 );
equal( target.width(), 50, "compare width" );
equal( target.height(), 50, "compare height" );
oldPosition = target.position();
- resizableTestHelpers.drag( handle, 50, 50 );
+ testHelper.drag( handle, 50, 50 );
equal( target.width(), 50, "compare width" );
equal( target.height(), 50, "compare height" );
equal( target.position().top, oldPosition.top, "compare top" );
grid: [ 50, 12 ]
});
- resizableTestHelpers.drag( handle, 50, 50 );
+ testHelper.drag( handle, 50, 50 );
equal( target.outerWidth(), 50, "compare width" );
equal( target.outerHeight(), 52, "compare height" );
});
var handle = ".ui-resizable-se", target = $("#resizable1").resizable({ handles: "all", minWidth: 60, minHeight: 60, maxWidth: 100, maxHeight: 100 });
- resizableTestHelpers.drag(handle, -50, -50);
+ testHelper.drag(handle, -50, -50);
equal( target.width(), 60, "compare minWidth" );
equal( target.height(), 60, "compare minHeight" );
- resizableTestHelpers.drag(handle, 70, 70);
+ testHelper.drag(handle, 70, 70);
equal( target.width(), 100, "compare maxWidth" );
equal( target.height(), 100, "compare maxHeight" );
});
var handle = ".ui-resizable-sw", target = $("#resizable1").resizable({ handles: "all", minWidth: 60, minHeight: 60, maxWidth: 100, maxHeight: 100 });
- resizableTestHelpers.drag(handle, 50, -50);
+ testHelper.drag(handle, 50, -50);
equal( target.width(), 60, "compare minWidth" );
equal( target.height(), 60, "compare minHeight" );
- resizableTestHelpers.drag(handle, -70, 70);
+ testHelper.drag(handle, -70, 70);
equal( target.width(), 100, "compare maxWidth" );
equal( target.height(), 100, "compare maxHeight" );
});
var handle = ".ui-resizable-ne", target = $("#resizable1").resizable({ handles: "all", minWidth: 60, minHeight: 60, maxWidth: 100, maxHeight: 100 });
- resizableTestHelpers.drag(handle, -50, 50);
+ testHelper.drag(handle, -50, 50);
equal( target.width(), 60, "compare minWidth" );
equal( target.height(), 60, "compare minHeight" );
- resizableTestHelpers.drag(handle, 70, -70);
+ testHelper.drag(handle, 70, -70);
equal( target.width(), 100, "compare maxWidth" );
equal( target.height(), 100, "compare maxHeight" );
});
var handle = ".ui-resizable-nw", target = $("#resizable1").resizable({ handles: "all", minWidth: 60, minHeight: 60, maxWidth: 100, maxHeight: 100 });
- resizableTestHelpers.drag(handle, 70, 70);
+ testHelper.drag(handle, 70, 70);
equal( target.width(), 60, "compare minWidth" );
equal( target.height(), 60, "compare minHeight" );
- resizableTestHelpers.drag(handle, -70, -70);
+ testHelper.drag(handle, -70, -70);
equal( target.width(), 100, "compare maxWidth" );
equal( target.height(), 100, "compare maxHeight" );
});
var handle = "#resizer1",
target = $( "#resizable1" ).resizable({ handles: { "s": $( "#resizer1" ) }, containment: "parent" });
- resizableTestHelpers.drag( handle, 0, 70 );
+ testHelper.drag( handle, 0, 70 );
equal( target.height(), 170, "compare height" );
- resizableTestHelpers.drag( handle, 0, -70 );
+ testHelper.drag( handle, 0, -70 );
equal( target.height(), 100, "compare height" );
});
var handle = "#resizer1",
target = $( "#resizable1" ).resizable({ handles: { "s": $( "#resizer1" )[ 0 ] }, containment: "parent" });
- resizableTestHelpers.drag( handle, 0, 70 );
+ testHelper.drag( handle, 0, 70 );
equal( target.height(), 170, "compare height" );
- resizableTestHelpers.drag( handle, 0, -70 );
+ testHelper.drag( handle, 0, -70 );
equal( target.height(), 100, "compare height" );
});
containment: "#container"
});
- resizableTestHelpers.drag( ".ui-resizable-se", 400, 400 );
+ testHelper.drag( ".ui-resizable-se", 400, 400 );
equal( element.width(), 300, "resizable constrained width at containment edge" );
equal( element.height(), 200, "resizable constrained height at containment edge" );
equal( other.width(), 250, "alsoResize constrained width at containment edge" );
containment: "#container"
});
- resizableTestHelpers.drag( ".ui-resizable-se", 400, 400 );
+ testHelper.drag( ".ui-resizable-se", 400, 400 );
equal( element.width(), 300, "resizable constrained width at containment edge" );
equal( element.height(), 200, "resizable constrained height at containment edge" );
equal( other1.width(), 250, "alsoResize o1 constrained width at containment edge" );
-define( function() {
+define( [
+ "jquery",
+ "lib/helper"
+], function( $, helper ) {
-return {
+return $.extend( helper, {
drag: function( el, dx, dy ) {
// this mouseover is to work around a limitation in resizable
// TODO: fix resizable so handle doesn't require mouseover in order to be used
dy: dy
});
}
-};
+} );
} );
"jquery",
"./sortable_test_helpers",
"ui/sortable"
-], function( $, sortableTestHelpers ) {
+], function( $, testHelper ) {
module( "sortable: core" );
connectWith: ".connectWith"
});
- sortableTestHelpers.sort( $( "li", el[ 1 ] )[ 0 ], 0, -12, 5, "Dragging the sortable into connected sortable" );
+ testHelper.sort( $( "li", el[ 1 ] )[ 0 ], 0, -12, 5, "Dragging the sortable into connected sortable" );
});
test( "ui-sortable-handle applied to appropriate element", function( assert ) {
"./sortable_test_helpers",
"ui/sortable",
"ui/draggable"
-], function( $, sortableTestHelpers ) {
+], function( $, testHelper ) {
module("sortable: events");
}
});
- sortableTestHelpers.sort($("li", el)[0], 0, 44, 2, "Dragging the sortable");
+ testHelper.sort($("li", el)[0], 0, 44, 2, "Dragging the sortable");
equal(helper, null, "helper should be false");
});
"jquery",
"./sortable_test_helpers",
"ui/sortable"
-], function( $, sortableTestHelpers ) {
+], function( $, testHelper ) {
module("sortable: methods");
el = $("#sortable").sortable({ disabled: true });
- sortableTestHelpers.sort($("li", el)[0], 0, 44, 0, ".sortable({ disabled: true })");
+ testHelper.sort($("li", el)[0], 0, 44, 0, ".sortable({ disabled: true })");
el.sortable("enable");
equal(el.sortable("option", "disabled"), false, "disabled option getter");
el.sortable("option", "disabled", false);
equal(el.sortable("option", "disabled"), false, "disabled option setter");
- sortableTestHelpers.sort($("li", el)[0], 0, 44, 2, ".sortable('option', 'disabled', false)");
+ testHelper.sort($("li", el)[0], 0, 44, 2, ".sortable('option', 'disabled', false)");
expected = $("<div></div>").sortable(),
actual = expected.sortable("enable");
var chainable,
element = $( "#sortable" ).sortable({ disabled: false });
- sortableTestHelpers.sort( $( "li", element )[ 0 ], 0, 44, 2, ".sortable({ disabled: false })" );
+ testHelper.sort( $( "li", element )[ 0 ], 0, 44, 2, ".sortable({ disabled: false })" );
chainable = element.sortable( "disable" );
- sortableTestHelpers.sort( $( "li", element )[ 0 ], 0, 44, 0, "disabled.sortable getter" );
+ testHelper.sort( $( "li", element )[ 0 ], 0, 44, 0, "disabled.sortable getter" );
element.sortable( "destroy" );
element.sortable({ disabled: false });
- sortableTestHelpers.sort( $( "li", element )[ 0 ], 0, 44, 2, ".sortable({ disabled: false })" );
+ testHelper.sort( $( "li", element )[ 0 ], 0, 44, 2, ".sortable({ disabled: false })" );
element.sortable( "option", "disabled", true);
equal( element.sortable( "option", "disabled" ), true, "disabled option setter" );
ok( !element.sortable( "widget" ).attr( "aria-disabled" ), "element does not get aria-disabled" );
assert.hasClasses( element.sortable( "widget" ), "ui-sortable-disabled" );
- sortableTestHelpers.sort($( "li", element )[ 0 ], 0, 44, 0, ".sortable('option', 'disabled', true)" );
+ testHelper.sort($( "li", element )[ 0 ], 0, 44, 0, ".sortable('option', 'disabled', true)" );
equal( chainable, element, "disable is chainable" );
});
-define( function() {
+define( [
+ "jquery",
+ "lib/helper"
+], function( $, helper ) {
-return {
+return $.extend( helper, {
sort: function( handle, dx, dy, index, msg ) {
$( handle ).simulate( "drag", {
dx: dx,
});
equal( $( handle ).parent().children().index( handle ), index, msg );
}
-};
+} );
} );
"jquery",
"./spinner_test_helpers",
"ui/spinner"
-], function( $, spinnerTestHelpers ) {
+], function( $, testHelper ) {
-var simulateKeyDownUp = spinnerTestHelpers.simulateKeyDownUp;
+var simulateKeyDownUp = testHelper.simulateKeyDownUp;
module( "spinner: core" );
"jquery",
"./spinner_test_helpers",
"ui/spinner"
-], function( $, spinnerTestHelpers ) {
+], function( $, testHelper ) {
-var simulateKeyDownUp = spinnerTestHelpers.simulateKeyDownUp;
+var simulateKeyDownUp = testHelper.simulateKeyDownUp;
module( "spinner: events" );
"jquery",
"./spinner_test_helpers",
"ui/spinner"
-], function( $, spinnerTestHelpers ) {
+], function( $, testHelper ) {
-var simulateKeyDownUp = spinnerTestHelpers.simulateKeyDownUp;
+var simulateKeyDownUp = testHelper.simulateKeyDownUp;
module( "spinner: methods" );
-define( function() {
+define( [
+ "jquery",
+ "lib/helper"
+], function( $, helper ) {
-return {
+return $.extend( helper, {
simulateKeyDownUp: function( element, keyCode, shift ) {
element
.simulate( "keydown", { keyCode: keyCode, shiftKey: shift || false } )
.simulate( "keyup", { keyCode: keyCode, shiftKey: shift || false } );
}
-};
+} );
} );
"jquery",
"./tabs_test_helpers",
"ui/tabs"
-], function( $, tabsTestHelpers ) {
+], function( $, testHelper ) {
-var state = tabsTestHelpers.state;
+var state = testHelper.state;
module( "tabs: core" );
"jquery",
"./tabs_test_helpers",
"ui/tabs"
-], function( $, tabsTestHelpers ) {
+], function( $, testHelper ) {
-var state = tabsTestHelpers.state;
+var state = testHelper.state;
module( "tabs: events" );
"jquery",
"./tabs_test_helpers",
"ui/tabs"
-], function( $, tabsTestHelpers ) {
+], function( $, testHelper ) {
-var disabled = tabsTestHelpers.disabled,
- state = tabsTestHelpers.state;
+var disabled = testHelper.disabled,
+ state = testHelper.state;
module( "tabs: methods" );
"jquery",
"./tabs_test_helpers",
"ui/tabs"
-], function( $, tabsTestHelpers ) {
+], function( $, testHelper ) {
-var disabled = tabsTestHelpers.disabled,
- equalHeight = tabsTestHelpers.equalHeight,
- state = tabsTestHelpers.state;
+var disabled = testHelper.disabled,
+ equalHeight = testHelper.equalHeight,
+ state = testHelper.state;
module( "tabs: options" );
-define( function() {
+define( [
+ "jquery",
+ "lib/helper",
+ "ui/tabs"
+], function( $, helper ) {
-return {
+return $.extend( helper, {
disabled: function( tabs, state ) {
var expected, actual,
internalState = tabs.tabs( "option", "disabled" );
}).get();
deepEqual( actual, expected );
}
-};
+} );
} );