File tree Expand file tree Collapse file tree 2 files changed +9
-0
lines changed
core/src/components/range Expand file tree Collapse file tree 2 files changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -159,6 +159,12 @@ export class Range implements ComponentInterface {
159159 * Specifies the value granularity.
160160 */
161161 @Prop ( ) step = 1 ;
162+ @Watch ( 'step' )
163+ protected stepChanged ( newValue : number ) {
164+ if ( ! isSafeNumber ( newValue ) ) {
165+ this . step = 1 ;
166+ }
167+ }
162168
163169 /**
164170 * If `true`, tick marks are displayed based on the step value.
@@ -312,6 +318,7 @@ export class Range implements ComponentInterface {
312318 // Our watch does this, but not before the initial load.
313319 this . min = isSafeNumber ( this . min ) ? this . min : 0 ;
314320 this . max = isSafeNumber ( this . max ) ? this . max : 100 ;
321+ this . step = isSafeNumber ( this . step ) ? this . step : 1 ;
315322 }
316323
317324 componentDidLoad ( ) {
Original file line number Diff line number Diff line change @@ -40,9 +40,11 @@ describe('Range', () => {
4040 // Here we have to cast this to any, but in its react wrapper it accepts undefined as a valid value
4141 range . min = undefined as any ;
4242 range . max = undefined as any ;
43+ range . step = undefined as any ;
4344 await page . waitForChanges ( ) ;
4445 expect ( range . min ) . toBe ( 0 ) ;
4546 expect ( range . max ) . toBe ( 100 ) ;
47+ expect ( range . step ) . toBe ( 1 ) ;
4648 } ) ;
4749
4850 it ( 'should return the clamped value for a range dual knob component' , ( ) => {
You can’t perform that action at this time.
0 commit comments