@@ -43,6 +43,8 @@ import {By} from '@angular/platform-browser';
43
43
import { BrowserAnimationsModule } from '@angular/platform-browser/animations' ;
44
44
import { MatStepperModule } from '@angular/material/stepper' ;
45
45
import { MatTabsModule } from '@angular/material/tabs' ;
46
+ import { Directionality , Direction } from '@angular/cdk/bidi' ;
47
+ import { Subject } from 'rxjs' ;
46
48
import { MatInputModule , MatInput , MAT_INPUT_VALUE_ACCESSOR } from './index' ;
47
49
import { MatTextareaAutosize } from './autosize' ;
48
50
@@ -1391,6 +1393,34 @@ describe('MatInput with appearance', () => {
1391
1393
expect ( parseInt ( outlineGap . style . width ) ) . toBeGreaterThan ( 0 ) ;
1392
1394
} ) ) ;
1393
1395
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
+
1394
1424
} ) ;
1395
1425
1396
1426
describe ( 'MatFormField default options' , ( ) => {
0 commit comments