File tree Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -67,4 +67,18 @@ test("buttonset", function() {
67
67
ok ( set . children ( "label:eq(2)" ) . is ( ".ui-button.ui-corner-right:not(.ui-corner-all)" ) ) ;
68
68
} ) ;
69
69
70
+ test ( "buttonset (rtl)" , function ( ) {
71
+ var parent = $ ( "#radio1" ) . parent ( ) ;
72
+ // Set to rtl
73
+ parent . attr ( "dir" , "rtl" ) ;
74
+
75
+ var set = $ ( "#radio1" ) . buttonset ( ) ;
76
+ ok ( set . is ( ".ui-buttonset" ) ) ;
77
+ same ( set . children ( ".ui-button" ) . length , 3 ) ;
78
+ same ( set . children ( "input:radio.ui-helper-hidden-accessible" ) . length , 3 ) ;
79
+ ok ( set . children ( "label:eq(0)" ) . is ( ".ui-button.ui-corner-right:not(.ui-corner-all)" ) ) ;
80
+ ok ( set . children ( "label:eq(1)" ) . is ( ".ui-button:not(.ui-corner-all)" ) ) ;
81
+ ok ( set . children ( "label:eq(2)" ) . is ( ".ui-button.ui-corner-left:not(.ui-corner-all)" ) ) ;
82
+ } ) ;
83
+
70
84
} ) ( jQuery ) ;
Original file line number Diff line number Diff line change @@ -351,6 +351,8 @@ $.widget( "ui.buttonset", {
351
351
} ,
352
352
353
353
refresh : function ( ) {
354
+ var ltr = this . element . css ( "direction" ) === "ltr" ;
355
+
354
356
this . buttons = this . element . find ( this . options . items )
355
357
. filter ( ":ui-button" )
356
358
. button ( "refresh" )
@@ -363,10 +365,10 @@ $.widget( "ui.buttonset", {
363
365
} )
364
366
. removeClass ( "ui-corner-all ui-corner-left ui-corner-right" )
365
367
. filter ( ":first" )
366
- . addClass ( "ui-corner-left" )
368
+ . addClass ( ltr ? "ui-corner-left" : "ui-corner-right " )
367
369
. end ( )
368
370
. filter ( ":last" )
369
- . addClass ( "ui-corner-right" )
371
+ . addClass ( ltr ? "ui-corner-right" : "ui-corner-left " )
370
372
. end ( )
371
373
. end ( ) ;
372
374
} ,
You can’t perform that action at this time.
0 commit comments