@@ -71,22 +71,22 @@ describe('MdSlider', () => {
7171 expect ( sliderInstance . value ) . toBe ( 19 ) ;
7272 } ) ;
7373
74- it ( 'should update the value on a drag ' , ( ) => {
74+ it ( 'should update the value on a slide ' , ( ) => {
7575 expect ( sliderInstance . value ) . toBe ( 0 ) ;
76- dispatchDragEvent ( sliderTrackElement , sliderNativeElement , 0 , 0.89 , gestureConfig ) ;
76+ dispatchSlideEvent ( sliderTrackElement , sliderNativeElement , 0 , 0.89 , gestureConfig ) ;
7777 // The expected value is 89 from: percentage * difference of max and min.
7878 expect ( sliderInstance . value ) . toBe ( 89 ) ;
7979 } ) ;
8080
81- it ( 'should set the value as min when dragging before the track' , ( ) => {
81+ it ( 'should set the value as min when sliding before the track' , ( ) => {
8282 expect ( sliderInstance . value ) . toBe ( 0 ) ;
83- dispatchDragEvent ( sliderTrackElement , sliderNativeElement , 0 , - 1.33 , gestureConfig ) ;
83+ dispatchSlideEvent ( sliderTrackElement , sliderNativeElement , 0 , - 1.33 , gestureConfig ) ;
8484 expect ( sliderInstance . value ) . toBe ( 0 ) ;
8585 } ) ;
8686
87- it ( 'should set the value as max when dragging past the track' , ( ) => {
87+ it ( 'should set the value as max when sliding past the track' , ( ) => {
8888 expect ( sliderInstance . value ) . toBe ( 0 ) ;
89- dispatchDragEvent ( sliderTrackElement , sliderNativeElement , 0 , 1.75 , gestureConfig ) ;
89+ dispatchSlideEvent ( sliderTrackElement , sliderNativeElement , 0 , 1.75 , gestureConfig ) ;
9090 expect ( sliderInstance . value ) . toBe ( 100 ) ;
9191 } ) ;
9292
@@ -116,9 +116,9 @@ describe('MdSlider', () => {
116116 expect ( thumbDimensions . left ) . toBe ( sliderDimensions . width * 0.5 + sliderDimensions . left ) ;
117117 } ) ;
118118
119- it ( 'should update the track fill on drag ' , ( ) => {
119+ it ( 'should update the track fill on slide ' , ( ) => {
120120 expect ( trackFillDimensions . width ) . toBe ( 0 ) ;
121- dispatchDragEvent ( sliderTrackElement , sliderNativeElement , 0 , 0.86 , gestureConfig ) ;
121+ dispatchSlideEvent ( sliderTrackElement , sliderNativeElement , 0 , 0.86 , gestureConfig ) ;
122122
123123 trackFillDimensions = trackFillElement . getBoundingClientRect ( ) ;
124124 thumbDimensions = thumbElement . getBoundingClientRect ( ) ;
@@ -130,11 +130,11 @@ describe('MdSlider', () => {
130130 expect ( Math . round ( trackFillDimensions . width ) ) . toBe ( Math . round ( thumbPosition ) ) ;
131131 } ) ;
132132
133- it ( 'should update the thumb position on drag ' , ( ) => {
133+ it ( 'should update the thumb position on slide ' , ( ) => {
134134 expect ( thumbDimensions . left ) . toBe ( sliderDimensions . left ) ;
135- // The drag event also truncates the position passed in, so 50% is used here as well to
135+ // The slide event also truncates the position passed in, so 50% is used here as well to
136136 // ensure the ability to calculate the expected position.
137- dispatchDragEvent ( sliderTrackElement , sliderNativeElement , 0 , 0.5 , gestureConfig ) ;
137+ dispatchSlideEvent ( sliderTrackElement , sliderNativeElement , 0 , 0.5 , gestureConfig ) ;
138138
139139 thumbDimensions = thumbElement . getBoundingClientRect ( ) ;
140140 expect ( thumbDimensions . left ) . toBe ( sliderDimensions . width * 0.5 + sliderDimensions . left ) ;
@@ -165,19 +165,19 @@ describe('MdSlider', () => {
165165 expect ( containerElement . classList ) . not . toContain ( 'md-slider-active' ) ;
166166 } ) ;
167167
168- it ( 'should add and remove the md-slider-dragging class when dragging ' , ( ) => {
168+ it ( 'should add and remove the md-slider-sliding class when sliding ' , ( ) => {
169169 let containerElement = sliderNativeElement . querySelector ( '.md-slider-container' ) ;
170- expect ( containerElement . classList ) . not . toContain ( 'md-slider-dragging ' ) ;
170+ expect ( containerElement . classList ) . not . toContain ( 'md-slider-sliding ' ) ;
171171
172- dispatchDragStartEvent ( sliderNativeElement , 0 , gestureConfig ) ;
172+ dispatchSlideStartEvent ( sliderNativeElement , 0 , gestureConfig ) ;
173173 fixture . detectChanges ( ) ;
174174
175- expect ( containerElement . classList ) . toContain ( 'md-slider-dragging ' ) ;
175+ expect ( containerElement . classList ) . toContain ( 'md-slider-sliding ' ) ;
176176
177- dispatchDragEndEvent ( sliderNativeElement , 0.34 , gestureConfig ) ;
177+ dispatchSlideEndEvent ( sliderNativeElement , 0.34 , gestureConfig ) ;
178178 fixture . detectChanges ( ) ;
179179
180- expect ( containerElement . classList ) . not . toContain ( 'md-slider-dragging ' ) ;
180+ expect ( containerElement . classList ) . not . toContain ( 'md-slider-sliding ' ) ;
181181 } ) ;
182182 } ) ;
183183
@@ -208,9 +208,9 @@ describe('MdSlider', () => {
208208 expect ( sliderInstance . value ) . toBe ( 0 ) ;
209209 } ) ;
210210
211- it ( 'should not change the value on drag when disabled' , ( ) => {
211+ it ( 'should not change the value on slide when disabled' , ( ) => {
212212 expect ( sliderInstance . value ) . toBe ( 0 ) ;
213- dispatchDragEvent ( sliderNativeElement , sliderNativeElement , 0 , 0.5 , gestureConfig ) ;
213+ dispatchSlideEvent ( sliderNativeElement , sliderNativeElement , 0 , 0.5 , gestureConfig ) ;
214214 expect ( sliderInstance . value ) . toBe ( 0 ) ;
215215 } ) ;
216216
@@ -224,14 +224,14 @@ describe('MdSlider', () => {
224224 expect ( containerElement . classList ) . not . toContain ( 'md-slider-active' ) ;
225225 } ) ;
226226
227- it ( 'should not add the md-slider-dragging class on drag when disabled' , ( ) => {
227+ it ( 'should not add the md-slider-sliding class on slide when disabled' , ( ) => {
228228 let containerElement = sliderNativeElement . querySelector ( '.md-slider-container' ) ;
229- expect ( containerElement . classList ) . not . toContain ( 'md-slider-dragging ' ) ;
229+ expect ( containerElement . classList ) . not . toContain ( 'md-slider-sliding ' ) ;
230230
231- dispatchDragStartEvent ( sliderNativeElement , 0.46 , gestureConfig ) ;
231+ dispatchSlideStartEvent ( sliderNativeElement , 0.46 , gestureConfig ) ;
232232 fixture . detectChanges ( ) ;
233233
234- expect ( containerElement . classList ) . not . toContain ( 'md-slider-dragging ' ) ;
234+ expect ( containerElement . classList ) . not . toContain ( 'md-slider-sliding ' ) ;
235235 } ) ;
236236 } ) ;
237237
@@ -274,8 +274,8 @@ describe('MdSlider', () => {
274274 expect ( sliderInstance . value ) . toBe ( value ) ;
275275 } ) ;
276276
277- it ( 'should set the correct value on drag ' , ( ) => {
278- dispatchDragEvent ( sliderTrackElement , sliderNativeElement , 0 , 0.62 , gestureConfig ) ;
277+ it ( 'should set the correct value on slide ' , ( ) => {
278+ dispatchSlideEvent ( sliderTrackElement , sliderNativeElement , 0 , 0.62 , gestureConfig ) ;
279279 // Computed by multiplying the difference between the min and the max by the percentage from
280280 // the click and adding that to the minimum.
281281 let value = Math . round ( 4 + ( 0.62 * ( 6 - 4 ) ) ) ;
@@ -295,11 +295,11 @@ describe('MdSlider', () => {
295295 expect ( Math . round ( trackFillDimensions . width ) ) . toBe ( Math . round ( thumbPosition ) ) ;
296296 } ) ;
297297
298- it ( 'should snap the thumb and fill to the nearest value on drag ' , ( ) => {
299- dispatchDragEvent ( sliderTrackElement , sliderNativeElement , 0 , 0.74 , gestureConfig ) ;
298+ it ( 'should snap the thumb and fill to the nearest value on slide ' , ( ) => {
299+ dispatchSlideEvent ( sliderTrackElement , sliderNativeElement , 0 , 0.74 , gestureConfig ) ;
300300 fixture . detectChanges ( ) ;
301301
302- dispatchDragEndEvent ( sliderNativeElement , 0.74 , gestureConfig ) ;
302+ dispatchSlideEndEvent ( sliderNativeElement , 0.74 , gestureConfig ) ;
303303 fixture . detectChanges ( ) ;
304304
305305 let trackFillDimensions = trackFillElement . getBoundingClientRect ( ) ;
@@ -343,8 +343,8 @@ describe('MdSlider', () => {
343343 expect ( sliderInstance . value ) . toBe ( 92 ) ;
344344 } ) ;
345345
346- it ( 'should set the correct value on drag ' , ( ) => {
347- dispatchDragEvent ( sliderTrackElement , sliderNativeElement , 0 , 0.32 , gestureConfig ) ;
346+ it ( 'should set the correct value on slide ' , ( ) => {
347+ dispatchSlideEvent ( sliderTrackElement , sliderNativeElement , 0 , 0.32 , gestureConfig ) ;
348348 expect ( sliderInstance . value ) . toBe ( 32 ) ;
349349 } ) ;
350350 } ) ;
@@ -396,18 +396,18 @@ describe('MdSlider', () => {
396396 expect ( Math . round ( trackFillDimensions . width ) ) . toBe ( Math . round ( thumbPosition ) ) ;
397397 } ) ;
398398
399- it ( 'should set the correct step value on drag ' , ( ) => {
400- dispatchDragEvent ( sliderTrackElement , sliderNativeElement , 0 , 0.07 , gestureConfig ) ;
399+ it ( 'should set the correct step value on slide ' , ( ) => {
400+ dispatchSlideEvent ( sliderTrackElement , sliderNativeElement , 0 , 0.07 , gestureConfig ) ;
401401 fixture . detectChanges ( ) ;
402402
403403 expect ( sliderInstance . value ) . toBe ( 0 ) ;
404404 } ) ;
405405
406- it ( 'should snap the thumb and fill to a step on drag ' , ( ) => {
407- dispatchDragEvent ( sliderTrackElement , sliderNativeElement , 0 , 0.88 , gestureConfig ) ;
406+ it ( 'should snap the thumb and fill to a step on slide ' , ( ) => {
407+ dispatchSlideEvent ( sliderTrackElement , sliderNativeElement , 0 , 0.88 , gestureConfig ) ;
408408 fixture . detectChanges ( ) ;
409409
410- dispatchDragEndEvent ( sliderNativeElement , 0.88 , gestureConfig ) ;
410+ dispatchSlideEndEvent ( sliderNativeElement , 0.88 , gestureConfig ) ;
411411 fixture . detectChanges ( ) ;
412412
413413 let trackFillDimensions = trackFillElement . getBoundingClientRect ( ) ;
@@ -489,62 +489,62 @@ function dispatchClickEvent(element: HTMLElement, percentage: number): void {
489489}
490490
491491/**
492- * Dispatches a drag event from an element.
492+ * Dispatches a slide event from an element.
493493 * @param trackElement The track element from which the event location will be calculated.
494494 * @param containerElement The container element from which the event will be dispatched.
495- * @param startPercent The percentage of the slider where the drag will begin.
496- * @param endPercent The percentage of the slider where the drag will end.
497- * @param gestureConfig The gesture config for the test to handle emitting the drag events.
495+ * @param startPercent The percentage of the slider where the slide will begin.
496+ * @param endPercent The percentage of the slider where the slide will end.
497+ * @param gestureConfig The gesture config for the test to handle emitting the slide events.
498498 */
499- function dispatchDragEvent ( trackElement : HTMLElement , containerElement : HTMLElement ,
500- startPercent : number , endPercent : number ,
501- gestureConfig : TestGestureConfig ) : void {
499+ function dispatchSlideEvent ( trackElement : HTMLElement , containerElement : HTMLElement ,
500+ startPercent : number , endPercent : number ,
501+ gestureConfig : TestGestureConfig ) : void {
502502 let dimensions = trackElement . getBoundingClientRect ( ) ;
503503 let startX = dimensions . left + ( dimensions . width * startPercent ) ;
504504 let endX = dimensions . left + ( dimensions . width * endPercent ) ;
505505
506- gestureConfig . emitEventForElement ( 'dragstart ' , containerElement , {
507- // The actual event has a center with an x value that the drag listener is looking for.
506+ gestureConfig . emitEventForElement ( 'slidestart ' , containerElement , {
507+ // The actual event has a center with an x value that the slide listener is looking for.
508508 center : { x : startX } ,
509509 // The event needs a source event with a prevent default so we fake one.
510510 srcEvent : { preventDefault : jasmine . createSpy ( 'preventDefault' ) }
511511 } ) ;
512512
513- gestureConfig . emitEventForElement ( 'drag ' , containerElement , {
513+ gestureConfig . emitEventForElement ( 'slide ' , containerElement , {
514514 center : { x : endX } ,
515515 srcEvent : { preventDefault : jasmine . createSpy ( 'preventDefault' ) }
516516 } ) ;
517517}
518518
519519/**
520- * Dispatches a dragstart event from an element.
520+ * Dispatches a slidestart event from an element.
521521 * @param element The element from which the event will be dispatched.
522- * @param startPercent The percentage of the slider where the drag will begin.
523- * @param gestureConfig The gesture config for the test to handle emitting the drag events.
522+ * @param startPercent The percentage of the slider where the slide will begin.
523+ * @param gestureConfig The gesture config for the test to handle emitting the slide events.
524524 */
525- function dispatchDragStartEvent ( element : HTMLElement , startPercent : number ,
526- gestureConfig : TestGestureConfig ) : void {
525+ function dispatchSlideStartEvent ( element : HTMLElement , startPercent : number ,
526+ gestureConfig : TestGestureConfig ) : void {
527527 let dimensions = element . getBoundingClientRect ( ) ;
528528 let x = dimensions . left + ( dimensions . width * startPercent ) ;
529529
530- gestureConfig . emitEventForElement ( 'dragstart ' , element , {
530+ gestureConfig . emitEventForElement ( 'slidestart ' , element , {
531531 center : { x : x } ,
532532 srcEvent : { preventDefault : jasmine . createSpy ( 'preventDefault' ) }
533533 } ) ;
534534}
535535
536536/**
537- * Dispatches a dragend event from an element.
537+ * Dispatches a slideend event from an element.
538538 * @param element The element from which the event will be dispatched.
539- * @param endPercent The percentage of the slider where the drag will end.
540- * @param gestureConfig The gesture config for the test to handle emitting the drag events.
539+ * @param endPercent The percentage of the slider where the slide will end.
540+ * @param gestureConfig The gesture config for the test to handle emitting the slide events.
541541 */
542- function dispatchDragEndEvent ( element : HTMLElement , endPercent : number ,
543- gestureConfig : TestGestureConfig ) : void {
542+ function dispatchSlideEndEvent ( element : HTMLElement , endPercent : number ,
543+ gestureConfig : TestGestureConfig ) : void {
544544 let dimensions = element . getBoundingClientRect ( ) ;
545545 let x = dimensions . left + ( dimensions . width * endPercent ) ;
546546
547- gestureConfig . emitEventForElement ( 'dragend ' , element , {
547+ gestureConfig . emitEventForElement ( 'slideend ' , element , {
548548 center : { x : x } ,
549549 srcEvent : { preventDefault : jasmine . createSpy ( 'preventDefault' ) }
550550 } ) ;
0 commit comments