6
6
* found in the LICENSE file at https://angular.io/license
7
7
*/
8
8
9
- import { BidiModule } from '@angular/cdk/bidi' ;
9
+ import { BidiModule , Directionality } from '@angular/cdk/bidi' ;
10
10
import { Platform } from '@angular/cdk/platform' ;
11
11
import {
12
12
dispatchMouseEvent ,
13
13
dispatchPointerEvent ,
14
14
dispatchTouchEvent ,
15
15
} from '@angular/cdk/testing/private' ;
16
- import { Component , QueryList , Type , ViewChild , ViewChildren } from '@angular/core' ;
16
+ import { Component , Provider , QueryList , Type , ViewChild , ViewChildren } from '@angular/core' ;
17
17
import {
18
18
ComponentFixture ,
19
19
fakeAsync ,
@@ -25,6 +25,7 @@ import {
25
25
import { FormControl , FormsModule , ReactiveFormsModule } from '@angular/forms' ;
26
26
import { By } from '@angular/platform-browser' ;
27
27
import { Thumb } from '@material/slider' ;
28
+ import { of } from 'rxjs' ;
28
29
import { MatSliderModule } from './module' ;
29
30
import { MatSlider , MatSliderThumb , MatSliderVisualThumb } from './slider' ;
30
31
@@ -42,10 +43,14 @@ describe('MDC-based MatSlider' , () => {
42
43
spyOn ( Element . prototype , 'setPointerCapture' ) ;
43
44
} ) ;
44
45
45
- function createComponent < T > ( component : Type < T > ) : ComponentFixture < T > {
46
+ function createComponent < T > (
47
+ component : Type < T > ,
48
+ providers : Provider [ ] = [ ] ,
49
+ ) : ComponentFixture < T > {
46
50
TestBed . configureTestingModule ( {
47
51
imports : [ FormsModule , MatSliderModule , ReactiveFormsModule , BidiModule ] ,
48
52
declarations : [ component ] ,
53
+ providers : [ ...providers ] ,
49
54
} ) . compileComponents ( ) ;
50
55
return TestBed . createComponent < T > ( component ) ;
51
56
}
@@ -1160,12 +1165,14 @@ describe('MDC-based MatSlider' , () => {
1160
1165
} ) ;
1161
1166
1162
1167
describe ( 'slider with direction' , ( ) => {
1163
- let fixture : ComponentFixture < RTLSlider > ;
1164
1168
let sliderInstance : MatSlider ;
1165
1169
let inputInstance : MatSliderThumb ;
1166
1170
1167
1171
beforeEach ( waitForAsync ( ( ) => {
1168
- fixture = createComponent ( RTLSlider ) ;
1172
+ const fixture = createComponent ( StandardSlider , [ {
1173
+ provide : Directionality ,
1174
+ useValue : ( { value : 'rtl' , change : of ( ) } )
1175
+ } ] ) ;
1169
1176
fixture . detectChanges ( ) ;
1170
1177
const sliderDebugElement = fixture . debugElement . query ( By . directive ( MatSlider ) ) ;
1171
1178
sliderInstance = sliderDebugElement . componentInstance ;
@@ -1179,13 +1186,15 @@ describe('MDC-based MatSlider' , () => {
1179
1186
} ) ;
1180
1187
1181
1188
describe ( 'range slider with direction' , ( ) => {
1182
- let fixture : ComponentFixture < RTLRangeSlider > ;
1183
1189
let sliderInstance : MatSlider ;
1184
1190
let startInputInstance : MatSliderThumb ;
1185
1191
let endInputInstance : MatSliderThumb ;
1186
1192
1187
1193
beforeEach ( waitForAsync ( ( ) => {
1188
- fixture = createComponent ( RTLRangeSlider ) ;
1194
+ const fixture = createComponent ( StandardRangeSlider , [ {
1195
+ provide : Directionality ,
1196
+ useValue : ( { value : 'rtl' , change : of ( ) } )
1197
+ } ] ) ;
1189
1198
fixture . detectChanges ( ) ;
1190
1199
const sliderDebugElement = fixture . debugElement . query ( By . directive ( MatSlider ) ) ;
1191
1200
sliderInstance = sliderDebugElement . componentInstance ;
0 commit comments