diff options
-rw-r--r-- | tests/dialog.js | 25 | ||||
-rw-r--r-- | ui/ui.dialog.js | 6 |
2 files changed, 30 insertions, 1 deletions
diff --git a/tests/dialog.js b/tests/dialog.js index 0c398105e..ddc32e1b8 100644 --- a/tests/dialog.js +++ b/tests/dialog.js @@ -10,6 +10,8 @@ var defaults = { autoOpen: true, autoResize: true, buttons: {}, + closeOnEscape: true, + closeText: 'close', disabled: false, dialogClass: undefined, draggable: true, @@ -326,6 +328,29 @@ test("buttons", function() { el.remove(); }); +test("closeOnEscape", function() { + ok(false, 'missing test'); +}); + +test("closeText", function() { + expect(3); + + el = $('<div></div>').dialog(); + equals(dlg().find('.ui-dialog-titlebar-close span').text(), 'close', + 'default close text'); + el.remove(); + + el = $('<div></div>').dialog({ closeText: "foo" }); + equals(dlg().find('.ui-dialog-titlebar-close span').text(), 'foo', + 'closeText on init'); + el.remove(); + + el = $('<div></div>').dialog().dialog('option', 'closeText', 'bar'); + equals(dlg().find('.ui-dialog-titlebar-close span').text(), 'bar', + 'closeText via option method'); + el.remove(); +}); + test("dialogClass", function() { expect(4); diff --git a/ui/ui.dialog.js b/ui/ui.dialog.js index ae8f8da5b..2e6b8af3c 100644 --- a/ui/ui.dialog.js +++ b/ui/ui.dialog.js @@ -63,7 +63,7 @@ $.widget("ui.dialog", { .appendTo(uiDialogTitlebar), uiDialogTitlebarCloseText = (this.uiDialogTitlebarCloseText = $('<span/>')) - .html('X') + .text(options.closeText) .appendTo(uiDialogTitlebarClose), title = options.title || ' ', @@ -359,6 +359,9 @@ $.widget("ui.dialog", { case "buttons": this._createButtons(value); break; + case "closeText": + this.uiDialogTitlebarCloseText.text(value); + break; case "draggable": (value ? this._makeDraggable() @@ -418,6 +421,7 @@ $.extend($.ui.dialog, { bgiframe: false, buttons: {}, closeOnEscape: true, + closeText: 'close', draggable: true, height: 200, minHeight: 100, |