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 @@ -352,6 +352,8 @@ $.widget( "ui.buttonset", {
352
352
} ,
353
353
354
354
refresh : function ( ) {
355
+ var ltr = this . element . css ( "direction" ) === "ltr" ;
356
+
355
357
this . buttons = this . element . find ( this . options . items )
356
358
. filter ( ":ui-button" )
357
359
. button ( "refresh" )
@@ -364,10 +366,10 @@ $.widget( "ui.buttonset", {
364
366
} )
365
367
. removeClass ( "ui-corner-all ui-corner-left ui-corner-right" )
366
368
. filter ( ":first" )
367
- . addClass ( "ui-corner-left" )
369
+ . addClass ( ltr ? "ui-corner-left" : "ui-corner-right " )
368
370
. end ( )
369
371
. filter ( ":last" )
370
- . addClass ( "ui-corner-right" )
372
+ . addClass ( ltr ? "ui-corner-right" : "ui-corner-left " )
371
373
. end ( )
372
374
. end ( ) ;
373
375
} ,
You can’t perform that action at this time.
0 commit comments