@@ -351,6 +351,21 @@ describe('Row Chips', () => {
351
351
} ) ) ;
352
352
} ) ;
353
353
354
+ describe ( 'with edit icon' , ( ) => {
355
+ beforeEach ( async ( ) => {
356
+ testComponent . showEditIcon = true ;
357
+ fixture . changeDetectorRef . markForCheck ( ) ;
358
+ fixture . detectChanges ( ) ;
359
+ } ) ;
360
+
361
+ it ( 'should begin editing on edit click' , ( ) => {
362
+ expect ( chipNativeElement . querySelector ( '.mat-chip-edit-input' ) ) . toBeFalsy ( ) ;
363
+ dispatchFakeEvent ( chipNativeElement . querySelector ( '.mat-mdc-chip-edit' ) ! , 'click' ) ;
364
+ fixture . detectChanges ( ) ;
365
+ expect ( chipNativeElement . querySelector ( '.mat-chip-edit-input' ) ) . toBeTruthy ( ) ;
366
+ } ) ;
367
+ } ) ;
368
+
354
369
describe ( 'a11y' , ( ) => {
355
370
it ( 'should apply `ariaLabel` and `ariaDesciption` to the primary gridcell' , ( ) => {
356
371
fixture . componentInstance . ariaLabel = 'chip name' ;
@@ -403,6 +418,9 @@ describe('Row Chips', () => {
403
418
(destroyed)="chipDestroy($event)"
404
419
(removed)="chipRemove($event)" (edited)="chipEdit($event)"
405
420
[aria-label]="ariaLabel" [aria-description]="ariaDescription">
421
+ @if (showEditIcon) {
422
+ <button matChipEdit>edit</button>
423
+ }
406
424
{{name}}
407
425
<button matChipRemove>x</button>
408
426
@if (useCustomEditInput) {
@@ -424,6 +442,7 @@ class SingleChip {
424
442
removable : boolean = true ;
425
443
shouldShow : boolean = true ;
426
444
editable : boolean = false ;
445
+ showEditIcon : boolean = false ;
427
446
useCustomEditInput : boolean = true ;
428
447
ariaLabel : string | null = null ;
429
448
ariaDescription : string | null = null ;
0 commit comments