79ee6f0
click here to add a description
click here to add a homepage
The official jQuery user interface library. — Read more
http://jqueryui.com/
This URL has Read+Write access
Dialog: When using the title attribute, update the title option. Fixes #5877 - Dialog: when using the title attribute, the title option should be updated.
@@ -369,7 +369,7 @@ test("stack", function() {
});
test("title", function() {
- expect(5);
+ expect(9);
function titleText() {
return dlg().find(".ui-dialog-title").html();
@@ -377,18 +377,22 @@ test("title", function() {
el = $('<div></div>').dialog();
equals(titleText(), " ", "[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 = $('<div></div>').dialog({ title: 'foo' });
equals(titleText(), "foo", "title in init options");
+ equals(el.dialog("option", "title"), "foo", "opiton set from options hash");
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 = $('<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 || ' ',
+ title = options.title || ' ',
titleId = $.ui.dialog.getTitleId(self.element),
uiDialog = (self.uiDialog = $('<div></div>'))
79ee6f079ee6f0