1
1
import { ComponentFixture , TestBed } from '@angular/core/testing' ;
2
2
import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed' ;
3
- import { MatAutocompleteHarness } from '@angular/material/autocomplete/testing' ;
3
+ import { MatLegacyAutocompleteHarness } from '@angular/material/legacy- autocomplete/testing' ;
4
4
import { HarnessLoader } from '@angular/cdk/testing' ;
5
- import { MatAutocompleteModule } from '@angular/material/autocomplete' ;
5
+ import { MatLegacyAutocompleteModule } from '@angular/material/legacy- autocomplete' ;
6
6
import { AutocompleteHarnessExample } from './autocomplete-harness-example' ;
7
7
8
8
describe ( 'AutocompleteHarnessExample' , ( ) => {
@@ -11,7 +11,7 @@ describe('AutocompleteHarnessExample', () => {
11
11
12
12
beforeEach ( async ( ) => {
13
13
await TestBed . configureTestingModule ( {
14
- imports : [ MatAutocompleteModule ] ,
14
+ imports : [ MatLegacyAutocompleteModule ] ,
15
15
declarations : [ AutocompleteHarnessExample ] ,
16
16
} ) . compileComponents ( ) ;
17
17
fixture = TestBed . createComponent ( AutocompleteHarnessExample ) ;
@@ -20,20 +20,24 @@ describe('AutocompleteHarnessExample', () => {
20
20
} ) ;
21
21
22
22
it ( 'should load all autocomplete harnesses' , async ( ) => {
23
- const autocompletes = await loader . getAllHarnesses ( MatAutocompleteHarness ) ;
23
+ const autocompletes = await loader . getAllHarnesses ( MatLegacyAutocompleteHarness ) ;
24
24
expect ( autocompletes . length ) . toBe ( 2 ) ;
25
25
} ) ;
26
26
27
27
it ( 'should get disabled state' , async ( ) => {
28
- const enabled = await loader . getHarness ( MatAutocompleteHarness . with ( { selector : '#plain' } ) ) ;
29
- const disabled = await loader . getHarness ( MatAutocompleteHarness . with ( { selector : '#disabled' } ) ) ;
28
+ const enabled = await loader . getHarness (
29
+ MatLegacyAutocompleteHarness . with ( { selector : '#plain' } ) ,
30
+ ) ;
31
+ const disabled = await loader . getHarness (
32
+ MatLegacyAutocompleteHarness . with ( { selector : '#disabled' } ) ,
33
+ ) ;
30
34
31
35
expect ( await enabled . isDisabled ( ) ) . toBe ( false ) ;
32
36
expect ( await disabled . isDisabled ( ) ) . toBe ( true ) ;
33
37
} ) ;
34
38
35
39
it ( 'should focus and blur an input' , async ( ) => {
36
- const input = await loader . getHarness ( MatAutocompleteHarness . with ( { selector : '#plain' } ) ) ;
40
+ const input = await loader . getHarness ( MatLegacyAutocompleteHarness . with ( { selector : '#plain' } ) ) ;
37
41
expect ( await input . isFocused ( ) ) . toBe ( false ) ;
38
42
await input . focus ( ) ;
39
43
expect ( await input . isFocused ( ) ) . toBe ( true ) ;
@@ -42,13 +46,13 @@ describe('AutocompleteHarnessExample', () => {
42
46
} ) ;
43
47
44
48
it ( 'should be able to type in an input' , async ( ) => {
45
- const input = await loader . getHarness ( MatAutocompleteHarness . with ( { selector : '#plain' } ) ) ;
49
+ const input = await loader . getHarness ( MatLegacyAutocompleteHarness . with ( { selector : '#plain' } ) ) ;
46
50
await input . enterText ( 'Hello there' ) ;
47
51
expect ( await input . getValue ( ) ) . toBe ( 'Hello there' ) ;
48
52
} ) ;
49
53
50
54
it ( 'should be able to get filtered options' , async ( ) => {
51
- const input = await loader . getHarness ( MatAutocompleteHarness . with ( { selector : '#plain' } ) ) ;
55
+ const input = await loader . getHarness ( MatLegacyAutocompleteHarness . with ( { selector : '#plain' } ) ) ;
52
56
await input . focus ( ) ;
53
57
const options = await input . getOptions ( { text : / N e w / } ) ;
54
58
0 commit comments