File tree Expand file tree Collapse file tree 3 files changed +32
-0
lines changed
projects/angular/components/ui-suggest/src Expand file tree Collapse file tree 3 files changed +32
-0
lines changed Original file line number Diff line number Diff line change 102102 [matTooltip] ="intl.translateLabel(option.text) "
103103 (removed) ="deselectItem(option) "
104104 class ="chip-selectable ">
105+ < mat-icon *ngIf ="!!option?.icon?.svgIcon "
106+ [svgIcon] ="option!.icon!.svgIcon! "
107+ class ="chip-selectable-icon ">
108+ </ mat-icon >
109+ < mat-icon *ngIf ="!!option?.icon?.matIcon "
110+ class ="chip-selectable-icon ">
111+ {{option?.icon?.matIcon}}
112+ </ mat-icon >
105113 < span >
106114 {{ intl.translateLabel(option.text) }}
107115 </ span >
Original file line number Diff line number Diff line change @@ -205,6 +205,10 @@ $componentName: "ui-suggest";
205205 .mat-chip {
206206 max-width : calc (100% - #{$chips-container-padding * 2 } );
207207
208+ .chip-selectable-icon {
209+ padding-right : $chips-container-padding ;
210+ }
211+
208212 span {
209213 @extend %ellipse ;
210214 }
Original file line number Diff line number Diff line change @@ -1076,6 +1076,26 @@ const sharedSpecifications = (
10761076 component . defaultValue = undefined ;
10771077 } ) ;
10781078
1079+ it ( 'should display icon in value if passed' , fakeAsync ( ( ) => {
1080+ const suggestValue = {
1081+ id : '1' ,
1082+ text : '1' ,
1083+ icon : {
1084+ matIcon : 'close' ,
1085+ } ,
1086+ } ;
1087+
1088+ component . items = [ suggestValue ] ;
1089+ component . value = [ suggestValue ] ;
1090+
1091+ fixture . detectChanges ( ) ;
1092+ tick ( ) ;
1093+
1094+ expect ( fixture . debugElement . query ( By . css ( '.chip-selectable-icon' ) ) ) . toBeTruthy ( ) ;
1095+
1096+ discardPeriodicTasks ( ) ;
1097+ } ) ) ;
1098+
10791099 describe ( 'a11y' , ( ) => {
10801100 a11y . suite ( ( runOptions ) => {
10811101 a11y . it ( 'should have no violations' , async ( ) => {
You can’t perform that action at this time.
0 commit comments