Skip to content

Commit

Permalink
test(material/chips): prevent unintentional test success (#22920)
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
jeripeierSBB committed Jun 9, 2021
1 parent 2f873a8 commit 3cd1f52
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/material-experimental/mdc-chips/chip-input.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ describe('MDC-based MatChipInput', () => {
<mat-form-field>
<mat-chip-grid #chipGrid [required]="required">
<mat-chip-row>Hello</mat-chip-row>
<input matInput [matChipInputFor]="chipGrid"
<input [matChipInputFor]="chipGrid"
[matChipInputAddOnBlur]="addOnBlur"
(matChipInputTokenEnd)="add($event)"
[placeholder]="placeholder" />
Expand Down
2 changes: 1 addition & 1 deletion src/material/chips/chip-input.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ describe('MatChipInput', () => {
<mat-form-field>
<mat-chip-list #chipList [required]="required">
<mat-chip>Hello</mat-chip>
<input matInput [matChipInputFor]="chipList"
<input [matChipInputFor]="chipList"
[matChipInputAddOnBlur]="addOnBlur"
(matChipInputTokenEnd)="add($event)"
[placeholder]="placeholder" />
Expand Down

0 comments on commit 3cd1f52

Please sign in to comment.