diff --git a/AUTHORS.txt b/AUTHORS.txt index a53bc9dc2d..1da44ef23c 100644 --- a/AUTHORS.txt +++ b/AUTHORS.txt @@ -1,4 +1,4 @@ -Authors ordered by first contribution +Authors ordered by first contribution A list of current team members is available at http://jqueryui.com/about Paul Bakaus @@ -208,3 +208,19 @@ Sindre Sorhus Bernhard Sirlinger Jared A. Scheel Rafael Xavier de Souza +John Chen +Dale Kocian +Mike Sherov +Andrew Couch +Marc-Andre Lafortune +Nate Eagle +David Souther +Mathias Stenbom +Avinash R +Sergey Kartashov +Ethan Romba +Cory Gackenheimer +Juan Pablo Kaniefsky +Roman Salnikov +Anika Henke +Samuel Bovée diff --git a/build/release/release.js b/build/release/release.js index 0e41702e97..4efa1d2b78 100644 --- a/build/release/release.js +++ b/build/release/release.js @@ -262,8 +262,9 @@ function gatherContributors() { function updateTrac() { echo( newVersion.cyan + " was tagged at " + tagTime.cyan + "." ); - echo( "Close the " + newVersion.cyan + " Milestone with the above date and time." ); - echo( "Create the " + newVersion.cyan + " Version with the above date and time." ); + echo( "Close the " + newVersion.cyan + " Milestone." ); + echo( "Create the " + newVersion.cyan + " Version." ); + echo( "When Trac asks for date and time, match the above. Should only change minutes and seconds." ); echo( "Create a Milestone for the next minor release." ); } @@ -342,9 +343,7 @@ function bootstrap( fn ) { fs.mkdirSync( baseDir ); console.log( "Installing dependencies..." ); - require( "child_process" ).exec( "npm install shelljs colors", { - cwd: baseDir - }, function( error ) { + require( "child_process" ).exec( "npm install shelljs colors", function( error ) { if ( error ) { console.log( error ); return process.exit( 1 ); diff --git a/build/tasks/testswarm.js b/build/tasks/testswarm.js index aa2686685f..37eb552810 100644 --- a/build/tasks/testswarm.js +++ b/build/tasks/testswarm.js @@ -15,6 +15,7 @@ var versions = { "Core": "core/core.html", "Datepicker": "datepicker/datepicker.html", "Dialog": "dialog/dialog.html", + "Dialog_deprecated": "dialog/dialog_deprecated.html", "Draggable": "draggable/draggable.html", "Droppable": "droppable/droppable.html", "Effects": "effects/effects.html", diff --git a/demos/autocomplete/combobox.html b/demos/autocomplete/combobox.html index 9fd5d4050d..6229d47b21 100644 --- a/demos/autocomplete/combobox.html +++ b/demos/autocomplete/combobox.html @@ -24,7 +24,7 @@ bottom: 0; margin-left: -1px; padding: 0; - /* adjust styles for IE 6/7 */ + /* support: IE7 */ *height: 1.7em; *top: 0.1em; } @@ -46,7 +46,7 @@ .addClass( "ui-combobox" ) .insertAfter( select ); - function removeIfInvalid(element) { + function removeIfInvalid( element ) { var value = $( element ).val(), matcher = new RegExp( "^" + $.ui.autocomplete.escapeRegex( value ) + "$", "i" ), valid = false; @@ -56,6 +56,7 @@ return false; } }); + if ( !valid ) { // remove invalid value, as it didn't match anything $( element ) @@ -66,8 +67,7 @@ setTimeout(function() { input.tooltip( "close" ).attr( "title", "" ); }, 2500 ); - input.data( "autocomplete" ).term = ""; - return false; + input.data( "ui-autocomplete" ).term = ""; } } @@ -103,13 +103,14 @@ }); }, change: function( event, ui ) { - if ( !ui.item ) - return removeIfInvalid( this ); + if ( !ui.item ) { + removeIfInvalid( this ); + } } }) .addClass( "ui-widget ui-widget-content ui-corner-left" ); - input.data( "autocomplete" )._renderItem = function( ul, item ) { + input.data( "ui-autocomplete" )._renderItem = function( ul, item ) { return $( "
  • " ) .append( "" + item.label + "" ) .appendTo( ul ); @@ -144,19 +145,14 @@ input.focus(); }); - input - .tooltip({ - position: { - of: this.button - }, - tooltipClass: "ui-state-highlight" - }); + input.tooltip({ + tooltipClass: "ui-state-highlight" + }); }, - destroy: function() { + _destroy: function() { this.wrapper.remove(); this.element.show(); - $.Widget.prototype.destroy.call( this ); } }); })( jQuery ); diff --git a/demos/button/toolbar.html b/demos/button/toolbar.html index eb1d2c3eae..5be3668f62 100644 --- a/demos/button/toolbar.html +++ b/demos/button/toolbar.html @@ -11,7 +11,12 @@ + diff --git a/demos/dialog/default.html b/demos/dialog/default.html index 214f41d0d0..777921e487 100644 --- a/demos/dialog/default.html +++ b/demos/dialog/default.html @@ -11,6 +11,7 @@ + + + @@ -86,10 +87,10 @@ if ( bValid ) { $( "#users tbody" ).append( "" + - "" + name.val() + "" + - "" + email.val() + "" + + "" + name.val() + "" + + "" + email.val() + "" + "" + password.val() + "" + - "" ); + "" ); $( this ).dialog( "close" ); } }, diff --git a/demos/dialog/modal-message.html b/demos/dialog/modal-message.html index 60b7c3e151..19fc0e829b 100644 --- a/demos/dialog/modal-message.html +++ b/demos/dialog/modal-message.html @@ -12,6 +12,7 @@ + + + @@ -19,6 +22,7 @@ "ui/jquery.ui.mouse.js", "ui/jquery.ui.draggable.js", "ui/jquery.ui.resizable.js", + "ui/jquery.ui.button.js", "ui/jquery.ui.dialog.js" ] }); @@ -44,6 +48,17 @@
    +
    +
    + Please share some personal information + + +
    +
    +

    Some more (optional) information

    + +
    +
    diff --git a/tests/unit/dialog/dialog_common.js b/tests/unit/dialog/dialog_common.js index 2c0e86b46c..47fff10135 100644 --- a/tests/unit/dialog/dialog_common.js +++ b/tests/unit/dialog/dialog_common.js @@ -23,10 +23,20 @@ TestHelpers.commonWidgetTests( "dialog", { }, resizable: true, show: null, - title: '', + title: null, width: 300, // callbacks - create: null + beforeClose: null, + close: null, + create: null, + drag: null, + dragStart: null, + dragStop: null, + focus: null, + open: null, + resize: null, + resizeStart: null, + resizeStop: null } }); diff --git a/tests/unit/dialog/dialog_core.js b/tests/unit/dialog/dialog_core.js index b36f6204fc..9c0e80825f 100644 --- a/tests/unit/dialog/dialog_core.js +++ b/tests/unit/dialog/dialog_core.js @@ -17,22 +17,18 @@ test("title id", function() { el.remove(); }); -test("ARIA", function() { - expect(4); +test( "ARIA", function() { + expect( 4 ); - var labelledBy, - el = $('
    ').dialog(); - - equal(el.dialog('widget').attr('role'), 'dialog', 'dialog role'); - - labelledBy = el.dialog('widget').attr('aria-labelledby'); - ok(labelledBy.length > 0, 'has aria-labelledby attribute'); - equal(el.dialog('widget').find('.ui-dialog-title').attr('id'), labelledBy, - 'proper aria-labelledby attribute'); - - equal(el.dialog('widget').find('.ui-dialog-titlebar-close').attr('role'), 'button', - 'close link role'); + var el = $( "
    " ).dialog(), + wrapper = el.dialog( "widget" ); + equal( wrapper.attr( "role" ), "dialog", "dialog role" ); + equal( wrapper.attr( "aria-labelledby" ), wrapper.find( ".ui-dialog-title" ).attr( "id" ) ); + equal( wrapper.attr( "aria-describedby" ), el.attr( "id" ), "aria-describedby added" ); + el.remove(); + el = $( '

    descriotion

    ' ).dialog(); + strictEqual( el.dialog( "widget" ).attr( "aria-describedby" ), undefined, "no aria-describedby added, as already present in markup" ); el.remove(); }); @@ -42,4 +38,59 @@ test("widget method", function() { deepEqual(dialog.parent()[0], dialog.dialog("widget")[0]); }); +test( "focus tabbable", function() { + expect( 5 ); + var el, + options = { + buttons: [{ + text: "Ok", + click: $.noop + }] + }; + + el = $( "
    " ).dialog( options ); + equal( document.activeElement, el.find( "input" )[ 1 ], "1. first element inside the dialog matching [autofocus]" ); + el.remove(); + + // IE8 fails to focus the input, ends up being the activeElement + // so wait for that stupid browser + stop(); + setTimeout(function() { + el = $( "
    " ).dialog( options ); + equal( document.activeElement, el.find( "input" )[ 0 ], "2. tabbable element inside the content element" ); + el.remove(); + + el = $( "
    text
    " ).dialog( options ); + equal( document.activeElement, el.dialog( "widget" ).find( ".ui-dialog-buttonpane button" )[ 0 ], "3. tabbable element inside the buttonpane" ); + el.remove(); + + el = $( "
    text
    " ).dialog(); + equal( document.activeElement, el.dialog( "widget" ).find( ".ui-dialog-titlebar .ui-dialog-titlebar-close" )[ 0 ], "4. the close button" ); + el.remove(); + + el = $( "
    text
    " ).dialog({ + autoOpen: false + }); + el.dialog( "widget" ).find( ".ui-dialog-titlebar-close" ).hide(); + el.dialog( "open" ); + equal( document.activeElement, el.parent()[ 0 ], "5. the dialog itself" ); + el.remove(); + + start(); + }, 13); +}); + +// #7960 +test( "resizable handles below modal overlays", function() { + expect( 1 ); + + var resizable = $( "
    " ).resizable(), + dialog = $( "
    " ).dialog({ modal: true }), + resizableZindex = parseInt( resizable.find( ".ui-resizable-handle" ).css( "zIndex" ), 10 ), + overlayZindex = parseInt( $( ".ui-widget-overlay" ).css( "zIndex" ), 10 ); + + ok( resizableZindex < overlayZindex, "Resizable handles have lower z-index than modal overlay" ); + dialog.dialog( "destroy" ); +}); + })(jQuery); diff --git a/tests/unit/dialog/dialog_deprecated.html b/tests/unit/dialog/dialog_deprecated.html new file mode 100644 index 0000000000..2a876ac735 --- /dev/null +++ b/tests/unit/dialog/dialog_deprecated.html @@ -0,0 +1,62 @@ + + + + + jQuery UI Dialog Test Suite + + + + + + + + + + + + + + + + + + + + + +

    jQuery UI Dialog Test Suite

    +

    +
    +

    +
      +
      +
      +
      +
      +
      + Please share some personal information + + +
      +
      +

      Some more (optional) information

      + +
      +
      +
      + + diff --git a/tests/unit/dialog/dialog_deprecated.js b/tests/unit/dialog/dialog_deprecated.js new file mode 100644 index 0000000000..fcbd22faa6 --- /dev/null +++ b/tests/unit/dialog/dialog_deprecated.js @@ -0,0 +1,53 @@ +module("dialog (deprecated): position option with string and array"); + +if ( !$.ui.ie ) { + test("position, right bottom on window w/array", function() { + expect( 2 ); + var el = $('
      ').dialog({ position: ["right", "bottom"] }), + dialog = el.dialog('widget'), + offset = dialog.offset(); + closeEnough(offset.left, $(window).width() - dialog.outerWidth() + $(window).scrollLeft(), 1); + closeEnough(offset.top, $(window).height() - dialog.outerHeight() + $(window).scrollTop(), 1); + el.remove(); + }); + + test("position, right bottom on window", function() { + expect( 2 ); + var el = $('
      ').dialog({ position: "right bottom" }), + dialog = el.dialog('widget'), + offset = dialog.offset(); + closeEnough(offset.left, $(window).width() - dialog.outerWidth() + $(window).scrollLeft(), 1); + closeEnough(offset.top, $(window).height() - dialog.outerHeight() + $(window).scrollTop(), 1); + el.remove(); + }); +} + +test("position, offset from top left w/array", function() { + expect( 2 ); + var el = $('
      ').dialog({ position: [10, 10] }), + dialog = el.dialog('widget'), + offset = dialog.offset(); + closeEnough(offset.left, 10 + $(window).scrollLeft(), 1); + closeEnough(offset.top, 10 + $(window).scrollTop(), 1); + el.remove(); +}); + +test("position, top on window", function() { + expect( 2 ); + var el = $('
      ').dialog({ position: "top" }), + dialog = el.dialog('widget'), + offset = dialog.offset(); + closeEnough(offset.left, Math.round($(window).width() / 2 - dialog.outerWidth() / 2) + $(window).scrollLeft(), 1); + closeEnough(offset.top, $(window).scrollTop(), 1); + el.remove(); +}); + +test("position, left on window", function() { + expect( 2 ); + var el = $('
      ').dialog({ position: "left" }), + dialog = el.dialog('widget'), + offset = dialog.offset(); + closeEnough(offset.left, 0, 1); + closeEnough(offset.top, Math.round($(window).height() / 2 - dialog.outerHeight() / 2) + $(window).scrollTop(), 1); + el.remove(); +}); diff --git a/tests/unit/dialog/dialog_events.js b/tests/unit/dialog/dialog_events.js index ee7a8bcb3e..cbeced0f88 100644 --- a/tests/unit/dialog/dialog_events.js +++ b/tests/unit/dialog/dialog_events.js @@ -39,6 +39,51 @@ test("open", function() { el.remove(); }); + +test( "focus", function() { + expect( 5 ); + var el, other; + el = $("#dialog1").dialog({ + autoOpen: false + }); + other = $("#dialog2").dialog({ + autoOpen: false + }); + + el.one( "dialogopen", function() { + ok( true, "open, just once" ); + }); + el.one( "dialogfocus", function() { + ok( true, "focus on open" ); + }); + other.dialog( "open" ); + + el.one( "dialogfocus", function() { + ok( true, "when opening and already open and wasn't on top" ); + }); + other.dialog( "open" ); + el.dialog( "open" ); + + el.one( "dialogfocus", function() { + ok( true, "when calling moveToTop and wasn't on top" ); + }); + other.dialog( "moveToTop" ); + el.dialog( "moveToTop" ); + + el.bind( "dialogfocus", function() { + ok( true, "when mousedown anywhere on the dialog and it wasn't on top" ); + }); + other.dialog( "moveToTop" ); + el.trigger( "mousedown" ); + + // triggers just once when already on top + el.dialog( "open" ); + el.dialog( "moveToTop" ); + el.trigger( "mousedown" ); + + el.add( other ).remove(); +}); + test("dragStart", function() { expect(9); @@ -280,4 +325,20 @@ test("beforeClose", function() { el.remove(); }); +// #8789 and #8838 +asyncTest("ensure dialog's container doesn't scroll on resize and focus", function() { + expect(2); + + var el = $('#dialog1').dialog(), + initialScroll = $(window).scrollTop(); + el.dialog('option', 'height', 600); + equal($(window).scrollTop(), initialScroll, "scroll hasn't moved after height change"); + setTimeout( function(){ + $(".ui-dialog-titlebar-close").simulate('mousedown'); + equal($(window).scrollTop(), initialScroll, "scroll hasn't moved after focus moved to dialog"); + el.dialog('destroy'); + start(); + }, 500); +}); + })(jQuery); diff --git a/tests/unit/dialog/dialog_methods.js b/tests/unit/dialog/dialog_methods.js index 7048a76a93..e5275c7a4f 100644 --- a/tests/unit/dialog/dialog_methods.js +++ b/tests/unit/dialog/dialog_methods.js @@ -34,48 +34,25 @@ test("init", function() { }); test("destroy", function() { - expect( 4 ); - - $("
      ").appendTo('body').dialog().dialog("destroy").remove(); - ok(true, '.dialog("destroy") called on element'); - - $([]).dialog().dialog("destroy").remove(); - ok(true, '.dialog("destroy") called on empty collection'); - - $('
      ').dialog().dialog("destroy").remove(); - ok(true, '.dialog("destroy") called on disconnected DOMElement'); - - var expected = $('
      ').dialog(), - actual = expected.dialog('destroy'); - equal(actual, expected, 'destroy is chainable'); + expect( 6 ); + domEqual( "#dialog1", function() { + var dialog = $( "#dialog1" ).dialog().dialog( "destroy" ); + equal( dialog.parent()[ 0 ], $( "#qunit-fixture" )[ 0 ] ); + equal( dialog.index(), 0 ); + }); + domEqual( "#form-dialog", function() { + var dialog = $( "#form-dialog" ).dialog().dialog( "destroy" ); + equal( dialog.parent()[ 0 ], $( "#qunit-fixture" )[ 0 ] ); + equal( dialog.index(), 2 ); + }); }); -test("enable", function() { - expect( 3 ); - - var el, - expected = $('
      ').dialog(), - actual = expected.dialog('enable'); - equal(actual, expected, 'enable is chainable'); - - el = $('
      ').dialog({ disabled: true }); - el.dialog('enable'); - equal(el.dialog('option', 'disabled'), false, 'enable method sets disabled option to false'); - ok(!el.dialog('widget').hasClass('ui-dialog-disabled'), 'enable method removes ui-dialog-disabled class from ui-dialog element'); -}); - -test("disable", function() { - expect( 3 ); - - var el, - expected = $('
      ').dialog(), - actual = expected.dialog('disable'); - equal(actual, expected, 'disable is chainable'); - - el = $('
      ').dialog({ disabled: false }); - el.dialog('disable'); - equal(el.dialog('option', 'disabled'), true, 'disable method sets disabled option to true'); - ok(el.dialog('widget').hasClass('ui-dialog-disabled'), 'disable method adds ui-dialog-disabled class to ui-dialog element'); +test( "enable/disable disabled", function() { + expect( 2 ); + var el = $( "
      " ).dialog(); + el.dialog( "disable" ); + equal(el.dialog( "option", "disabled" ), false, "disable method doesn't do anything" ); + ok( !el.dialog( "widget" ).hasClass( "ui-dialog-disabled" ), "disable method doesn't add ui-dialog-disabled class" ); }); test("close", function() { diff --git a/tests/unit/dialog/dialog_options.js b/tests/unit/dialog/dialog_options.js index 3312303189..f01a1a2a89 100644 --- a/tests/unit/dialog/dialog_options.js +++ b/tests/unit/dialog/dialog_options.js @@ -35,7 +35,7 @@ test("buttons", function() { }, el = $('
      ').dialog({ buttons: buttons }); - btn = $("button", el.dialog('widget')); + btn = el.dialog( "widget" ).find( ".ui-dialog-buttonpane button" ); equal(btn.length, 2, "number of buttons"); i = 0; @@ -61,7 +61,7 @@ test("buttons", function() { el.dialog("option", "buttons", newButtons); deepEqual(el.dialog("option", "buttons"), newButtons, '.dialog("option", "buttons", ...) setter'); - btn = $("button", el.dialog('widget')); + btn = el.dialog( "widget" ).find( ".ui-dialog-buttonpane button" ); equal(btn.length, 1, "number of buttons after setter"); btn.trigger('click'); @@ -72,7 +72,7 @@ test("buttons", function() { }); el.dialog("option", "buttons", null); - btn = $("button", el.dialog('widget')); + btn = el.dialog( "widget" ).find( ".ui-dialog-buttonpane button" ); equal(btn.length, 0, "all buttons have been removed"); equal(el.find(".ui-dialog-buttonset").length, 0, "buttonset has been removed"); equal(el.parent().hasClass('ui-dialog-buttons'), false, "dialog wrapper removes class about having buttons"); @@ -81,7 +81,7 @@ test("buttons", function() { }); test("buttons - advanced", function() { - expect(5); + expect( 7 ); var buttons, el = $("
      ").dialog({ @@ -92,16 +92,22 @@ test("buttons - advanced", function() { id: "my-button-id", click: function() { equal(this, el[0], "correct context"); - } + }, + icons: { + primary: "ui-icon-cancel" + }, + showText: false } ] }); - buttons = el.dialog('widget').find("button"); + buttons = el.dialog( "widget" ).find( ".ui-dialog-buttonpane button" ); equal(buttons.length, 1, "correct number of buttons"); equal(buttons.attr("id"), "my-button-id", "correct id"); equal(buttons.text(), "a button", "correct label"); ok(buttons.hasClass("additional-class"), "additional classes added"); + deepEqual( buttons.button("option", "icons"), { primary: "ui-icon-cancel", secondary: null } ); + equal( buttons.button( "option", "text" ), false ); buttons.click(); el.remove(); @@ -148,7 +154,7 @@ test("closeText", function() { }); test("dialogClass", function() { - expect(4); + expect( 6 ); var el = $('
      ').dialog(); equal(el.dialog('widget').is(".foo"), false, 'dialogClass not specified. foo class added'); @@ -156,6 +162,9 @@ test("dialogClass", function() { el = $('
      ').dialog({ dialogClass: "foo" }); equal(el.dialog('widget').is(".foo"), true, 'dialogClass in init. foo class added'); + el.dialog( "option", "dialogClass", "foobar" ); + equal( el.dialog('widget').is(".foo"), false, "dialogClass changed, previous one was removed" ); + equal( el.dialog('widget').is(".foobar"), true, "dialogClass changed, new one was added" ); el.remove(); el = $('
      ').dialog({ dialogClass: "foo bar" }); @@ -289,49 +298,8 @@ test("position, default center on window", function() { el.remove(); }); -test("position, top on window", function() { - expect( 2 ); - var el = $('
      ').dialog({ position: "top" }), - dialog = el.dialog('widget'), - offset = dialog.offset(); - closeEnough(offset.left, Math.round($(window).width() / 2 - dialog.outerWidth() / 2) + $(window).scrollLeft(), 1); - closeEnough(offset.top, $(window).scrollTop(), 1); - el.remove(); -}); - -test("position, left on window", function() { - expect( 2 ); - var el = $('
      ').dialog({ position: "left" }), - dialog = el.dialog('widget'), - offset = dialog.offset(); - closeEnough(offset.left, 0, 1); - closeEnough(offset.top, Math.round($(window).height() / 2 - dialog.outerHeight() / 2) + $(window).scrollTop(), 1); - el.remove(); -}); - // todo: figure out these fails in IE7 if ( !$.ui.ie ) { - - test("position, right bottom on window", function() { - expect( 2 ); - var el = $('
      ').dialog({ position: "right bottom" }), - dialog = el.dialog('widget'), - offset = dialog.offset(); - closeEnough(offset.left, $(window).width() - dialog.outerWidth() + $(window).scrollLeft(), 1); - closeEnough(offset.top, $(window).height() - dialog.outerHeight() + $(window).scrollTop(), 1); - el.remove(); - }); - - test("position, right bottom on window w/array", function() { - expect( 2 ); - var el = $('
      ').dialog({ position: ["right", "bottom"] }), - dialog = el.dialog('widget'), - offset = dialog.offset(); - closeEnough(offset.left, $(window).width() - dialog.outerWidth() + $(window).scrollLeft(), 1); - closeEnough(offset.top, $(window).height() - dialog.outerHeight() + $(window).scrollTop(), 1); - el.remove(); - }); - test("position, right bottom at right bottom via ui.position args", function() { expect( 2 ); var el = $('
      ').dialog({ @@ -347,19 +315,8 @@ if ( !$.ui.ie ) { closeEnough(offset.top, $(window).height() - dialog.outerHeight() + $(window).scrollTop(), 1); el.remove(); }); - } -test("position, offset from top left w/array", function() { - expect( 2 ); - var el = $('
      ').dialog({ position: [10, 10] }), - dialog = el.dialog('widget'), - offset = dialog.offset(); - closeEnough(offset.left, 10 + $(window).scrollLeft(), 1); - closeEnough(offset.top, 10 + $(window).scrollTop(), 1); - el.remove(); -}); - test("position, at another element", function() { expect( 4 ); var parent = $('
      ').css({ @@ -415,37 +372,45 @@ test("resizable", function() { el.remove(); }); -test("title", function() { - expect(9); +test( "title", function() { + expect( 11 ); function titleText() { - return el.dialog('widget').find(".ui-dialog-title").html(); + return el.dialog('widget').find( ".ui-dialog-title" ).html(); } - var el = $('
      ').dialog(); + var el = $( '
      ' ).dialog(); // some browsers return a non-breaking space and some return " " // so we generate a non-breaking space for comparison - equal(titleText(), $( " " ).html(), "[default]"); - equal(el.dialog("option", "title"), "", "option not changed"); + equal( titleText(), $( " " ).html(), "[default]" ); + equal( el.dialog( "option", "title" ), null, "option not changed" ); el.remove(); - el = $('
      ').dialog(); - equal(titleText(), "foo", "title in element attribute"); - equal(el.dialog("option", "title"), "foo", "option updated from attribute"); + el = $( '
      ' ).dialog(); + equal( titleText(), "foo", "title in element attribute" ); + equal( el.dialog( "option", "title"), "foo", "option updated from attribute" ); el.remove(); - el = $('
      ').dialog({ title: 'foo' }); - equal(titleText(), "foo", "title in init options"); - equal(el.dialog("option", "title"), "foo", "opiton set from options hash"); + el = $( '
      ' ).dialog({ title: 'foo' }); + equal( titleText(), "foo", "title in init options" ); + equal( el.dialog("option", "title"), "foo", "opiton set from options hash" ); el.remove(); - el = $('
      ').dialog({ title: 'bar' }); - equal(titleText(), "bar", "title in init options should override title in element attribute"); - equal(el.dialog("option", "title"), "bar", "opiton set from options hash"); + el = $( '
      ' ).dialog({ title: 'bar' }); + equal( titleText(), "bar", "title in init options should override title in element attribute" ); + equal( el.dialog("option", "title"), "bar", "opiton set from options hash" ); el.remove(); - el = $('
      ').dialog().dialog('option', 'title', 'foo'); - equal(titleText(), 'foo', 'title after init'); + el = $( '
      ' ).dialog().dialog( 'option', 'title', 'foo' ); + equal( titleText(), 'foo', 'title after init' ); + el.remove(); + + // make sure attroperties are properly ignored - #5742 - .attr() might return a DOMElement + el = $( '
      ' ).dialog(); + // some browsers return a non-breaking space and some return " " + // so we get the text to normalize to the actual non-breaking space + equal( titleText(), $( " " ).html(), "[default]" ); + equal( el.dialog( "option", "title" ), null, "option not changed" ); el.remove(); }); diff --git a/tests/unit/dialog/dialog_tickets.js b/tests/unit/dialog/dialog_tickets.js index 3055c5fc1a..655f1e4451 100644 --- a/tests/unit/dialog/dialog_tickets.js +++ b/tests/unit/dialog/dialog_tickets.js @@ -71,24 +71,24 @@ test("#5184: isOpen in dialogclose event is true", function() { }); test("#5531: dialog width should be at least minWidth on creation", function () { - expect( 4 ); - var el = $('
      ').dialog({ - width: 200, - minWidth: 300 - }); + expect( 4 ); + var el = $('
      ').dialog({ + width: 200, + minWidth: 300 + }); - equal(el.dialog('option', 'width'), 300, "width is minWidth"); - el.dialog('option', 'width', 200); - equal(el.dialog('option', 'width'), 300, "width unchanged when set to < minWidth"); - el.dialog('option', 'width', 320); - equal(el.dialog('option', 'width'), 320, "width changed if set to > minWidth"); - el.remove(); + equal(el.dialog('option', 'width'), 300, "width is minWidth"); + el.dialog('option', 'width', 200); + equal(el.dialog('option', 'width'), 300, "width unchanged when set to < minWidth"); + el.dialog('option', 'width', 320); + equal(el.dialog('option', 'width'), 320, "width changed if set to > minWidth"); + el.remove(); - el = $('
      ').dialog({ - minWidth: 300 - }); - ok(el.dialog('option', 'width') >= 300, "width is at least 300"); - el.remove(); + el = $('
      ').dialog({ + minWidth: 300 + }); + ok(el.dialog('option', 'width') >= 300, "width is at least 300"); + el.remove(); }); @@ -108,20 +108,21 @@ test("#6137: dialog('open') causes form elements to reset on IE7", function() { }); test("#6645: Missing element not found check in overlay", function(){ - expect(2); - var d1 = $('
      Dialog 1
      ').dialog({modal: true}), - d2 = $('
      Dialog 2
      ').dialog({modal: true, close: function(){ d2.remove(); }}); + expect(2); + var d1 = $('
      Dialog 1
      ').dialog({modal: true}), + d2 = $('
      Dialog 2
      ').dialog({modal: true, close: function(){ d2.remove(); }}); - equal($.ui.dialog.overlay.instances.length, 2, 'two overlays created'); - d2.dialog('close'); - equal($.ui.dialog.overlay.instances.length, 1, 'one overlay remains after closing the 2nd overlay'); - d1.add(d2).remove(); + equal($.ui.dialog.overlay.instances.length, 2, 'two overlays created'); + d2.dialog('close'); + equal($.ui.dialog.overlay.instances.length, 1, 'one overlay remains after closing the 2nd overlay'); + d1.add(d2).remove(); }); +// TODO merge this with the main destroy test test("#4980: Destroy should place element back in original DOM position", function(){ - expect( 2 ); - var container = $('
      '), - modal = container.find('#modal'); + expect( 2 ); + var container = $('
      '), + modal = container.find('#modal'); modal.dialog(); ok(!$.contains(container[0], modal[0]), 'dialog should move modal element to outside container element'); modal.dialog('destroy'); diff --git a/tests/unit/resizable/resizable_common.js b/tests/unit/resizable/resizable_common.js index 119f5bd0ed..2c64f3cb1f 100644 --- a/tests/unit/resizable/resizable_common.js +++ b/tests/unit/resizable/resizable_common.js @@ -19,7 +19,7 @@ TestHelpers.commonWidgetTests('resizable', { maxWidth: null, minHeight: 10, minWidth: 10, - zIndex: 1000, + zIndex: 90, // callbacks create: null diff --git a/tests/unit/tabs/tabs_options.js b/tests/unit/tabs/tabs_options.js index f6e89e84f8..c78c42b581 100644 --- a/tests/unit/tabs/tabs_options.js +++ b/tests/unit/tabs/tabs_options.js @@ -235,10 +235,18 @@ test( "{ heightStyle: 'content' }", function() { }); test( "{ heightStyle: 'fill' }", function() { - expect( 2 ); + expect( 4 ); $( "#tabs8Wrapper" ).height( 500 ); var element = $( "#tabs8" ).tabs({ heightStyle: "fill" }); equalHeight( element, 485 ); + element.tabs( "destroy" ); + + element = $( "#tabs8" ).css({ + "border": "1px solid black", + "padding": "1px 0" + }); + element.tabs({ heightStyle: "fill" }); + equalHeight( element, 481 ); }); test( "{ heightStyle: 'fill' } with sibling", function() { diff --git a/tests/unit/tooltip/tooltip_options.js b/tests/unit/tooltip/tooltip_options.js index f9da27fb74..01ac250408 100644 --- a/tests/unit/tooltip/tooltip_options.js +++ b/tests/unit/tooltip/tooltip_options.js @@ -16,6 +16,20 @@ test( "content: default", function() { deepEqual( $( "#" + element.data( "ui-tooltip-id" ) ).text(), "anchortitle" ); }); +test( "content: default; HTML escaping", function() { + expect( 2 ); + var scriptText = "", + element = $( "#tooltipped1" ); + + $.ui.tooltip.hacked = false; + element.attr( "title", scriptText ) + .tooltip() + .tooltip( "open" ); + equal( $.ui.tooltip.hacked, false, "script did not execute" ); + deepEqual( $( "#" + element.data( "ui-tooltip-id" ) ).text(), scriptText, + "correct tooltip text" ); +}); + test( "content: return string", function() { expect( 1 ); var element = $( "#tooltipped1" ).tooltip({ diff --git a/tests/visual/dialog/animated.html b/tests/visual/dialog/animated.html index d1f5acb104..07097fbfa9 100644 --- a/tests/visual/dialog/animated.html +++ b/tests/visual/dialog/animated.html @@ -11,6 +11,7 @@ + diff --git a/tests/visual/dialog/complex-dialogs.html b/tests/visual/dialog/complex-dialogs.html index 6399d8a4b0..5cd9271aef 100644 --- a/tests/visual/dialog/complex-dialogs.html +++ b/tests/visual/dialog/complex-dialogs.html @@ -11,6 +11,7 @@ + @@ -23,9 +24,27 @@ $(function() { var dialog = $( "#dialog" ).dialog({ modal: true, - height: 300, - width: 500 - }), + width: 500, + buttons: [ + { + click: $.noop, + icons: { + primary: "ui-icon-check" + }, + text: "Ok" + }, + { + click: function() { + $( this ).dialog( "close" ); + }, + icons: { + primary: "ui-icon-cancel" + }, + text: "Cancel", + showText: false + } + ] + }).dialog("option", "height", 600), datepickerDialog = $( "#dialog-datepicker" ).dialog({ autoOpen: false, @@ -62,6 +81,11 @@ ] }); + $( "#destroy-dialog" ).click(function() { + dialog.dialog( "destroy" ).show(); + $( this ).remove(); + }); + $( document ).tooltip(); }); @@ -71,18 +95,18 @@

      WHAT: A modal dialog opening another modal dialog (including a datepicker), opening a non-modal dialog (including an autocomplete with tooltip applied). A regular link on the page, outside of the dialogs.

      EXPECTED: As long as a modal dialog is open, focus stays within the dialogs. Both mouse and keyboard interactions are captured and restricted to the dialog. When the nested modal dialog is open, the first modal dialog can't be interacted with, until the nested dialog is closed. When the third dialog is open (not modal), switching between the two dialogs is possible, both can be interacted with.

      -Outside link

      This is the default dialog which is useful for displaying information. The dialog window can be moved, resized and closed with the 'x' icon.

      +

      Date:

      -

      +

      @@ -90,5 +114,7 @@
      +Outside link + diff --git a/tests/visual/dialog/form.html b/tests/visual/dialog/form.html index 867991911a..ed70ec69ba 100644 --- a/tests/visual/dialog/form.html +++ b/tests/visual/dialog/form.html @@ -11,6 +11,7 @@ + diff --git a/tests/visual/dialog/performance.html b/tests/visual/dialog/performance.html index 937b9464f0..8f63d6a69d 100644 --- a/tests/visual/dialog/performance.html +++ b/tests/visual/dialog/performance.html @@ -11,6 +11,7 @@ +