@@ -18,27 +18,27 @@ describe('MatButton', () => {
18
18
19
19
// General button tests
20
20
it ( 'should apply class based on color attribute' , ( ) => {
21
- let fixture = TestBed . createComponent ( TestApp ) ;
21
+ const fixture = TestBed . createComponent ( TestApp ) ;
22
22
23
- let testComponent = fixture . debugElement . componentInstance ;
24
- let buttonDebugElement = fixture . debugElement . query ( By . css ( 'button' ) ) ! ;
25
- let aDebugElement = fixture . debugElement . query ( By . css ( 'a' ) ) ! ;
23
+ const testComponent = fixture . debugElement . componentInstance ;
24
+ const buttonDebugElement = fixture . debugElement . query ( By . css ( 'button' ) ) ! ;
25
+ const attributeDebugElement = fixture . debugElement . query ( By . css ( 'a' ) ) ! ;
26
26
27
27
testComponent . buttonColor = 'primary' ;
28
28
fixture . detectChanges ( ) ;
29
29
expect ( buttonDebugElement . nativeElement . classList . contains ( 'mat-primary' ) ) . toBe ( true ) ;
30
- expect ( aDebugElement . nativeElement . classList . contains ( 'mat-primary' ) ) . toBe ( true ) ;
30
+ expect ( attributeDebugElement . nativeElement . classList . contains ( 'mat-primary' ) ) . toBe ( true ) ;
31
31
32
32
testComponent . buttonColor = 'accent' ;
33
33
fixture . detectChanges ( ) ;
34
34
expect ( buttonDebugElement . nativeElement . classList . contains ( 'mat-accent' ) ) . toBe ( true ) ;
35
- expect ( aDebugElement . nativeElement . classList . contains ( 'mat-accent' ) ) . toBe ( true ) ;
35
+ expect ( attributeDebugElement . nativeElement . classList . contains ( 'mat-accent' ) ) . toBe ( true ) ;
36
36
37
37
testComponent . buttonColor = null ;
38
38
fixture . detectChanges ( ) ;
39
39
40
40
expect ( buttonDebugElement . nativeElement . classList ) . not . toContain ( 'mat-accent' ) ;
41
- expect ( aDebugElement . nativeElement . classList ) . not . toContain ( 'mat-accent' ) ;
41
+ expect ( attributeDebugElement . nativeElement . classList ) . not . toContain ( 'mat-accent' ) ;
42
42
} ) ;
43
43
44
44
it ( 'should expose the ripple instance' , ( ) => {
@@ -50,9 +50,9 @@ describe('MatButton', () => {
50
50
} ) ;
51
51
52
52
it ( 'should not clear previous defined classes' , ( ) => {
53
- let fixture = TestBed . createComponent ( TestApp ) ;
54
- let testComponent = fixture . debugElement . componentInstance ;
55
- let buttonDebugElement = fixture . debugElement . query ( By . css ( 'button' ) ) ! ;
53
+ const fixture = TestBed . createComponent ( TestApp ) ;
54
+ const testComponent = fixture . debugElement . componentInstance ;
55
+ const buttonDebugElement = fixture . debugElement . query ( By . css ( 'button' ) ) ! ;
56
56
57
57
buttonDebugElement . nativeElement . classList . add ( 'custom-class' ) ;
58
58
@@ -128,18 +128,18 @@ describe('MatButton', () => {
128
128
// Regular button tests
129
129
describe ( 'button[mat-button]' , ( ) => {
130
130
it ( 'should handle a click on the button' , ( ) => {
131
- let fixture = TestBed . createComponent ( TestApp ) ;
132
- let testComponent = fixture . debugElement . componentInstance ;
133
- let buttonDebugElement = fixture . debugElement . query ( By . css ( 'button' ) ) ! ;
131
+ const fixture = TestBed . createComponent ( TestApp ) ;
132
+ const testComponent = fixture . debugElement . componentInstance ;
133
+ const buttonDebugElement = fixture . debugElement . query ( By . css ( 'button' ) ) ! ;
134
134
135
135
buttonDebugElement . nativeElement . click ( ) ;
136
136
expect ( testComponent . clickCount ) . toBe ( 1 ) ;
137
137
} ) ;
138
138
139
139
it ( 'should not increment if disabled' , ( ) => {
140
- let fixture = TestBed . createComponent ( TestApp ) ;
141
- let testComponent = fixture . debugElement . componentInstance ;
142
- let buttonDebugElement = fixture . debugElement . query ( By . css ( 'button' ) ) ! ;
140
+ const fixture = TestBed . createComponent ( TestApp ) ;
141
+ const testComponent = fixture . debugElement . componentInstance ;
142
+ const buttonDebugElement = fixture . debugElement . query ( By . css ( 'button' ) ) ! ;
143
143
144
144
testComponent . isDisabled = true ;
145
145
fixture . detectChanges ( ) ;
@@ -150,8 +150,8 @@ describe('MatButton', () => {
150
150
} ) ;
151
151
152
152
it ( 'should disable the native button element' , ( ) => {
153
- let fixture = TestBed . createComponent ( TestApp ) ;
154
- let buttonNativeElement = fixture . nativeElement . querySelector ( 'button' ) ;
153
+ const fixture = TestBed . createComponent ( TestApp ) ;
154
+ const buttonNativeElement = fixture . nativeElement . querySelector ( 'button' ) ;
155
155
expect ( buttonNativeElement . disabled ) . toBeFalsy ( 'Expected button not to be disabled' ) ;
156
156
157
157
fixture . componentInstance . isDisabled = true ;
@@ -164,9 +164,9 @@ describe('MatButton', () => {
164
164
// Anchor button tests
165
165
describe ( 'a[mat-button]' , ( ) => {
166
166
it ( 'should not redirect if disabled' , ( ) => {
167
- let fixture = TestBed . createComponent ( TestApp ) ;
168
- let testComponent = fixture . debugElement . componentInstance ;
169
- let buttonDebugElement = fixture . debugElement . query ( By . css ( 'a' ) ) ! ;
167
+ const fixture = TestBed . createComponent ( TestApp ) ;
168
+ const testComponent = fixture . debugElement . componentInstance ;
169
+ const buttonDebugElement = fixture . debugElement . query ( By . css ( 'a' ) ) ! ;
170
170
171
171
testComponent . isDisabled = true ;
172
172
fixture . detectChanges ( ) ;
@@ -175,9 +175,9 @@ describe('MatButton', () => {
175
175
} ) ;
176
176
177
177
it ( 'should remove tabindex if disabled' , ( ) => {
178
- let fixture = TestBed . createComponent ( TestApp ) ;
179
- let testComponent = fixture . debugElement . componentInstance ;
180
- let buttonDebugElement = fixture . debugElement . query ( By . css ( 'a' ) ) ! ;
178
+ const fixture = TestBed . createComponent ( TestApp ) ;
179
+ const testComponent = fixture . debugElement . componentInstance ;
180
+ const buttonDebugElement = fixture . debugElement . query ( By . css ( 'a' ) ) ! ;
181
181
expect ( buttonDebugElement . nativeElement . getAttribute ( 'tabIndex' ) ) . toBe ( null ) ;
182
182
183
183
testComponent . isDisabled = true ;
@@ -186,9 +186,9 @@ describe('MatButton', () => {
186
186
} ) ;
187
187
188
188
it ( 'should add aria-disabled attribute if disabled' , ( ) => {
189
- let fixture = TestBed . createComponent ( TestApp ) ;
190
- let testComponent = fixture . debugElement . componentInstance ;
191
- let buttonDebugElement = fixture . debugElement . query ( By . css ( 'a' ) ) ! ;
189
+ const fixture = TestBed . createComponent ( TestApp ) ;
190
+ const testComponent = fixture . debugElement . componentInstance ;
191
+ const buttonDebugElement = fixture . debugElement . query ( By . css ( 'a' ) ) ! ;
192
192
fixture . detectChanges ( ) ;
193
193
expect ( buttonDebugElement . nativeElement . getAttribute ( 'aria-disabled' ) ) . toBe ( 'false' ) ;
194
194
@@ -198,9 +198,9 @@ describe('MatButton', () => {
198
198
} ) ;
199
199
200
200
it ( 'should not add aria-disabled attribute if disabled is false' , ( ) => {
201
- let fixture = TestBed . createComponent ( TestApp ) ;
202
- let testComponent = fixture . debugElement . componentInstance ;
203
- let buttonDebugElement = fixture . debugElement . query ( By . css ( 'a' ) ) ! ;
201
+ const fixture = TestBed . createComponent ( TestApp ) ;
202
+ const testComponent = fixture . debugElement . componentInstance ;
203
+ const buttonDebugElement = fixture . debugElement . query ( By . css ( 'a' ) ) ! ;
204
204
fixture . detectChanges ( ) ;
205
205
expect ( buttonDebugElement . nativeElement . getAttribute ( 'aria-disabled' ) )
206
206
. toBe ( 'false' , 'Expect aria-disabled="false"' ) ;
@@ -216,9 +216,9 @@ describe('MatButton', () => {
216
216
} ) ;
217
217
218
218
it ( 'should be able to set a custom tabindex' , ( ) => {
219
- let fixture = TestBed . createComponent ( TestApp ) ;
220
- let testComponent = fixture . debugElement . componentInstance ;
221
- let buttonElement = fixture . debugElement . query ( By . css ( 'a' ) ) ! . nativeElement ;
219
+ const fixture = TestBed . createComponent ( TestApp ) ;
220
+ const testComponent = fixture . debugElement . componentInstance ;
221
+ const buttonElement = fixture . debugElement . query ( By . css ( 'a' ) ) ! . nativeElement ;
222
222
223
223
fixture . componentInstance . tabIndex = 3 ;
224
224
fixture . detectChanges ( ) ;
0 commit comments