diff --git a/tests/unit/dialog/options.js b/tests/unit/dialog/options.js index 6d3a619bd65..ab9ace259d5 100644 --- a/tests/unit/dialog/options.js +++ b/tests/unit/dialog/options.js @@ -206,7 +206,7 @@ test( "closeOnEscape", function() { } ); test( "closeText", function() { - expect( 3 ); + expect( 4 ); var element = $( "
" ).dialog(); equal( $.trim( element.dialog( "widget" ).find( ".ui-dialog-titlebar-close" ).text() ), "Close", @@ -222,6 +222,11 @@ test( "closeText", function() { equal( $.trim( element.dialog( "widget" ).find( ".ui-dialog-titlebar-close" ).text() ), "bar", "closeText via option method" ); element.remove(); + + element = $( "
" ).dialog( { closeText: "foo" } ); + equal( $.trim( element.dialog( "widget" ).find( ".ui-dialog-titlebar-close" ).text() ), "foo", + "closeText is escaped" ); + element.remove(); } ); test( "draggable", function() { diff --git a/ui/widgets/dialog.js b/ui/widgets/dialog.js index f0a2f6751ae..c3ca95ed390 100644 --- a/ui/widgets/dialog.js +++ b/ui/widgets/dialog.js @@ -426,7 +426,7 @@ $.widget( "ui.dialog", { // dialog in IE (#9312) this.uiDialogTitlebarClose = $( "" ) .button( { - label: this.options.closeText, + label: $( "" ).text( this.options.closeText ).html(), icon: "ui-icon-closethick", showLabel: false } ) @@ -715,7 +715,7 @@ $.widget( "ui.dialog", { this.uiDialogTitlebarClose.button( { // Ensure that we always pass a string - label: "" + value + label: $( "" ).text( "" + this.options.closeText ).html() } ); }