File tree Expand file tree Collapse file tree 2 files changed +41
-1
lines changed Expand file tree Collapse file tree 2 files changed +41
-1
lines changed Original file line number Diff line number Diff line change @@ -28,4 +28,34 @@ QUnit.test( "dialogClass", function( assert ) {
28
28
element . remove ( ) ;
29
29
} ) ;
30
30
31
+ QUnit . test ( "buttons - deprecated options" , function ( assert ) {
32
+ assert . expect ( 7 ) ;
33
+
34
+ var buttons ,
35
+ element = $ ( "<div></div>" ) . dialog ( {
36
+ buttons : [
37
+ {
38
+ html : "a button" ,
39
+ "class" : "additional-class" ,
40
+ id : "my-button-id" ,
41
+ click : function ( ) {
42
+ assert . equal ( this , element [ 0 ] , "correct context" ) ;
43
+ } ,
44
+ icons : { primary : "ui-icon-cancel" } ,
45
+ text : false
46
+ }
47
+ ]
48
+ } ) ;
49
+
50
+ buttons = element . dialog ( "widget" ) . find ( ".ui-dialog-buttonpane button" ) ;
51
+ assert . equal ( buttons . length , 1 , "correct number of buttons" ) ;
52
+ assert . equal ( buttons . attr ( "id" ) , "my-button-id" , "correct id" ) ;
53
+ assert . equal ( $ . trim ( buttons . text ( ) ) , "a button" , "correct label" ) ;
54
+ assert . hasClasses ( buttons , "additional-class" ) ;
55
+ assert . deepEqual ( buttons . button ( "option" , "icon" ) , "ui-icon-cancel" ) ;
56
+ assert . equal ( buttons . button ( "option" , "showLabel" ) , false ) ;
57
+ buttons . trigger ( "click" ) ;
58
+
59
+ element . remove ( ) ;
60
+ } ) ;
31
61
} ) ;
Original file line number Diff line number Diff line change @@ -500,14 +500,24 @@ $.widget( "ui.dialog", {
500
500
buttonOptions = {
501
501
icon : props . icon ,
502
502
iconPosition : props . iconPosition ,
503
- showLabel : props . showLabel
503
+ showLabel : props . showLabel ,
504
+
505
+ // Deprecated options
506
+ icons : props . icons ,
507
+ text : props . text
504
508
} ;
505
509
506
510
delete props . click ;
507
511
delete props . icon ;
508
512
delete props . iconPosition ;
509
513
delete props . showLabel ;
510
514
515
+ // Deprecated options
516
+ delete props . icons ;
517
+ if ( typeof props . text === "boolean" ) {
518
+ delete props . text ;
519
+ }
520
+
511
521
$ ( "<button></button>" , props )
512
522
. button ( buttonOptions )
513
523
. appendTo ( that . uiButtonSet )
You can’t perform that action at this time.
0 commit comments