]> source.dussan.org Git - jquery-ui.git/commitdiff
Dialog: Updating dialog and tests for new button API
authorAlexander Schmitz <arschmitz@gmail.com>
Fri, 28 Mar 2014 14:48:18 +0000 (10:48 -0400)
committerAlexander Schmitz <arschmitz@gmail.com>
Wed, 7 Oct 2015 14:57:59 +0000 (10:57 -0400)
tests/unit/dialog/options.js
ui/widgets/dialog.js

index 7565799c4acf24bca86ff61b5ea1e8da50ce53cc..5aa9587567f308de11d728359bcec3fb4ae62aa3 100644 (file)
@@ -156,10 +156,8 @@ test( "buttons - advanced", function( assert ) {
                                        click: function() {
                                                equal( this, element[ 0 ], "correct context" );
                                        },
-                                       icons: {
-                                               primary: "ui-icon-cancel"
-                                       },
-                                       showText: false
+                                       icon: "ui-icon-cancel",
+                                       showLabel: false
                                }
                        ]
                } );
@@ -167,10 +165,10 @@ test( "buttons - advanced", function( assert ) {
        buttons = element.dialog( "widget" ).find( ".ui-dialog-buttonpane button" );
        equal( buttons.length, 1, "correct number of buttons" );
        equal( buttons.attr( "id" ), "my-button-id", "correct id" );
-       equal( buttons.text(), "a button", "correct label" );
+       equal( buttons.text(), " a button", "correct label" );
        assert.hasClasses( buttons, "additional-class" );
-       deepEqual( buttons.button( "option", "icons" ), { primary: "ui-icon-cancel", secondary: null } );
-       equal( buttons.button( "option", "text" ), false );
+       deepEqual( buttons.button( "option", "icon" ), "ui-icon-cancel" );
+       equal( buttons.button( "option", "showLabel" ), false );
        buttons.trigger( "click" );
 
        element.remove();
@@ -211,17 +209,17 @@ test( "closeText", function() {
        expect( 3 );
 
        var element = $( "<div></div>" ).dialog();
-               equal( element.dialog( "widget" ).find( ".ui-dialog-titlebar-close span" ).text(), "Close",
+               equal( element.dialog( "widget" ).find( ".ui-dialog-titlebar-close" ).text(), " Close",
                        "default close text" );
        element.remove();
 
        element = $( "<div></div>" ).dialog( { closeText: "foo" } );
-               equal( element.dialog( "widget" ).find( ".ui-dialog-titlebar-close span" ).text(), "foo",
+               equal( element.dialog( "widget" ).find( ".ui-dialog-titlebar-close" ).text(), " foo",
                        "closeText on init" );
        element.remove();
 
        element = $( "<div></div>" ).dialog().dialog( "option", "closeText", "bar" );
-               equal( element.dialog( "widget" ).find( ".ui-dialog-titlebar-close span" ).text(), "bar",
+               equal( element.dialog( "widget" ).find( ".ui-dialog-titlebar-close" ).text(), " bar",
                        "closeText via option method" );
        element.remove();
 } );
index 6070014c9d5f4fde66e47d5e9afa8455f4362f70..b143d291e2d6c700ea5092e3c2a78a238d746ed4 100644 (file)
@@ -427,10 +427,8 @@ $.widget( "ui.dialog", {
                this.uiDialogTitlebarClose = $( "<button type='button'></button>" )
                        .button( {
                                label: this.options.closeText,
-                               icons: {
-                                       primary: "ui-icon-closethick"
-                               },
-                               text: false
+                               icon: "ui-icon-closethick",
+                               showLabel: false
                        } )
                        .appendTo( this.uiDialogTitlebar );
 
@@ -498,12 +496,15 @@ $.widget( "ui.dialog", {
                        // Change the context for the click callback to be the main element
                        click = props.click;
                        buttonOptions = {
-                               icons: props.icons,
-                               text: props.showText
+                               icon: props.icon,
+                               iconPosition: props.iconPosition,
+                               showLabel: props.showLabel
                        };
-                       delete props.icons;
-                       delete props.showText;
+
                        delete props.click;
+                       delete props.icon;
+                       delete props.iconPosition;
+                       delete props.showLabel;
 
                        $( "<button></button>", props )
                                .button( buttonOptions )