@@ -11,7 +11,7 @@ import {Component, ElementRef, ViewChild} from '@angular/core';
11
11
import { ComponentFixture , inject , TestBed } from '@angular/core/testing' ;
12
12
import { empty as observableEmpty } from 'rxjs/observable/empty' ;
13
13
import { AutofillEvent , AutofillMonitor } from './autofill' ;
14
- import { MatInputModule } from './input -module' ;
14
+ import { TextFieldModule } from './text-field -module' ;
15
15
16
16
17
17
const listenerOptions : any = supportsPassiveEventListeners ( ) ? { passive : true } : false ;
@@ -24,7 +24,7 @@ describe('AutofillMonitor', () => {
24
24
25
25
beforeEach ( ( ) => {
26
26
TestBed . configureTestingModule ( {
27
- imports : [ MatInputModule ] ,
27
+ imports : [ TextFieldModule ] ,
28
28
declarations : [ Inputs ] ,
29
29
} ) . compileComponents ( ) ;
30
30
} ) ;
@@ -52,7 +52,7 @@ describe('AutofillMonitor', () => {
52
52
expect ( inputEl . addEventListener ) . not . toHaveBeenCalled ( ) ;
53
53
54
54
autofillMonitor . monitor ( inputEl ) ;
55
- expect ( inputEl . classList ) . toContain ( 'mat-input -autofill-monitored' ) ;
55
+ expect ( inputEl . classList ) . toContain ( 'cdk-text-field -autofill-monitored' ) ;
56
56
expect ( inputEl . addEventListener )
57
57
. toHaveBeenCalledWith ( 'animationstart' , jasmine . any ( Function ) , listenerOptions ) ;
58
58
} ) ;
@@ -69,11 +69,11 @@ describe('AutofillMonitor', () => {
69
69
it ( 'should remove monitored class and listener upon stop monitoring' , ( ) => {
70
70
const inputEl = testComponent . input1 . nativeElement ;
71
71
autofillMonitor . monitor ( inputEl ) ;
72
- expect ( inputEl . classList ) . toContain ( 'mat-input -autofill-monitored' ) ;
72
+ expect ( inputEl . classList ) . toContain ( 'cdk-text-field -autofill-monitored' ) ;
73
73
expect ( inputEl . removeEventListener ) . not . toHaveBeenCalled ( ) ;
74
74
75
75
autofillMonitor . stopMonitoring ( inputEl ) ;
76
- expect ( inputEl . classList ) . not . toContain ( 'mat-input -autofill-monitored' ) ;
76
+ expect ( inputEl . classList ) . not . toContain ( 'cdk-text-field -autofill-monitored' ) ;
77
77
expect ( inputEl . removeEventListener )
78
78
. toHaveBeenCalledWith ( 'animationstart' , jasmine . any ( Function ) , listenerOptions ) ;
79
79
} ) ;
@@ -103,10 +103,10 @@ describe('AutofillMonitor', () => {
103
103
const autofillStream = autofillMonitor . monitor ( inputEl ) ;
104
104
autofillStream . subscribe ( event => autofillStreamEvent = event ) ;
105
105
expect ( autofillStreamEvent ) . toBeNull ( ) ;
106
- expect ( inputEl . classList ) . not . toContain ( 'mat-input -autofilled' ) ;
106
+ expect ( inputEl . classList ) . not . toContain ( 'cdk-text-field -autofilled' ) ;
107
107
108
- animationStartCallback ( { animationName : 'mat-input -autofill-start' , target : inputEl } ) ;
109
- expect ( inputEl . classList ) . toContain ( 'mat-input -autofilled' ) ;
108
+ animationStartCallback ( { animationName : 'cdk-text-field -autofill-start' , target : inputEl } ) ;
109
+ expect ( inputEl . classList ) . toContain ( 'cdk-text-field -autofilled' ) ;
110
110
expect ( autofillStreamEvent ) . toEqual ( { target : inputEl , isAutofilled : true } as any ) ;
111
111
} ) ;
112
112
@@ -117,12 +117,12 @@ describe('AutofillMonitor', () => {
117
117
inputEl . addEventListener . and . callFake ( ( _ , cb ) => animationStartCallback = cb ) ;
118
118
const autofillStream = autofillMonitor . monitor ( inputEl ) ;
119
119
autofillStream . subscribe ( event => autofillStreamEvent = event ) ;
120
- animationStartCallback ( { animationName : 'mat-input -autofill-start' , target : inputEl } ) ;
121
- expect ( inputEl . classList ) . toContain ( 'mat-input -autofilled' ) ;
120
+ animationStartCallback ( { animationName : 'cdk-text-field -autofill-start' , target : inputEl } ) ;
121
+ expect ( inputEl . classList ) . toContain ( 'cdk-text-field -autofilled' ) ;
122
122
expect ( autofillStreamEvent ) . toEqual ( { target : inputEl , isAutofilled : true } as any ) ;
123
123
124
- animationStartCallback ( { animationName : 'mat-input -autofill-end' , target : inputEl } ) ;
125
- expect ( inputEl . classList ) . not . toContain ( 'mat-input -autofilled' ) ;
124
+ animationStartCallback ( { animationName : 'cdk-text-field -autofill-end' , target : inputEl } ) ;
125
+ expect ( inputEl . classList ) . not . toContain ( 'cdk-text-field -autofilled' ) ;
126
126
expect ( autofillStreamEvent ) . toEqual ( { target : inputEl , isAutofilled : false } as any ) ;
127
127
} ) ;
128
128
@@ -131,11 +131,11 @@ describe('AutofillMonitor', () => {
131
131
let animationStartCallback : Function = ( ) => { } ;
132
132
inputEl . addEventListener . and . callFake ( ( _ , cb ) => animationStartCallback = cb ) ;
133
133
autofillMonitor . monitor ( inputEl ) ;
134
- animationStartCallback ( { animationName : 'mat-input -autofill-start' , target : inputEl } ) ;
135
- expect ( inputEl . classList ) . toContain ( 'mat-input -autofilled' ) ;
134
+ animationStartCallback ( { animationName : 'cdk-text-field -autofill-start' , target : inputEl } ) ;
135
+ expect ( inputEl . classList ) . toContain ( 'cdk-text-field -autofilled' ) ;
136
136
137
137
autofillMonitor . stopMonitoring ( inputEl ) ;
138
- expect ( inputEl . classlist ) . not . toContain ( 'mat-input -autofilled' ) ;
138
+ expect ( inputEl . classlist ) . not . toContain ( 'cdk-text-field -autofilled' ) ;
139
139
} ) ;
140
140
141
141
it ( 'should complete the stream when monitoring is stopped' , ( ) => {
@@ -152,23 +152,23 @@ describe('AutofillMonitor', () => {
152
152
153
153
} ) ;
154
154
155
- describe ( 'matAutofill ' , ( ) => {
155
+ describe ( 'cdkAutofill ' , ( ) => {
156
156
let autofillMonitor : AutofillMonitor ;
157
- let fixture : ComponentFixture < InputWithMatAutofilled > ;
158
- let testComponent : InputWithMatAutofilled ;
157
+ let fixture : ComponentFixture < InputWithCdkAutofilled > ;
158
+ let testComponent : InputWithCdkAutofilled ;
159
159
160
160
beforeEach ( ( ) => {
161
161
TestBed . configureTestingModule ( {
162
- imports : [ MatInputModule ] ,
163
- declarations : [ InputWithMatAutofilled ] ,
162
+ imports : [ TextFieldModule ] ,
163
+ declarations : [ InputWithCdkAutofilled ] ,
164
164
} ) . compileComponents ( ) ;
165
165
} ) ;
166
166
167
167
beforeEach ( inject ( [ AutofillMonitor ] , ( afm : AutofillMonitor ) => {
168
168
autofillMonitor = afm ;
169
169
spyOn ( autofillMonitor , 'monitor' ) . and . returnValue ( observableEmpty ( ) ) ;
170
170
spyOn ( autofillMonitor , 'stopMonitoring' ) ;
171
- fixture = TestBed . createComponent ( InputWithMatAutofilled ) ;
171
+ fixture = TestBed . createComponent ( InputWithCdkAutofilled ) ;
172
172
testComponent = fixture . componentInstance ;
173
173
fixture . detectChanges ( ) ;
174
174
} ) ) ;
@@ -198,8 +198,8 @@ class Inputs {
198
198
}
199
199
200
200
@Component ( {
201
- template : `<input #input matAutofill >`
201
+ template : `<input #input cdkAutofill >`
202
202
} )
203
- class InputWithMatAutofilled {
203
+ class InputWithCdkAutofilled {
204
204
@ViewChild ( 'input' ) input : ElementRef ;
205
205
}
0 commit comments