Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(fxFlex): restore correct styles after fxLayoutAlign is applied #1038

Merged
merged 2 commits into from
Mar 17, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/lib/flex/flex/flex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,9 @@ export class FlexDirective extends BaseDirective2 {
this.marshal.trackValue(this.parentElement, 'layout')
.pipe(takeUntil(this.destroySubject))
.subscribe(this.onLayoutChange.bind(this));
this.marshal.trackValue(this.nativeElement, 'layout-align')
.pipe(takeUntil(this.destroySubject))
.subscribe(this.triggerReflow.bind(this));
}
}

Expand Down
22 changes: 22 additions & 0 deletions src/lib/flex/layout-align/layout-align.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,28 @@ describe('layout-align directive', () => {
}, styler);
});

it('should add responsive styles with fxFlex', () => {
createTestComponent(`
<div fxFlex.gt-sm="25%" fxFlex.lt-md="100%" fxLayoutAlign="center end"></div>
`);

expectNativeEl(fixture).not.toHaveStyle({
'max-width': '25%',
}, styler);

mediaController.activate('md', true);

expectNativeEl(fixture).toHaveStyle({
'max-width': '25%',
}, styler);

mediaController.activate('sm', true);

expectNativeEl(fixture).not.toHaveStyle({
'max-width': '25%',
}, styler);
});

it('should update responsive styles when the layout direction changes', () => {
createTestComponent(`
<div fxLayout
Expand Down