Skip to content

Commit 3cd1f52

Browse files
authored
test(material/chips): prevent unintentional test success (#22920)
In 'MatChipInput' test, `MatInputModule` was not imported and therefore the `matInput` directive was not interpreted. If importing `MatInputModule` into the testing module, the `matInput` directive gets applied and the test 'MatChipInput basic behavior should be aria-required if the list is required' would fail because of side effects by setting the `aria-required` attribute. Obviously, `matInput` does not remove the `aria-required` attribute, while the chips implementation is doing so (chips is interpreting false as null, while `matInput` leaves 'false' as-is).
1 parent 2f873a8 commit 3cd1f52

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/material-experimental/mdc-chips/chip-input.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ describe('MDC-based MatChipInput', () => {
238238
<mat-form-field>
239239
<mat-chip-grid #chipGrid [required]="required">
240240
<mat-chip-row>Hello</mat-chip-row>
241-
<input matInput [matChipInputFor]="chipGrid"
241+
<input [matChipInputFor]="chipGrid"
242242
[matChipInputAddOnBlur]="addOnBlur"
243243
(matChipInputTokenEnd)="add($event)"
244244
[placeholder]="placeholder" />

src/material/chips/chip-input.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ describe('MatChipInput', () => {
247247
<mat-form-field>
248248
<mat-chip-list #chipList [required]="required">
249249
<mat-chip>Hello</mat-chip>
250-
<input matInput [matChipInputFor]="chipList"
250+
<input [matChipInputFor]="chipList"
251251
[matChipInputAddOnBlur]="addOnBlur"
252252
(matChipInputTokenEnd)="add($event)"
253253
[placeholder]="placeholder" />

0 commit comments

Comments
 (0)