8
8
9
9
import { dispatchMouseEvent , dispatchPointerEvent } from '@angular/cdk/testing/private' ;
10
10
import { Component , DebugElement , Type } from '@angular/core' ;
11
- import { ComponentFixture , TestBed } from '@angular/core/testing' ;
11
+ import { ComponentFixture , TestBed , waitForAsync } from '@angular/core/testing' ;
12
12
import { RippleRef , RippleState } from '@angular/material/core' ;
13
13
import { By } from '@angular/platform-browser' ;
14
14
import { Thumb } from '@material/slider' ;
@@ -35,17 +35,13 @@ describe('MDC-based MatSlider' , () => {
35
35
let sliderInstance : MatSlider ;
36
36
let inputInstance : MatSliderThumb ;
37
37
38
- beforeEach ( ( ) => {
38
+ beforeEach ( waitForAsync ( ( ) => {
39
39
fixture = createComponent ( StandardSlider ) ;
40
40
fixture . detectChanges ( ) ;
41
41
sliderDebugElement = fixture . debugElement . query ( By . directive ( MatSlider ) ) ;
42
42
sliderInstance = sliderDebugElement . componentInstance ;
43
43
inputInstance = sliderInstance . _getInput ( Thumb . END ) ;
44
- } ) ;
45
-
46
- beforeEach ( done => {
47
- fixture . whenStable ( ) . then ( ( ) => done ( ) ) ;
48
- } ) ;
44
+ } ) ) ;
49
45
50
46
it ( 'should set the default values' , ( ) => {
51
47
expect ( inputInstance . value ) . toBe ( 0 ) ;
@@ -87,18 +83,14 @@ describe('MDC-based MatSlider' , () => {
87
83
let startInputInstance : MatSliderThumb ;
88
84
let endInputInstance : MatSliderThumb ;
89
85
90
- beforeEach ( ( ) => {
86
+ beforeEach ( waitForAsync ( ( ) => {
91
87
fixture = createComponent ( StandardRangeSlider ) ;
92
88
fixture . detectChanges ( ) ;
93
89
sliderDebugElement = fixture . debugElement . query ( By . directive ( MatSlider ) ) ;
94
90
sliderInstance = sliderDebugElement . componentInstance ;
95
91
startInputInstance = sliderInstance . _getInput ( Thumb . START ) ;
96
92
endInputInstance = sliderInstance . _getInput ( Thumb . END ) ;
97
- } ) ;
98
-
99
- beforeEach ( done => {
100
- fixture . whenStable ( ) . then ( ( ) => done ( ) ) ;
101
- } ) ;
93
+ } ) ) ;
102
94
103
95
it ( 'should set the default values' , ( ) => {
104
96
expect ( startInputInstance . value ) . toBe ( 0 ) ;
@@ -160,19 +152,15 @@ describe('MDC-based MatSlider' , () => {
160
152
let thumbX : number ;
161
153
let thumbY : number ;
162
154
163
- beforeEach ( ( ) => {
155
+ beforeEach ( waitForAsync ( ( ) => {
164
156
fixture = createComponent ( StandardSlider ) ;
165
157
fixture . detectChanges ( ) ;
166
158
const sliderDebugElement = fixture . debugElement . query ( By . directive ( MatSlider ) ) ;
167
159
const sliderInstance = sliderDebugElement . componentInstance ;
168
160
inputInstance = sliderInstance . _getInput ( Thumb . END ) ;
169
161
thumbInstance = sliderInstance . _getThumb ( ) ;
170
162
thumbElement = thumbInstance . _getHostElement ( ) ;
171
- } ) ;
172
-
173
- beforeEach ( done => {
174
- fixture . whenStable ( ) . then ( ( ) => done ( ) ) ;
175
- } ) ;
163
+ } ) ) ;
176
164
177
165
beforeEach ( ( ) => {
178
166
const thumbDimensions = thumbElement . getBoundingClientRect ( ) ;
0 commit comments