@@ -29,6 +29,29 @@ describe('vaadin-range-slider', () => {
2929 } ) ;
3030 } ) ;
3131
32+ describe ( 'value property' , ( ) => {
33+ beforeEach ( async ( ) => {
34+ slider = fixtureSync ( '<vaadin-range-slider></vaadin-range-slider>' ) ;
35+ slider . value = [ 1 , 3 ] ;
36+ await nextRender ( ) ;
37+ } ) ;
38+
39+ it ( 'should not update the value when changing min' , ( ) => {
40+ slider . min = 2 ;
41+ expect ( slider . value ) . to . deep . equal ( [ 1 , 3 ] ) ;
42+ } ) ;
43+
44+ it ( 'should not update the value when changing max' , ( ) => {
45+ slider . max = 2 ;
46+ expect ( slider . value ) . to . deep . equal ( [ 1 , 3 ] ) ;
47+ } ) ;
48+
49+ it ( 'should not update the value when changing step' , ( ) => {
50+ slider . step = 1.5 ;
51+ expect ( slider . value ) . to . deep . equal ( [ 1 , 3 ] ) ;
52+ } ) ;
53+ } ) ;
54+
3255 describe ( 'focus' , ( ) => {
3356 let firstGlobalFocusable : HTMLElement ;
3457 let lastGlobalFocusable : HTMLElement ;
@@ -255,6 +278,20 @@ describe('vaadin-range-slider', () => {
255278 expect ( spy ) . to . be . calledOnce ;
256279 } ) ;
257280
281+ it ( 'should preserve decimals when changing value using fractional step' , async ( ) => {
282+ slider . value = [ 0 , 3 ] ;
283+ slider . step = 1.5 ;
284+ await sendKeys ( { press : 'ArrowLeft' } ) ;
285+ expect ( slider . value ) . to . deep . equal ( [ 0 , 1.5 ] ) ;
286+ } ) ;
287+
288+ it ( 'should not increase value past max allowed value with fractional step' , async ( ) => {
289+ slider . value = [ 0 , 99 ] ;
290+ slider . step = 1.5 ;
291+ await sendKeys ( { press : 'ArrowRight' } ) ;
292+ expect ( slider . value ) . to . deep . equal ( [ 0 , 99 ] ) ;
293+ } ) ;
294+
258295 it ( 'should not change value on arrow key when readonly' , async ( ) => {
259296 slider . readonly = true ;
260297 await sendKeys ( { press : 'ArrowRight' } ) ;
0 commit comments