@@ -43,6 +43,8 @@ import {By} from '@angular/platform-browser';
4343import { BrowserAnimationsModule } from '@angular/platform-browser/animations' ;
4444import { MatStepperModule } from '@angular/material/stepper' ;
4545import { MatTabsModule } from '@angular/material/tabs' ;
46+ import { Directionality , Direction } from '@angular/cdk/bidi' ;
47+ import { Subject } from 'rxjs' ;
4648import { MatInputModule , MatInput , MAT_INPUT_VALUE_ACCESSOR } from './index' ;
4749import { MatTextareaAutosize } from './autosize' ;
4850
@@ -1391,6 +1393,34 @@ describe('MatInput with appearance', () => {
13911393 expect ( parseInt ( outlineGap . style . width ) ) . toBeGreaterThan ( 0 ) ;
13921394 } ) ) ;
13931395
1396+ it ( 'should update the outline gap if the direction changes' , fakeAsync ( ( ) => {
1397+ fixture . destroy ( ) ;
1398+ TestBed . resetTestingModule ( ) ;
1399+
1400+ const fakeDirectionality = { change : new Subject < Direction > ( ) , value : 'ltr' } ;
1401+ const outlineFixture = createComponent ( MatInputWithAppearanceAndLabel , [ {
1402+ provide : Directionality ,
1403+ useValue : fakeDirectionality
1404+ } ] ) ;
1405+
1406+ outlineFixture . componentInstance . appearance = 'outline' ;
1407+ outlineFixture . detectChanges ( ) ;
1408+ flush ( ) ;
1409+ outlineFixture . detectChanges ( ) ;
1410+
1411+ spyOn ( outlineFixture . componentInstance . formField , 'updateOutlineGap' ) ;
1412+
1413+ fakeDirectionality . value = 'rtl' ;
1414+ fakeDirectionality . change . next ( 'rtl' ) ;
1415+ outlineFixture . detectChanges ( ) ;
1416+ flush ( ) ;
1417+ outlineFixture . detectChanges ( ) ;
1418+
1419+ expect ( outlineFixture . componentInstance . formField . updateOutlineGap ) . toHaveBeenCalled ( ) ;
1420+ } ) ) ;
1421+
1422+
1423+
13941424} ) ;
13951425
13961426describe ( 'MatFormField default options' , ( ) => {
0 commit comments