@@ -784,6 +784,21 @@ describe('MatMdcInput without forms', () => {
784784 expect ( iconSuffixEl . nativeElement . innerText . trim ( ) ) . toEqual ( 'favorite' ) ;
785785 } ) ) ;
786786
787+ it ( 'should allow ng-container as prefix and suffix' , ( ) => {
788+ const fixture = createComponent ( InputWithNgContainerPrefixAndSuffix ) ;
789+ fixture . detectChanges ( ) ;
790+
791+ const textPrefixEl = fixture . debugElement . query ( By . css ( '.mat-mdc-form-field-text-prefix' ) ) ! ;
792+ const textSuffixEl = fixture . debugElement . query ( By . css ( '.mat-mdc-form-field-text-suffix' ) ) ! ;
793+ const iconPrefixEl = fixture . debugElement . query ( By . css ( '.mat-mdc-form-field-icon-prefix' ) ) ! ;
794+ const iconSuffixEl = fixture . debugElement . query ( By . css ( '.mat-mdc-form-field-icon-suffix' ) ) ! ;
795+
796+ expect ( textPrefixEl . nativeElement . innerText . trim ( ) ) . toEqual ( 'text-prefix' ) ;
797+ expect ( textSuffixEl . nativeElement . innerText . trim ( ) ) . toEqual ( 'text-suffix' ) ;
798+ expect ( iconPrefixEl . nativeElement . innerText . trim ( ) ) . toEqual ( 'icon-prefix' ) ;
799+ expect ( iconSuffixEl . nativeElement . innerText . trim ( ) ) . toEqual ( 'icon-suffix' ) ;
800+ } ) ;
801+
787802 it ( 'should update empty class when value changes programmatically and OnPush' , fakeAsync ( ( ) => {
788803 let fixture = createComponent ( MatInputOnPush ) ;
789804 fixture . detectChanges ( ) ;
@@ -2064,3 +2079,16 @@ class MatInputWithRequiredFormControl {
20642079 ` ,
20652080} )
20662081class MatInputSimple { }
2082+
2083+ @Component ( {
2084+ template : `
2085+ <mat-form-field>
2086+ <ng-container matIconPrefix>icon-prefix</ng-container>
2087+ <ng-container matTextPrefix>text-prefix</ng-container>
2088+ <input matInput>
2089+ <ng-container matTextSuffix>text-suffix</ng-container>
2090+ <ng-container matIconSuffix>icon-suffix</ng-container>
2091+ </mat-form-field>
2092+ ` ,
2093+ } )
2094+ class InputWithNgContainerPrefixAndSuffix { }
0 commit comments