Skip to content
Permalink
Browse files

Dialog: When using the title attribute, update the title option. Fixe…

…s #5877 - Dialog: when using the title attribute, the title option should be updated.
  • Loading branch information...
scottgonzalez committed Aug 27, 2010
1 parent af9864d commit 79ee6f0d7b94b71d89f30019e66a1746696d5608
Showing with 7 additions and 2 deletions.
  1. +5 −1 tests/unit/dialog/dialog_options.js
  2. +2 −1 ui/jquery.ui.dialog.js
@@ -369,26 +369,30 @@ test("stack", function() {
});

test("title", function() {
expect(5);
expect(9);

function titleText() {
return dlg().find(".ui-dialog-title").html();
}

el = $('<div></div>').dialog();
equals(titleText(), "&nbsp;", "[default]");
equals(el.dialog("option", "title"), "", "option not changed");
el.remove();

el = $('<div title="foo"/>').dialog();
equals(titleText(), "foo", "title in element attribute");
equals(el.dialog("option", "title"), "foo", "option updated from attribute");
el.remove();

el = $('<div></div>').dialog({ title: 'foo' });
equals(titleText(), "foo", "title in init options");
equals(el.dialog("option", "title"), "foo", "opiton set from options hash");
el.remove();

el = $('<div title="foo"/>').dialog({ title: 'bar' });
equals(titleText(), "bar", "title in init options should override title in element attribute");
equals(el.dialog("option", "title"), "bar", "opiton set from options hash");
el.remove();

el = $('<div></div>').dialog().dialog('option', 'title', 'foo');
@@ -67,10 +67,11 @@ $.widget("ui.dialog", {
this.originalTitle = "";
}

this.options.title = this.options.title || this.originalTitle;
var self = this,
options = self.options,

title = options.title || self.originalTitle || '&#160;',
title = options.title || '&#160;',
titleId = $.ui.dialog.getTitleId(self.element),

uiDialog = (self.uiDialog = $('<div></div>'))

0 comments on commit 79ee6f0

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