@@ -101,13 +101,13 @@ describe('MdSlider', () => {
101
101
// offset relative to the track, subtract the offset on the track fill.
102
102
let thumbPosition = thumbDimensions . left - trackFillDimensions . left ;
103
103
// The track fill width should be equal to the thumb's position.
104
- expect ( Math . round ( trackFillDimensions . width ) ) . toEqual ( Math . round ( thumbPosition ) ) ;
104
+ expect ( Math . round ( trackFillDimensions . width ) ) . toBe ( Math . round ( thumbPosition ) ) ;
105
105
} ) ;
106
106
107
107
it ( 'should update the thumb position on click' , ( ) => {
108
108
expect ( thumbDimensions . left ) . toBe ( sliderDimensions . left ) ;
109
109
// 50% is used here because the click event that is dispatched truncates the position and so
110
- // a value had to be used that would not be affected by the truncation .
110
+ // a value had to be used that would not be truncated .
111
111
dispatchClickEvent ( sliderTrackElement , 0.5 ) ;
112
112
113
113
thumbDimensions = thumbElement . getBoundingClientRect ( ) ;
@@ -127,11 +127,13 @@ describe('MdSlider', () => {
127
127
// offset relative to the track, subtract the offset on the track fill.
128
128
let thumbPosition = thumbDimensions . left - trackFillDimensions . left ;
129
129
// The track fill width should be equal to the thumb's position.
130
- expect ( Math . round ( trackFillDimensions . width ) ) . toEqual ( Math . round ( thumbPosition ) ) ;
130
+ expect ( Math . round ( trackFillDimensions . width ) ) . toBe ( Math . round ( thumbPosition ) ) ;
131
131
} ) ;
132
132
133
133
it ( 'should update the thumb position on drag' , ( ) => {
134
134
expect ( thumbDimensions . left ) . toBe ( sliderDimensions . left ) ;
135
+ // The drag event also truncates the position passed in, so 50% is used here as well to
136
+ // ensure the ability to calculate the expected position.
135
137
dispatchDragEvent ( sliderTrackElement , sliderNativeElement , 0 , 0.5 , gestureConfig ) ;
136
138
137
139
thumbDimensions = thumbElement . getBoundingClientRect ( ) ;
@@ -290,7 +292,7 @@ describe('MdSlider', () => {
290
292
291
293
// The closest snap is halfway on the slider.
292
294
expect ( thumbDimensions . left ) . toBe ( sliderDimensions . width * 0.5 + sliderDimensions . left ) ;
293
- expect ( Math . round ( trackFillDimensions . width ) ) . toEqual ( Math . round ( thumbPosition ) ) ;
295
+ expect ( Math . round ( trackFillDimensions . width ) ) . toBe ( Math . round ( thumbPosition ) ) ;
294
296
} ) ;
295
297
296
298
it ( 'should snap the thumb and fill to the nearest value on drag' , ( ) => {
@@ -306,7 +308,7 @@ describe('MdSlider', () => {
306
308
307
309
// The closest snap is at the halfway point on the slider.
308
310
expect ( thumbDimensions . left ) . toBe ( sliderDimensions . left + sliderDimensions . width * 0.5 ) ;
309
- expect ( Math . round ( trackFillDimensions . width ) ) . toEqual ( Math . round ( thumbPosition ) ) ;
311
+ expect ( Math . round ( trackFillDimensions . width ) ) . toBe ( Math . round ( thumbPosition ) ) ;
310
312
311
313
} ) ;
312
314
} ) ;
@@ -391,7 +393,7 @@ describe('MdSlider', () => {
391
393
392
394
// The closest step is at 75% of the slider.
393
395
expect ( thumbDimensions . left ) . toBe ( sliderDimensions . width * 0.75 + sliderDimensions . left ) ;
394
- expect ( Math . round ( trackFillDimensions . width ) ) . toEqual ( Math . round ( thumbPosition ) ) ;
396
+ expect ( Math . round ( trackFillDimensions . width ) ) . toBe ( Math . round ( thumbPosition ) ) ;
395
397
} ) ;
396
398
397
399
it ( 'should set the correct step value on drag' , ( ) => {
@@ -414,7 +416,7 @@ describe('MdSlider', () => {
414
416
415
417
// The closest snap is at the end of the slider.
416
418
expect ( thumbDimensions . left ) . toBe ( sliderDimensions . width + sliderDimensions . left ) ;
417
- expect ( Math . round ( trackFillDimensions . width ) ) . toEqual ( Math . round ( thumbPosition ) ) ;
419
+ expect ( Math . round ( trackFillDimensions . width ) ) . toBe ( Math . round ( thumbPosition ) ) ;
418
420
} ) ;
419
421
} ) ;
420
422
} ) ;
0 commit comments