diff options
author | Felix Nagel <info@felixnagel.com> | 2013-04-21 15:10:38 +0200 |
---|---|---|
committer | Felix Nagel <info@felixnagel.com> | 2013-04-21 15:10:38 +0200 |
commit | 4efd006e26a6cdc3bf78832c0a0832e7301c841b (patch) | |
tree | 5263fe72e9a2784410632d2dee56efd4e58b83f2 /tests/unit | |
parent | 73c7342bc4418a902bf021c89e7d2c43172e004e (diff) | |
parent | 71a332e8b83a1657521e04388f5592997e81bbcc (diff) | |
download | jquery-ui-4efd006e26a6cdc3bf78832c0a0832e7301c841b.tar.gz jquery-ui-4efd006e26a6cdc3bf78832c0a0832e7301c841b.zip |
Merge branch 'master' into selectmenu
Diffstat (limited to 'tests/unit')
-rw-r--r-- | tests/unit/button/button.html | 2 | ||||
-rw-r--r-- | tests/unit/button/button_core.js | 37 | ||||
-rw-r--r-- | tests/unit/datepicker/datepicker_core.js | 373 | ||||
-rw-r--r-- | tests/unit/datepicker/datepicker_options.js | 238 | ||||
-rw-r--r-- | tests/unit/datepicker/datepicker_test_helpers.js | 21 | ||||
-rw-r--r-- | tests/unit/draggable/draggable_core.js | 85 | ||||
-rw-r--r-- | tests/unit/draggable/draggable_options.js | 44 | ||||
-rw-r--r-- | tests/unit/draggable/draggable_test_helpers.js | 61 |
8 files changed, 557 insertions, 304 deletions
diff --git a/tests/unit/button/button.html b/tests/unit/button/button.html index eeb568686..223581ef7 100644 --- a/tests/unit/button/button.html +++ b/tests/unit/button/button.html @@ -71,6 +71,8 @@ <div><input id="submit" type="submit" value="Label"></div> +<button id="button1">Button</button> + </div> </body> </html> diff --git a/tests/unit/button/button_core.js b/tests/unit/button/button_core.js index dbc079818..6df7da9db 100644 --- a/tests/unit/button/button_core.js +++ b/tests/unit/button/button_core.js @@ -153,6 +153,30 @@ test( "#6262 - buttonset not applying ui-corner to invisible elements", function ok( set.find( "label:eq(2)" ).is( ".ui-button.ui-corner-right" ) ); }); +asyncTest( "Resetting a button's form should refresh the visual state of the button widget to match.", function() { + expect( 2 ); + var form = $( "<form>" + + "<button></button>" + + "<label for='c1'></label><input id='c1' type='checkbox' checked>" + + "</form>" ), + button = form.find( "button" ).button(), + checkbox = form.find( "input[type=checkbox]" ).button(); + + checkbox.prop( "checked", false ).button( "refresh" ); + ok( !checkbox.button( "widget" ).hasClass( "ui-state-active" ) ); + + form.get( 0 ).reset(); + + // #9213: If a button has been removed, refresh should not be called on it when + // its corresponding form is reset. + button.remove(); + + setTimeout(function() { + ok( checkbox.button( "widget" ).hasClass( "ui-state-active" )); + start(); + }); +}); + asyncTest( "#6711 Checkbox/Radiobutton do not Show Focused State when using Keyboard Navigation", function() { expect( 2 ); var check = $( "#check" ).button(), @@ -172,4 +196,17 @@ test( "#7534 - Button label selector works for ids with \":\"", function() { ok( group.find( "label" ).is( ".ui-button" ), "Found an id with a :" ); }); +asyncTest( "#9169 - Disabled button maintains ui-state-focus", function() { + expect( 2 ); + var element = $( "#button1" ).button(); + element[ 0 ].focus(); + setTimeout(function() { + ok( element.hasClass( "ui-state-focus" ), "button has ui-state-focus" ); + element.button( "disable" ); + ok( !element.hasClass( "ui-state-focus" ), + "button does not have ui-state-focus when disabled" ); + start(); + }); +}); + })(jQuery); diff --git a/tests/unit/datepicker/datepicker_core.js b/tests/unit/datepicker/datepicker_core.js index befda3b2a..0bc5723ec 100644 --- a/tests/unit/datepicker/datepicker_core.js +++ b/tests/unit/datepicker/datepicker_core.js @@ -30,154 +30,173 @@ test("widget method", function() { deepEqual($("body > #ui-datepicker-div:last-child")[0], actual); }); -asyncTest("baseStructure", function() { +asyncTest( "baseStructure", function() { expect( 58 ); var header, title, table, thead, week, panel, inl, child, - inp = TestHelpers.datepicker.init("#inp"), - dp = $("#ui-datepicker-div"); + inp = TestHelpers.datepicker.initNewInput(), + dp = $( "#ui-datepicker-div" ); function step1() { - inp[0].focus(); - setTimeout(function() { - ok(dp.is(":visible"), "Structure - datepicker visible"); - ok(!dp.is(".ui-datepicker-rtl"), "Structure - not right-to-left"); - ok(!dp.is(".ui-datepicker-multi"), "Structure - not multi-month"); - equal(dp.children().length, 2, "Structure - child count"); - - header = dp.children(":first"); - ok(header.is("div.ui-datepicker-header"), "Structure - header division"); - equal(header.children().length, 3, "Structure - header child count"); - ok(header.children(":first").is("a.ui-datepicker-prev") && header.children(":first").html() !== "", "Structure - prev link"); - ok(header.children(":eq(1)").is("a.ui-datepicker-next") && header.children(":eq(1)").html() !== "", "Structure - next link"); - - title = header.children(":last"); - ok(title.is("div.ui-datepicker-title") && title.html() !== "","Structure - title division"); - equal(title.children().length, 2, "Structure - title child count"); - ok(title.children(":first").is("span.ui-datepicker-month") && title.children(":first").text() !== "", "Structure - month text"); - ok(title.children(":last").is("span.ui-datepicker-year") && title.children(":last").text() !== "", "Structure - year text"); - - table = dp.children(":eq(1)"); - ok(table.is("table.ui-datepicker-calendar"), "Structure - month table"); - ok(table.children(":first").is("thead"), "Structure - month table thead"); - thead = table.children(":first").children(":first"); - ok(thead.is("tr"), "Structure - month table title row"); - equal(thead.find("th").length, 7, "Structure - month table title cells"); - ok(table.children(":eq(1)").is("tbody"), "Structure - month table body"); - ok(table.children(":eq(1)").children("tr").length >= 4, "Structure - month table week count"); - week = table.children(":eq(1)").children(":first"); - ok(week.is("tr"), "Structure - month table week row"); - equal(week.children().length, 7, "Structure - week child count"); - ok(week.children(":first").is("td.ui-datepicker-week-end"), "Structure - month table first day cell"); - ok(week.children(":last").is("td.ui-datepicker-week-end"), "Structure - month table second day cell"); - inp.datepicker("hide").datepicker("destroy"); - + TestHelpers.datepicker.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" ); + equal( dp.children().length, 2, "Structure - child count" ); + + header = dp.children( ":first" ); + ok( header.is( "div.ui-datepicker-header" ), "Structure - header division" ); + equal( header.children().length, 3, "Structure - header child count" ); + ok( header.children( ":first" ).is( "a.ui-datepicker-prev" ) && header.children( ":first" ).html() !== "", "Structure - prev link" ); + ok( header.children( ":eq(1)" ).is( "a.ui-datepicker-next" ) && header.children( ":eq(1)" ).html() !== "", "Structure - next link" ); + + title = header.children( ":last" ); + ok( title.is( "div.ui-datepicker-title" ) && title.html() !== "","Structure - title division" ); + equal( title.children().length, 2, "Structure - title child count" ); + ok( title.children( ":first" ).is( "span.ui-datepicker-month" ) && title.children( ":first" ).text() !== "", "Structure - month text" ); + ok( title.children( ":last" ).is( "span.ui-datepicker-year" ) && title.children( ":last" ).text() !== "", "Structure - year text" ); + + table = dp.children( ":eq(1)" ); + ok( table.is( "table.ui-datepicker-calendar" ), "Structure - month table" ); + ok( table.children( ":first" ).is( "thead" ), "Structure - month table thead" ); + + thead = table.children( ":first" ).children( ":first" ); + ok( thead.is( "tr" ), "Structure - month table title row" ); + equal( thead.find( "th" ).length, 7, "Structure - month table title cells" ); + ok( table.children( ":eq(1)" ).is( "tbody" ), "Structure - month table body" ); + ok( table.children( ":eq(1)" ).children( "tr" ).length >= 4, "Structure - month table week count" ); + + week = table.children( ":eq(1)" ).children( ":first" ); + ok( week.is( "tr" ), "Structure - month table week row" ); + equal( week.children().length, 7, "Structure - week child count" ); + ok( week.children( ":first" ).is( "td.ui-datepicker-week-end" ), "Structure - month table first day cell" ); + ok( week.children( ":last" ).is( "td.ui-datepicker-week-end" ), "Structure - month table second day cell" ); + + inp.datepicker( "hide" ).datepicker( "destroy" ); step2(); }); } function step2() { // Editable month/year and button panel - inp = TestHelpers.datepicker.init("#inp", {changeMonth: true, changeYear: true, showButtonPanel: true}); - inp.focus(); - setTimeout(function() { - title = dp.find("div.ui-datepicker-title"); - ok(title.children(":first").is("select.ui-datepicker-month"), "Structure - month selector"); - ok(title.children(":last").is("select.ui-datepicker-year"), "Structure - year selector"); - - panel = dp.children(":last"); - ok(panel.is("div.ui-datepicker-buttonpane"), "Structure - button panel division"); - equal(panel.children().length, 2, "Structure - button panel child count"); - ok(panel.children(":first").is("button.ui-datepicker-current"), "Structure - today button"); - ok(panel.children(":last").is("button.ui-datepicker-close"), "Structure - close button"); - inp.datepicker("hide").datepicker("destroy"); - + inp = TestHelpers.datepicker.initNewInput({ + changeMonth: true, + changeYear: true, + showButtonPanel: true + }); + TestHelpers.datepicker.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" ); + + panel = dp.children( ":last" ); + ok( panel.is( "div.ui-datepicker-buttonpane" ), "Structure - button panel division" ); + equal( panel.children().length, 2, "Structure - button panel child count" ); + ok( panel.children( ":first" ).is( "button.ui-datepicker-current" ), "Structure - today button" ); + ok( panel.children( ":last" ).is( "button.ui-datepicker-close" ), "Structure - close button" ); + + inp.datepicker( "hide" ).datepicker( "destroy" ); step3(); }); } function step3() { // Multi-month 2 - inp = TestHelpers.datepicker.init("#inp", {numberOfMonths: 2}); - inp.focus(); - setTimeout(function() { - ok(dp.is(".ui-datepicker-multi"), "Structure multi [2] - multi-month"); - equal(dp.children().length, 3, "Structure multi [2] - child count"); - child = dp.children(":first"); - ok(child.is("div.ui-datepicker-group") && child.is("div.ui-datepicker-group-first"), "Structure multi [2] - first month division"); - child = dp.children(":eq(1)"); - ok(child.is("div.ui-datepicker-group") && child.is("div.ui-datepicker-group-last"), "Structure multi [2] - second month division"); - child = dp.children(":eq(2)"); - ok(child.is("div.ui-datepicker-row-break"), "Structure multi [2] - row break"); - ok(dp.is(".ui-datepicker-multi-2"), "Structure multi [2] - multi-2"); - inp.datepicker("hide").datepicker("destroy"); + inp = TestHelpers.datepicker.initNewInput({ numberOfMonths: 2 }); + TestHelpers.datepicker.onFocus( inp, function() { + ok( dp.is( ".ui-datepicker-multi" ), "Structure multi [2] - multi-month" ); + equal( dp.children().length, 3, "Structure multi [2] - child count" ); + child = dp.children( ":first" ); + ok( child.is( "div.ui-datepicker-group" ) && child.is( "div.ui-datepicker-group-first" ), "Structure multi [2] - first month division" ); + + child = dp.children( ":eq(1)" ); + ok( child.is( "div.ui-datepicker-group" ) && child.is( "div.ui-datepicker-group-last" ), "Structure multi [2] - second month division" ); + + child = dp.children( ":eq(2)" ); + ok( child.is( "div.ui-datepicker-row-break" ), "Structure multi [2] - row break" ); + ok( dp.is( ".ui-datepicker-multi-2" ), "Structure multi [2] - multi-2" ); + + inp.datepicker( "hide" ).datepicker( "destroy" ); step4(); }); } function step4() { // Multi-month 3 - inp = TestHelpers.datepicker.init("#inp", {numberOfMonths: 3}); - inp.focus(); - setTimeout(function() { - ok(dp.is(".ui-datepicker-multi-3"), "Structure multi [3] - multi-3"); - ok(! dp.is(".ui-datepicker-multi-2"), "Structure multi [3] - Trac #6704"); - inp.datepicker("hide").datepicker("destroy"); + inp = TestHelpers.datepicker.initNewInput({ numberOfMonths: 3 }); + TestHelpers.datepicker.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" ); + inp.datepicker( "hide" ).datepicker( "destroy" ); step5(); }); } function step5() { // Multi-month [2, 2] - inp = TestHelpers.datepicker.init("#inp", {numberOfMonths: [2, 2]}); - inp.focus(); - setTimeout(function() { - ok(dp.is(".ui-datepicker-multi"), "Structure multi - multi-month"); - equal(dp.children().length, 6, "Structure multi [2,2] - child count"); - child = dp.children(":first"); - ok(child.is("div.ui-datepicker-group") && child.is("div.ui-datepicker-group-first"), "Structure multi [2,2] - first month division"); - child = dp.children(":eq(1)"); - ok(child.is("div.ui-datepicker-group") && child.is("div.ui-datepicker-group-last"), "Structure multi [2,2] - second month division"); - child = dp.children(":eq(2)"); - ok(child.is("div.ui-datepicker-row-break"), "Structure multi [2,2] - row break"); - child = dp.children(":eq(3)"); - ok(child.is("div.ui-datepicker-group") && child.is("div.ui-datepicker-group-first"), "Structure multi [2,2] - third month division"); - child = dp.children(":eq(4)"); - ok(child.is("div.ui-datepicker-group") && child.is("div.ui-datepicker-group-last"), "Structure multi [2,2] - fourth month division"); - child = dp.children(":eq(5)"); - ok(child.is("div.ui-datepicker-row-break"), "Structure multi [2,2] - row break"); - inp.datepicker("hide").datepicker("destroy"); + inp = TestHelpers.datepicker.initNewInput({ numberOfMonths: [ 2, 2 ] }); + TestHelpers.datepicker.onFocus( inp, function() { + ok( dp.is( ".ui-datepicker-multi" ), "Structure multi - multi-month" ); + equal( dp.children().length, 6, "Structure multi [2,2] - child count" ); + + child = dp.children( ":first" ); + ok( child.is( "div.ui-datepicker-group" ) && child.is( "div.ui-datepicker-group-first" ), "Structure multi [2,2] - first month division" ); + + child = dp.children( ":eq(1)" ); + ok( child.is( "div.ui-datepicker-group" ) && child.is( "div.ui-datepicker-group-last" ), "Structure multi [2,2] - second month division" ); + + child = dp.children( ":eq(2)" ); + ok( child.is( "div.ui-datepicker-row-break" ), "Structure multi [2,2] - row break" ); + + child = dp.children( ":eq(3)" ); + ok( child.is( "div.ui-datepicker-group" ) && child.is( "div.ui-datepicker-group-first" ), "Structure multi [2,2] - third month division" ); + + child = dp.children( ":eq(4)" ); + ok( child.is( "div.ui-datepicker-group" ) && child.is( "div.ui-datepicker-group-last" ), "Structure multi [2,2] - fourth month division" ); + + child = dp.children( ":eq(5)" ); + ok( child.is( "div.ui-datepicker-row-break" ), "Structure multi [2,2] - row break" ); + + inp.datepicker( "hide" ).datepicker( "destroy" ); // Inline - inl = TestHelpers.datepicker.init("#inl"); + inl = TestHelpers.datepicker.init( "#inl" ); dp = inl.children(); - ok(dp.is(".ui-datepicker-inline"), "Structure inline - main div"); - ok(!dp.is(".ui-datepicker-rtl"), "Structure inline - not right-to-left"); - ok(!dp.is(".ui-datepicker-multi"), "Structure inline - not multi-month"); - equal(dp.children().length, 2, "Structure inline - child count"); - header = dp.children(":first"); - ok(header.is("div.ui-datepicker-header"), "Structure inline - header division"); - equal(header.children().length, 3, "Structure inline - header child count"); - table = dp.children(":eq(1)"); - ok(table.is("table.ui-datepicker-calendar"), "Structure inline - month table"); - ok(table.children(":first").is("thead"), "Structure inline - month table thead"); - ok(table.children(":eq(1)").is("tbody"), "Structure inline - month table body"); - inl.datepicker("destroy"); + + ok( dp.is( ".ui-datepicker-inline" ), "Structure inline - main div" ); + ok( !dp.is( ".ui-datepicker-rtl" ), "Structure inline - not right-to-left" ); + ok( !dp.is( ".ui-datepicker-multi" ), "Structure inline - not multi-month" ); + equal( dp.children().length, 2, "Structure inline - child count" ); + + header = dp.children( ":first" ); + ok( header.is( "div.ui-datepicker-header" ), "Structure inline - header division" ); + equal( header.children().length, 3, "Structure inline - header child count" ); + + table = dp.children( ":eq(1)" ); + ok( table.is( "table.ui-datepicker-calendar" ), "Structure inline - month table" ); + ok( table.children( ":first" ).is( "thead" ), "Structure inline - month table thead" ); + ok( table.children( ":eq(1)" ).is( "tbody" ), "Structure inline - month table body" ); + + inl.datepicker( "destroy" ); // Inline multi-month - inl = TestHelpers.datepicker.init("#inl", {numberOfMonths: 2}); + inl = TestHelpers.datepicker.init( "#inl", { numberOfMonths: 2 } ); dp = inl.children(); - ok(dp.is(".ui-datepicker-inline") && dp.is(".ui-datepicker-multi"), "Structure inline multi - main div"); - equal(dp.children().length, 3, "Structure inline multi - child count"); - child = dp.children(":first"); - ok(child.is("div.ui-datepicker-group") && child.is("div.ui-datepicker-group-first"), "Structure inline multi - first month division"); - child = dp.children(":eq(1)"); - ok(child.is("div.ui-datepicker-group") && child.is("div.ui-datepicker-group-last"), "Structure inline multi - second month division"); - child = dp.children(":eq(2)"); - ok(child.is("div.ui-datepicker-row-break"), "Structure inline multi - row break"); - inl.datepicker("destroy"); + ok( dp.is( ".ui-datepicker-inline" ) && dp.is( ".ui-datepicker-multi" ), "Structure inline multi - main div" ); + equal( dp.children().length, 3, "Structure inline multi - child count" ); + + child = dp.children( ":first" ); + ok( child.is( "div.ui-datepicker-group" ) && child.is( "div.ui-datepicker-group-first" ), "Structure inline multi - first month division" ); + + child = dp.children( ":eq(1)" ); + ok( child.is( "div.ui-datepicker-group" ) && child.is( "div.ui-datepicker-group-last" ), "Structure inline multi - second month division" ); + + child = dp.children( ":eq(2)" ); + ok( child.is( "div.ui-datepicker-row-break" ), "Structure inline multi - row break" ); + + inl.datepicker( "destroy" ); start(); }); } @@ -185,61 +204,103 @@ asyncTest("baseStructure", function() { step1(); }); -test("customStructure", function() { +asyncTest( "customStructure", function() { expect( 20 ); var header, panel, title, thead, - dp = $("#ui-datepicker-div"), - // Check right-to-left localisation - inp = TestHelpers.datepicker.init("#inp", $.datepicker.regional.he); - inp.datepicker( "option", "showButtonPanel", true); - inp.focus(); - ok(dp.is(".ui-datepicker-rtl"), "Structure RTL - right-to-left"); - header = dp.children(":first"); - ok(header.is("div.ui-datepicker-header"), "Structure RTL - header division"); - equal(header.children().length, 3, "Structure RTL - header child count"); - ok(header.children(":first").is("a.ui-datepicker-next"), "Structure RTL - prev link"); - ok(header.children(":eq(1)").is("a.ui-datepicker-prev"), "Structure RTL - next link"); - panel = dp.children(":last"); - ok(panel.is("div.ui-datepicker-buttonpane"), "Structure RTL - button division"); - equal(panel.children().length, 2, "Structure RTL - button panel child count"); - ok(panel.children(":first").is("button.ui-datepicker-close"), "Structure RTL - close button"); - ok(panel.children(":last").is("button.ui-datepicker-current"), "Structure RTL - today button"); - inp.datepicker("hide").datepicker("destroy"); + inp = TestHelpers.datepicker.initNewInput( $.datepicker.regional.he ), + dp = $( "#ui-datepicker-div" ); + + function step1() { + inp.datepicker( "option", "showButtonPanel", true ); + + TestHelpers.datepicker.onFocus( inp, function() { + ok( dp.is( ".ui-datepicker-rtl" ), "Structure RTL - right-to-left" ); + + header = dp.children( ":first" ); + ok( header.is( "div.ui-datepicker-header" ), "Structure RTL - header division" ); + equal( header.children().length, 3, "Structure RTL - header child count" ); + ok( header.children( ":first" ).is( "a.ui-datepicker-next" ), "Structure RTL - prev link" ); + ok( header.children( ":eq(1)" ).is( "a.ui-datepicker-prev" ), "Structure RTL - next link" ); + + panel = dp.children( ":last" ); + ok( panel.is( "div.ui-datepicker-buttonpane" ), "Structure RTL - button division" ); + equal( panel.children().length, 2, "Structure RTL - button panel child count" ); + ok( panel.children( ":first" ).is( "button.ui-datepicker-close" ), "Structure RTL - close button" ); + ok( panel.children( ":last" ).is( "button.ui-datepicker-current" ), "Structure RTL - today button" ); + + inp.datepicker( "hide" ).datepicker( "destroy" ); + step2(); + }); + } // Hide prev/next - inp = TestHelpers.datepicker.init("#inp", {hideIfNoPrevNext: true, minDate: new Date(2008, 2 - 1, 4), maxDate: new Date(2008, 2 - 1, 14)}); - inp.val("02/10/2008").focus(); - header = dp.children(":first"); - ok(header.is("div.ui-datepicker-header"), "Structure hide prev/next - header division"); - equal(header.children().length, 1, "Structure hide prev/next - links child count"); - ok(header.children(":first").is("div.ui-datepicker-title"), "Structure hide prev/next - title division"); - inp.datepicker("hide").datepicker("destroy"); + function step2() { + inp = TestHelpers.datepicker.initNewInput({ + hideIfNoPrevNext: true, + minDate: new Date( 2008, 2 - 1, 4 ), + maxDate: new Date( 2008, 2 - 1, 14 ) + }); + inp.val( "02/10/2008" ); + + TestHelpers.datepicker.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" ); + ok( header.children( ":first" ).is( "div.ui-datepicker-title" ), "Structure hide prev/next - title division" ); + + inp.datepicker( "hide" ).datepicker( "destroy" ); + step3(); + }); + } // Changeable Month with read-only year - inp = TestHelpers.datepicker.init("#inp", {changeMonth: true}); - inp.focus(); - title = dp.children(":first").children(":last"); - equal(title.children().length, 2, "Structure changeable month - title child count"); - ok(title.children(":first").is("select.ui-datepicker-month"), "Structure changeable month - month selector"); - ok(title.children(":last").is("span.ui-datepicker-year"), "Structure changeable month - read-only year"); - inp.datepicker("hide").datepicker("destroy"); + function step3() { + inp = TestHelpers.datepicker.initNewInput({ changeMonth: true }); + + TestHelpers.datepicker.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" ); + ok( title.children( ":last" ).is( "span.ui-datepicker-year" ), "Structure changeable month - read-only year" ); + + inp.datepicker( "hide" ).datepicker( "destroy" ); + step4(); + }); + } // Changeable year with read-only month - inp = TestHelpers.datepicker.init("#inp", {changeYear: true}); - inp.focus(); - title = dp.children(":first").children(":last"); - equal(title.children().length, 2, "Structure changeable year - title child count"); - ok(title.children(":first").is("span.ui-datepicker-month"), "Structure changeable year - read-only month"); - ok(title.children(":last").is("select.ui-datepicker-year"), "Structure changeable year - year selector"); - inp.datepicker("hide").datepicker("destroy"); + function step4() { + inp = TestHelpers.datepicker.initNewInput({ changeYear: true }); + + TestHelpers.datepicker.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" ); + ok( title.children( ":last" ).is( "select.ui-datepicker-year" ), "Structure changeable year - year selector" ); + + inp.datepicker( "hide" ).datepicker( "destroy" ); + step5(); + }); + } // Read-only first day of week - inp = TestHelpers.datepicker.init("#inp", {changeFirstDay: false}); - inp.focus(); - thead = dp.find(".ui-datepicker-calendar thead tr"); - equal(thead.children().length, 7, "Structure read-only first day - thead child count"); - equal(thead.find("a").length, 0, "Structure read-only first day - thead links count"); - inp.datepicker("hide").datepicker("destroy"); + function step5() { + inp = TestHelpers.datepicker.initNewInput({ changeFirstDay: false }); + + TestHelpers.datepicker.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" ); + + inp.datepicker( "hide" ).datepicker( "destroy" ); + start(); + }); + } + + // TODO: figure out why this setTimeout is needed in IE, + // it only is necessary when the previous baseStructure tests runs first + // Support: IE + setTimeout( step1 ); }); test("keystrokes", function() { diff --git a/tests/unit/datepicker/datepicker_options.js b/tests/unit/datepicker/datepicker_options.js index 1efd854a9..a775a5302 100644 --- a/tests/unit/datepicker/datepicker_options.js +++ b/tests/unit/datepicker/datepicker_options.js @@ -87,114 +87,135 @@ test("change", function() { equal($.datepicker._defaults.showOn, "focus", "Retain default showOn"); }); -asyncTest("invocation", function() { - expect( 29 ); +asyncTest( "invocation", function() { var button, image, - inp = TestHelpers.datepicker.init("#inp"), - dp = $("#ui-datepicker-div"), - body = $("body"); + isOldIE = $.ui.ie && ( !document.documentMode || document.documentMode < 9 ), + body = $( "body" ); + + expect( isOldIE ? 25 : 29 ); + + function step0() { + var inp = TestHelpers.datepicker.initNewInput(), + dp = $( "#ui-datepicker-div" ); + + button = inp.siblings( "button" ); + ok( button.length === 0, "Focus - button absent" ); + image = inp.siblings( "img" ); + ok( image.length === 0, "Focus - image absent" ); + + TestHelpers.datepicker.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" ); + step1(); + }); + } function step1() { - // On focus - button = inp.siblings("button"); - ok(button.length === 0, "Focus - button absent"); - image = inp.siblings("img"); - ok(image.length === 0, "Focus - image absent"); - inp[0].focus(); - setTimeout(function() { - ok(dp.is(":visible"), "Focus - rendered on focus"); - inp.simulate("keydown", {keyCode: $.ui.keyCode.ESCAPE}); - ok(!dp.is(":visible"), "Focus - hidden on exit"); - inp[0].blur(); - setTimeout(function() { - inp[0].focus(); - setTimeout(function() { - ok(dp.is(":visible"), "Focus - rendered on focus"); - body.simulate("mousedown", {}); - ok(!dp.is(":visible"), "Focus - hidden on external click"); - inp.datepicker("hide").datepicker("destroy"); - - step2(); - }); - }); + + var inp = TestHelpers.datepicker.initNewInput(), + dp = $( "#ui-datepicker-div" ); + + TestHelpers.datepicker.onFocus( inp, function() { + ok( dp.is( ":visible" ), "Focus - rendered on focus" ); + body.simulate( "mousedown", {} ); + ok( !dp.is( ":visible" ), "Focus - hidden on external click" ); + inp.datepicker( "hide" ).datepicker( "destroy" ); + + step2(); }); } function step2() { - // On button - inp = TestHelpers.datepicker.init("#inp", {showOn: "button", buttonText: "Popup"}); - ok(!dp.is(":visible"), "Button - initially hidden"); - button = inp.siblings("button"); - image = inp.siblings("img"); - ok(button.length === 1, "Button - button present"); - ok(image.length === 0, "Button - image absent"); - equal(button.text(), "Popup", "Button - button text"); - inp[0].focus(); - setTimeout(function() { - ok(!dp.is(":visible"), "Button - not rendered on focus"); + var inp = TestHelpers.datepicker.initNewInput({ + showOn: "button", + buttonText: "Popup" + }), + dp = $( "#ui-datepicker-div" ); + + ok( !dp.is( ":visible" ), "Button - initially hidden" ); + button = inp.siblings( "button" ); + image = inp.siblings( "img" ); + ok( button.length === 1, "Button - button present" ); + ok( image.length === 0, "Button - image absent" ); + equal( button.text(), "Popup", "Button - button text" ); + + TestHelpers.datepicker.onFocus( inp, function() { + ok( !dp.is( ":visible" ), "Button - not rendered on focus" ); button.click(); - ok(dp.is(":visible"), "Button - rendered on button click"); + ok( dp.is( ":visible" ), "Button - rendered on button click" ); button.click(); - ok(!dp.is(":visible"), "Button - hidden on second button click"); - inp.datepicker("hide").datepicker("destroy"); + ok( !dp.is( ":visible" ), "Button - hidden on second button click" ); + inp.datepicker( "hide" ).datepicker( "destroy" ); step3(); }); } function step3() { - // On image button - inp = TestHelpers.datepicker.init("#inp", {showOn: "button", buttonImageOnly: true, - buttonImage: "images/calendar.gif", buttonText: "Cal"}); - ok(!dp.is(":visible"), "Image button - initially hidden"); - button = inp.siblings("button"); - ok(button.length === 0, "Image button - button absent"); - image = inp.siblings("img"); - ok(image.length === 1, "Image button - image present"); - equal(image.attr("src"), "images/calendar.gif", "Image button - image source"); - equal(image.attr("title"), "Cal", "Image button - image text"); - inp[0].focus(); - setTimeout(function() { - ok(!dp.is(":visible"), "Image button - not rendered on focus"); + var inp = TestHelpers.datepicker.initNewInput({ + showOn: "button", + buttonImageOnly: true, + buttonImage: "images/calendar.gif", + buttonText: "Cal" + }), + dp = $( "#ui-datepicker-div" ); + + ok( !dp.is( ":visible" ), "Image button - initially hidden" ); + button = inp.siblings( "button" ); + ok( button.length === 0, "Image button - button absent" ); + image = inp.siblings( "img" ); + ok( image.length === 1, "Image button - image present" ); + equal( image.attr( "src" ), "images/calendar.gif", "Image button - image source" ); + equal( image.attr( "title" ), "Cal", "Image button - image text" ); + + TestHelpers.datepicker.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"); + ok( dp.is( ":visible" ), "Image button - rendered on image click" ); image.click(); - ok(!dp.is(":visible"), "Image button - hidden on second image click"); - inp.datepicker("hide").datepicker("destroy"); + ok( !dp.is( ":visible" ), "Image button - hidden on second image click" ); + inp.datepicker( "hide" ).datepicker( "destroy" ); step4(); }); } function step4() { - // On both - inp = TestHelpers.datepicker.init("#inp", {showOn: "both", buttonImage: "images/calendar.gif"}); - ok(!dp.is(":visible"), "Both - initially hidden"); - button = inp.siblings("button"); - ok(button.length === 1, "Both - button present"); - image = inp.siblings("img"); - ok(image.length === 0, "Both - image absent"); - image = button.children("img"); - ok(image.length === 1, "Both - button image present"); - inp[0].blur(); - setTimeout(function() { - inp[0].focus(); - setTimeout(function() { - ok(dp.is(":visible"), "Both - rendered on focus"); - body.simulate("mousedown", {}); - ok(!dp.is(":visible"), "Both - hidden on external click"); + var inp = TestHelpers.datepicker.initNewInput({ + showOn: "both", + buttonImage: "images/calendar.gif" + }), + dp = $( "#ui-datepicker-div" ); + + ok( !dp.is( ":visible" ), "Both - initially hidden" ); + button = inp.siblings( "button" ); + ok( button.length === 1, "Both - button present" ); + image = inp.siblings( "img" ); + ok( image.length === 0, "Both - image absent" ); + image = button.children( "img" ); + ok( image.length === 1, "Both - button image present" ); + + // TODO: occasionally this test flakily fails to focus in IE8 in browserstack + if ( !isOldIE ) { + TestHelpers.datepicker.onFocus( inp, function() { + ok( dp.is( ":visible" ), "Both - rendered on focus" ); + body.simulate( "mousedown", {} ); + ok( !dp.is( ":visible" ), "Both - hidden on external click" ); button.click(); - ok(dp.is(":visible"), "Both - rendered on button click"); + ok( dp.is( ":visible" ), "Both - rendered on button click" ); button.click(); - ok(!dp.is(":visible"), "Both - hidden on second button click"); - inp.datepicker("hide").datepicker("destroy"); + ok( !dp.is( ":visible" ), "Both - hidden on second button click" ); + inp.datepicker( "hide" ).datepicker( "destroy" ); start(); }); - }); + } else { + start(); + } } - step1(); + step0(); }); test("otherMonths", function() { @@ -1046,44 +1067,47 @@ test("formatDate", function() { "Format date 'jour' d 'de' MM (''DD''), yy with settings"); }); -test("Ticket 6827: formatDate day of year calculation is wrong during day lights savings time", function(){ - expect( 1 ); - var time = $.datepicker.formatDate("oo", new Date("2010/03/30 12:00:00 CDT")); - equal(time, "089"); -}); +// TODO: Fix this test so it isn't mysteriously flaky in Browserstack on certain OS/Browser combos +// test("Ticket 6827: formatDate day of year calculation is wrong during day lights savings time", function(){ +// expect( 1 ); +// var time = $.datepicker.formatDate("oo", new Date("2010/03/30 12:00:00 CDT")); +// equal(time, "089"); +// }); -test("Ticket 7602: Stop datepicker from appearing with beforeShow event handler", function(){ +test( "Ticket 7602: Stop datepicker from appearing with beforeShow event handler", function() { expect( 3 ); - var inp = TestHelpers.datepicker.init("#inp",{ - beforeShow: function(){ - return false; - } - }), - dp = $("#ui-datepicker-div"); - inp.datepicker("show"); - equal(dp.css("display"), "none","beforeShow returns false"); - inp.datepicker("destroy"); - inp = TestHelpers.datepicker.init("#inp",{ - beforeShow: function(){ + var inp, dp; + + inp = TestHelpers.datepicker.init( "#inp", { + beforeShow: function() { } }); - dp = $("#ui-datepicker-div"); - inp.datepicker("show"); - equal(dp.css("display"), "block","beforeShow returns nothing"); - inp.datepicker("hide"); - inp.datepicker("destroy"); + dp = $( "#ui-datepicker-div" ); + inp.datepicker( "show" ); + equal( dp.css( "display" ), "block", "beforeShow returns nothing" ); + inp.datepicker( "hide" ).datepicker( "destroy" ); - inp = TestHelpers.datepicker.init("#inp",{ - beforeShow: function(){ + inp = TestHelpers.datepicker.init( "#inp", { + beforeShow: function() { return true; } }); - dp = $("#ui-datepicker-div"); - inp.datepicker("show"); - equal(dp.css("display"), "block","beforeShow returns true"); - inp.datepicker("hide"); - inp.datepicker("destroy"); + dp = $( "#ui-datepicker-div" ); + inp.datepicker( "show" ); + equal( dp.css( "display" ), "block", "beforeShow returns true" ); + inp.datepicker( "hide" ); + inp.datepicker( "destroy" ); + + inp = TestHelpers.datepicker.init( "#inp", { + beforeShow: function() { + return false; + } + }); + dp = $( "#ui-datepicker-div" ); + inp.datepicker( "show" ); + equal( dp.css( "display" ), "none","beforeShow returns false" ); + inp.datepicker( "destroy" ); }); })(jQuery); diff --git a/tests/unit/datepicker/datepicker_test_helpers.js b/tests/unit/datepicker/datepicker_test_helpers.js index a9605edff..9cb63c9ec 100644 --- a/tests/unit/datepicker/datepicker_test_helpers.js +++ b/tests/unit/datepicker/datepicker_test_helpers.js @@ -14,9 +14,24 @@ TestHelpers.datepicker = { 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 || {})); + init: function( id, options ) { + $.datepicker.setDefaults( $.datepicker.regional[ "" ] ); + return $( id ).datepicker( $.extend( { showAnim: "" }, options || {} ) ); + }, + initNewInput: function( options ) { + var id = $( "<input>" ).appendTo( "#qunit-fixture" ); + return TestHelpers.datepicker.init( id, options ); + }, + onFocus: function( element, onFocus ) { + var fn = function( event ){ + if( !event.originalEvent ) { + return; + } + element.unbind( "focus", fn ); + onFocus(); + }; + + element.bind( "focus", fn )[ 0 ].focus(); }, PROP_NAME: "datepicker" };
\ No newline at end of file diff --git a/tests/unit/draggable/draggable_core.js b/tests/unit/draggable/draggable_core.js index f22d483a6..e7fcdfa87 100644 --- a/tests/unit/draggable/draggable_core.js +++ b/tests/unit/draggable/draggable_core.js @@ -75,9 +75,13 @@ test( "resizable handle with complex markup (#8756 / #8757)", function() { }); test( "#8269: Removing draggable element on drop", function() { - expect( 1 ); + expect( 2 ); - var element = $( "#draggable1" ).wrap( "<div id='wrapper' />" ).draggable(), + var element = $( "#draggable1" ).wrap( "<div id='wrapper' />" ).draggable({ + stop: function() { + ok( true, "stop still called despite element being removed from DOM on drop" ); + } + }), dropOffset = $( "#droppable" ).offset(); $( "#droppable" ).droppable({ @@ -87,10 +91,81 @@ test( "#8269: Removing draggable element on drop", function() { } }); + // Support: Opera 12.10, Safari 5.1, jQuery <1.8 + if ( TestHelpers.draggable.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 { + element.simulate( "drag", { + handle: "corner", + x: dropOffset.left, + y: dropOffset.top + }); + } +}); + +test( "#6258: not following mouse when scrolled and using overflow-y: scroll", function() { + expect( 2 ); + + var element = $( "#draggable1" ).draggable({ + stop: function( event, ui ) { + equal( ui.position.left, 1, "left position is correct despite overflow on HTML" ); + equal( ui.position.top, 1, "top position is correct despite overflow on HTML" ); + $( "html" ) + .css( "overflow-y", oldOverflowY ) + .css( "overflow-x", oldOverflowX ) + .scrollTop( 0 ) + .scrollLeft( 0 ); + } + }), + contentToForceScroll = $( "<div>" ).css({ + height: "10000px", + width: "10000px" + }), + oldOverflowY = $( "html" ).css( "overflow-y" ), + oldOverflowX = $( "html" ).css( "overflow-x" ); + + contentToForceScroll.appendTo( "#qunit-fixture" ); + $( "html" ) + .css( "overflow-y", "scroll" ) + .css( "overflow-x", "scroll" ) + .scrollTop( 300 ) + .scrollLeft( 300 ); + + element.simulate( "drag", { + dx: 1, + dy: 1, + moves: 1 + }); +}); + +test( "#5009: scroll not working with parent's position fixed", function() { + expect( 2 ); + + var startValue = 300, + element = $( "#draggable1" ).wrap( "<div id='wrapper' />" ).draggable({ + drag: function() { + startValue += 100; + $( document ).scrollTop( startValue ).scrollLeft( startValue ); + }, + stop: function( event, ui ) { + equal( ui.position.left, 10, "left position is correct when parent position is fixed" ); + equal( ui.position.top, 10, "top position is correct when parent position is fixed" ); + $( document ).scrollTop( 0 ).scrollLeft( 0 ); + } + }), + contentToForceScroll = $( "<div>" ).css({ + height: "20000px", + width: "20000px" + }); + + $( "#qunit-fixture" ).append( contentToForceScroll ); + $( "#wrapper" ).css( "position", "fixed" ); + element.simulate( "drag", { - handle: "corner", - x: dropOffset.left, - y: dropOffset.top + dx: 10, + dy: 10, + moves: 3 }); }); diff --git a/tests/unit/draggable/draggable_options.js b/tests/unit/draggable/draggable_options.js index 6a0cd593b..ef551003d 100644 --- a/tests/unit/draggable/draggable_options.js +++ b/tests/unit/draggable/draggable_options.js @@ -451,6 +451,38 @@ test( "{ cursor: 'move' }", function() { equal( after, before, "after drag: cursor restored" ); }); +test( "#6889: Cursor doesn't revert to pre-dragging state after revert action when original element is removed", function() { + function getCursor() { + return $( "body" ).css( "cursor" ); + } + + expect( 2 ); + + var element = $( "#draggable1" ).wrap( "<div id='wrapper' />" ).draggable({ + cursor: "move", + revert: true, + revertDuration: 0, + start: function() { + notEqual( getCursor(), expected, "start callback: cursor '" + expected + "'" ); + $( "#wrapper" ).remove(); + }, + stop: function() { + equal( getCursor(), expected, "after drag: cursor restored" ); + } + }), + expected = getCursor(); + + if ( TestHelpers.draggable.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 { + element.simulate( "drag", { + dx: -1, + dy: -1 + }); + } +}); + test( "cursor, default, switching after initialization", function() { expect( 3 ); @@ -1289,9 +1321,15 @@ test( "#8459: element can snap to an element that was removed during drag", func moves: 1 }); - // TODO: fix IE8 testswarm IFRAME positioning bug so closeEnough can be turned back to equal - closeEnough( element.offset().left, newX, 1, "doesn't snap to a removed element" ); - closeEnough( element.offset().top, newY, 1, "doesn't snap to a removed element" ); + // Support: Opera 12.10, Safari 5.1, jQuery <1.8 + if ( TestHelpers.draggable.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 { + // TODO: fix IE8 testswarm IFRAME positioning bug so closeEnough can be turned back to equal + closeEnough( element.offset().left, newX, 1, "doesn't snap to a removed element" ); + closeEnough( element.offset().top, newY, 1, "doesn't snap to a removed element" ); + } }); test( "#8165: Snapping large rectangles to small rectangles doesn't snap properly", function() { diff --git a/tests/unit/draggable/draggable_test_helpers.js b/tests/unit/draggable/draggable_test_helpers.js index 44e37c559..b36505556 100644 --- a/tests/unit/draggable/draggable_test_helpers.js +++ b/tests/unit/draggable/draggable_test_helpers.js @@ -1,7 +1,12 @@ TestHelpers.draggable = { - // todo: remove the unreliable offset hacks + // TODO: remove the unreliable offset hacks unreliableOffset: $.ui.ie && ( !document.documentMode || document.documentMode < 8 ) ? 2 : 0, - testDrag: function(el, handle, dx, dy, expectedDX, expectedDY, msg) { + // Support: Opera 12.10, Safari 5.1, jQuery <1.8 + unreliableContains: (function(){ + var element = $( "<div>" ); + return $.contains( element[ 0 ].ownerDocument, element[ 0 ] ); + })(), + testDrag: function( el, handle, dx, dy, expectedDX, expectedDY, msg ) { var offsetAfter, actual, expected, offsetBefore = el.offset(); @@ -15,64 +20,60 @@ TestHelpers.draggable = { expected = { left: offsetBefore.left + expectedDX, top: offsetBefore.top + expectedDY }; msg = msg ? msg + "." : ""; - deepEqual(actual, expected, "dragged[" + dx + ", " + dy + "] " + msg); + deepEqual( actual, expected, "dragged[" + dx + ", " + dy + "] " + msg ); }, - shouldMove: function(el, why) { - TestHelpers.draggable.testDrag(el, el, 50, 50, 50, 50, why); + shouldMove: function( el, why ) { + TestHelpers.draggable.testDrag( el, el, 50, 50, 50, 50, why ); }, - shouldNotMove: function(el, why) { - TestHelpers.draggable.testDrag(el, el, 50, 50, 0, 0, why); + shouldNotMove: function( el, why ) { + TestHelpers.draggable.testDrag( el, el, 50, 50, 0, 0, why ); }, - testScroll: function(el, position ) { - var oldPosition = $("#main").css("position"); - $("#main").css("position", position); - TestHelpers.draggable.shouldMove(el, position+" parent"); - $("#main").css("position", oldPosition); + testScroll: function( el, position ) { + var oldPosition = $( "#main" ).css( "position" ); + $( "#main" ).css( "position", position); + TestHelpers.draggable.shouldMove( el, position + " parent" ); + $( "#main" ).css( "position", oldPosition ); }, restoreScroll: function( what ) { if( what ) { - $(document).scrollTop(0); $(document).scrollLeft(0); + $( document ).scrollTop( 0 ).scrollLeft( 0 ); } else { - $("#main").scrollTop(0); $("#main").scrollLeft(0); + $( "#main" ).scrollTop( 0 ).scrollLeft( 0 ); } }, setScroll: function( what ) { - if(what) { - // todo: currently, the draggable interaction doesn't properly account for scrolled pages, + if( what ) { + // TODO: currently, the draggable interaction doesn't properly account for scrolled pages, // uncomment the line below to make the tests fail that should when the page is scrolled - // $(document).scrollTop(100); $(document).scrollLeft(100); + // $( document ).scrollTop( 100 ).scrollLeft( 100 ); } else { - $("#main").scrollTop(100); $("#main").scrollLeft(100); + $( "#main" ).scrollTop( 100 ).scrollLeft( 100 ); } }, - border: function(el, side) { - return parseInt(el.css("border-" + side + "-width"), 10) || 0; + 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; + 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") ); + el.data( "last_dragged_cursor", $( "body" ).css( "cursor" ) ); }); }, trackAppendedParent : function( el ) { - - // appendTo ignored without being clone + // TODO: appendTo is currently ignored if helper is original (see #7044) el.draggable( "option", "helper", "clone" ); + // Get what parent is at time of drag el.bind( "drag", function(e,ui) { - // Get what parent is at time of drag - el.data( "last_dragged_parent", ui.helper.parent()[0] ); + el.data( "last_dragged_parent", ui.helper.parent()[ 0 ] ); }); - } };
\ No newline at end of file |