Skip to content
Permalink
Browse files

Dialog: Fixed #3638: Added closeText option (default 'close').

  • Loading branch information
scottgonzalez committed Dec 11, 2008
1 parent 06ed069 commit 9eda8e4cb9ed2498a8e894474d806d1fe50a8895
Showing with 30 additions and 1 deletion.
  1. +25 −0 tests/dialog.js
  2. +5 −1 ui/ui.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);

@@ -63,7 +63,7 @@ $.widget("ui.dialog", {
.appendTo(uiDialogTitlebar),

uiDialogTitlebarCloseText = (this.uiDialogTitlebarCloseText = $('<span/>'))
.html('X')
.text(options.closeText)
.appendTo(uiDialogTitlebarClose),

title = options.title || '&nbsp;',
@@ -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,

0 comments on commit 9eda8e4

Please sign in to comment.
You can’t perform that action at this time.