@@ -109,7 +109,7 @@ test( "min", function() {
109109} ) ;
110110
111111test ( "orientation" , function ( assert ) {
112- expect ( 8 ) ;
112+ expect ( 14 ) ;
113113 element = $ ( "#slider1" ) ;
114114
115115 options = {
@@ -119,7 +119,8 @@ test( "orientation", function( assert ) {
119119 value : 1
120120 } ;
121121
122- var percentVal = ( options . value - options . min ) / ( options . max - options . min ) * 100 ;
122+ var newValue , rangeSize ,
123+ percentVal = ( options . value - options . min ) / ( options . max - options . min ) * 100 ;
123124
124125 element . slider ( options ) . slider ( "option" , "orientation" , "horizontal" ) ;
125126 assert . hasClasses ( element , "ui-slider-horizontal" ) ;
@@ -146,6 +147,42 @@ test( "orientation", function( assert ) {
146147
147148 element . slider ( "destroy" ) ;
148149
150+ newValue = 7 ;
151+ rangeSize = 500 - ( 500 * newValue / 10 ) ;
152+ element = $ ( "#slider2" ) . slider ( {
153+ range : "max" ,
154+ min : 0 ,
155+ max : 10
156+ } ) ;
157+
158+ element . slider ( "option" , "value" , newValue ) ;
159+ element . slider ( "option" , "orientation" , "vertical" ) ;
160+ equal ( element . find ( ".ui-slider-range" ) . width ( ) , 12 ,
161+ "range should occupy all horizontal space after changing orientation to vertical" ) ;
162+ equal ( element . find ( ".ui-slider-range" ) . height ( ) , rangeSize ,
163+ "range height of vertical slider should be proportional to the value" ) ;
164+
165+ element . slider ( "option" , "orientation" , "horizontal" ) ;
166+ equal ( element . find ( ".ui-slider-range " ) . height ( ) , 12 ,
167+ "range should occupy all vertical space after changing orientation to horizontal" ) ;
168+ equal ( element . find ( ".ui-slider-range" ) . width ( ) , rangeSize ,
169+ "range width of horizontal slider should be proportional to the value" ) ;
170+
171+ element . slider ( "destroy" ) ;
172+
173+ element = $ ( "#slider2" ) . slider ( {
174+ range : true ,
175+ min : 0 ,
176+ max : 100
177+ } ) ;
178+ element . slider ( "option" , { values : [ 60 , 70 ] } ) ;
179+ notEqual ( element . find ( ".ui-slider-range " ) . position ( ) . left , 0 ,
180+ "range should not pull over to the track's border" ) ;
181+ element . slider ( "option" , "orientation" , "vertical" ) ;
182+ equal ( element . find ( ".ui-slider-range " ) . position ( ) . left , 0 ,
183+ "range should pull over to the track's border" ) ;
184+
185+ element . slider ( "destroy" ) ;
149186} ) ;
150187
151188//spec: http://wiki.jqueryui.com/Slider#specs
0 commit comments