From 6c754b4b5b19a2a12eae68058458ef9ff7b72a0a Mon Sep 17 00:00:00 2001 From: Scott González Date: Mon, 25 Jul 2016 08:16:13 -0400 Subject: Dialog: Support deprecated button options Fixes #15016 Closes gh-1723 --- tests/unit/dialog/deprecated.js | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'tests') diff --git a/tests/unit/dialog/deprecated.js b/tests/unit/dialog/deprecated.js index 960bf0dc4..973a90893 100644 --- a/tests/unit/dialog/deprecated.js +++ b/tests/unit/dialog/deprecated.js @@ -28,4 +28,34 @@ QUnit.test( "dialogClass", function( assert ) { element.remove(); } ); +QUnit.test( "buttons - deprecated options", function( assert ) { + assert.expect( 7 ); + + var buttons, + element = $( "
" ).dialog( { + buttons: [ + { + html: "a button", + "class": "additional-class", + id: "my-button-id", + click: function() { + assert.equal( this, element[ 0 ], "correct context" ); + }, + icons: { primary: "ui-icon-cancel" }, + text: false + } + ] + } ); + + buttons = element.dialog( "widget" ).find( ".ui-dialog-buttonpane button" ); + assert.equal( buttons.length, 1, "correct number of buttons" ); + assert.equal( buttons.attr( "id" ), "my-button-id", "correct id" ); + assert.equal( $.trim( buttons.text() ), "a button", "correct label" ); + assert.hasClasses( buttons, "additional-class" ); + assert.deepEqual( buttons.button( "option", "icon" ), "ui-icon-cancel" ); + assert.equal( buttons.button( "option", "showLabel" ), false ); + buttons.trigger( "click" ); + + element.remove(); +} ); } ); -- cgit v1.2.3