Skip to content
This repository was archived by the owner on Jan 6, 2025. It is now read-only.

Commit 76d14b7

Browse files
CaerusKaruThomasBurleson
authored andcommitted
fix(fxFlex): enable parent flex styles by default
1 parent 93871d6 commit 76d14b7

File tree

5 files changed

+22
-11
lines changed

5 files changed

+22
-11
lines changed

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,4 +127,4 @@
127127
"typescript": "~2.6.2",
128128
"uglify-js": "^2.8.14"
129129
}
130-
}
130+
}

src/lib/core/module.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import {MATCH_MEDIA_PROVIDER} from './match-media/match-media-provider';
1515
import {BROWSER_PROVIDER} from './browser-provider';
1616
import {StyleUtils} from './style-utils/style-utils';
1717
import {STYLESHEET_MAP_PROVIDER} from './stylesheet-map/stylesheet-map-provider';
18+
import {FLEX_STYLES_PROVIDER} from './tokens/flex-styles-token';
1819

1920
/**
2021
* *****************************************************************
@@ -32,6 +33,7 @@ import {STYLESHEET_MAP_PROVIDER} from './stylesheet-map/stylesheet-map-provider'
3233
STYLESHEET_MAP_PROVIDER,
3334
StyleUtils,
3435
BROWSER_PROVIDER,
36+
FLEX_STYLES_PROVIDER,
3537
]
3638
})
3739
export class CoreModule {

src/lib/core/tokens/flex-styles-token.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,12 @@ import {InjectionToken} from '@angular/core';
99

1010
export const ADD_FLEX_STYLES = new InjectionToken<boolean>(
1111
'Flex Layout token, should flex stylings be applied to parents automatically');
12+
13+
/**
14+
* @deprecated
15+
* @deletion-target v6.0.0-beta.15
16+
*/
17+
export const FLEX_STYLES_PROVIDER = {
18+
provide: ADD_FLEX_STYLES,
19+
useValue: true
20+
};

src/lib/flex/flex/flex.spec.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ describe('flex directive', () => {
219219
}
220220
});
221221

222-
it('should not work with non-direct-parent fxLayouts', async(() => {
222+
it('should work with non-direct-parent fxLayouts', async(() => {
223223
componentWithTemplate(`
224224
<div fxLayout='column'>
225225
<div class='test'>
@@ -235,7 +235,7 @@ describe('flex directive', () => {
235235
// The parent flex-direction not found;
236236
// A flex-direction should have been auto-injected to the parent...
237237
// fallback to 'row' and set child width styles accordingly
238-
expectEl(parent).not.toHaveStyle({'flex-direction': 'row'}, styler);
238+
expectEl(parent).toHaveStyle({'flex-direction': 'row'}, styler);
239239
expectEl(element).toHaveStyle({'min-width': '40px'}, styler);
240240
expectEl(element).not.toHaveStyle({'min-height': '40px'}, styler);
241241
});
@@ -686,7 +686,7 @@ describe('flex directive', () => {
686686
);
687687
});
688688

689-
describe('with flex token enabled', () => {
689+
describe('with flex token disabled', () => {
690690
beforeEach(() => {
691691
jasmine.addMatchers(customMatchers);
692692

@@ -697,7 +697,7 @@ describe('flex directive', () => {
697697
providers: [
698698
MockMatchMediaProvider,
699699
{provide: SERVER_TOKEN, useValue: true},
700-
{provide: ADD_FLEX_STYLES, useValue: true},
700+
{provide: ADD_FLEX_STYLES, useValue: false},
701701
]
702702
});
703703
});
@@ -718,7 +718,7 @@ describe('flex directive', () => {
718718
// The parent flex-direction not found;
719719
// A flex-direction should have been auto-injected to the parent...
720720
// fallback to 'row' and set child width styles accordingly
721-
expectEl(parent).toHaveStyle({'flex-direction': 'row'}, styler);
721+
expectEl(parent).not.toHaveStyle({'flex-direction': 'row'}, styler);
722722
expectEl(element).toHaveStyle({'min-width': '40px'}, styler);
723723
expectEl(element).not.toHaveStyle({'min-height': '40px'}, styler);
724724
});
@@ -758,7 +758,7 @@ describe('flex directive', () => {
758758
// The parent flex-direction not found;
759759
// A flex-direction should have been auto-injected to the parent...
760760
// fallback to 'row' and set child width styles accordingly
761-
expectEl(parent).not.toHaveStyle({'-webkit-flex-direction': 'row'}, styler);
761+
expect(parent.nativeElement.getAttribute('style')).not.toContain('-webkit-flex-direction');
762762
expectEl(element).toHaveStyle({'min-width': '40px'}, styler);
763763
expectEl(element).not.toHaveStyle({'min-height': '40px'}, styler);
764764
});

0 commit comments

Comments
 (0)