]> source.dussan.org Git - jquery-ui.git/commitdiff
Dialog: When using the title attribute, update the title option. Fixes #5877 - Dialog...
authorScott González <scott.gonzalez@gmail.com>
Fri, 27 Aug 2010 22:02:11 +0000 (18:02 -0400)
committerScott González <scott.gonzalez@gmail.com>
Fri, 27 Aug 2010 22:02:11 +0000 (18:02 -0400)
tests/unit/dialog/dialog_options.js
ui/jquery.ui.dialog.js

index fb6a28e12f8d1c8b2c2f6ff4ae3a6a156bdadf41..d20f1d764ffa918ca01bd97aac71579185db3128 100644 (file)
@@ -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(), "&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');
index 1f3bd60f09332b0d98a9b6a3ed814d237b951288..ff23751643cf52e842addc77cafea7ed6f357c3e 100644 (file)
@@ -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>'))