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() {
6767 ok ( set . children ( "label:eq(2)" ) . is ( ".ui-button.ui-corner-right:not(.ui-corner-all)" ) ) ;
6868} ) ;
6969
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+
7084} ) ( jQuery ) ;
Original file line number Diff line number Diff line change @@ -352,6 +352,8 @@ $.widget( "ui.buttonset", {
352352 } ,
353353
354354 refresh : function ( ) {
355+ var ltr = this . element . css ( "direction" ) === "ltr" ;
356+
355357 this . buttons = this . element . find ( this . options . items )
356358 . filter ( ":ui-button" )
357359 . button ( "refresh" )
@@ -364,10 +366,10 @@ $.widget( "ui.buttonset", {
364366 } )
365367 . removeClass ( "ui-corner-all ui-corner-left ui-corner-right" )
366368 . filter ( ":first" )
367- . addClass ( "ui-corner-left" )
369+ . addClass ( ltr ? "ui-corner-left" : "ui-corner-right " )
368370 . end ( )
369371 . filter ( ":last" )
370- . addClass ( "ui-corner-right" )
372+ . addClass ( ltr ? "ui-corner-right" : "ui-corner-left " )
371373 . end ( )
372374 . end ( ) ;
373375 } ,
You can’t perform that action at this time.
0 commit comments