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

Commit 1a3029f

Browse files
committed
fix(fxFlex): apply correct flex-basis stylings
* Fix for when flex-basis is unitless and 0 * Fix for when no width/height is applied and flex-basis should be set * Fix for IE flex-basis with calc values * Fix for SSR properties set to 0 Fixes #277 Fixes #280 Fixes #323 Fixes #528 Fixes #534
1 parent b525771 commit 1a3029f

File tree

5 files changed

+401
-101
lines changed

5 files changed

+401
-101
lines changed

src/lib/api/flexbox/flex-offset.spec.ts

+26-6
Original file line numberDiff line numberDiff line change
@@ -72,21 +72,39 @@ describe('flex-offset directive', () => {
7272
let dom = fixture.debugElement.children[0];
7373
expectEl(dom).toHaveStyle({'margin-left': '32px'}, styler);
7474
if (platform.BLINK) {
75-
expectEl(dom).toHaveStyle({'flex': '1 1 1e-09px'}, styler);
75+
expectEl(dom).toHaveStyle({
76+
'flex-grow': '1',
77+
'flex-shrink': '1',
78+
'flex-basis': '1e-09px'
79+
}, styler);
7680
} else if (platform.FIREFOX) {
77-
expectEl(dom).toHaveStyle({'flex': '1 1 1e-9px'}, styler);
81+
expectEl(dom).toHaveStyle({
82+
'flex-grow': '1',
83+
'flex-shrink': '1',
84+
'flex-basis': '1e-9px'
85+
}, styler);
7886
} else if (platform.EDGE || platform.TRIDENT) {
79-
expectEl(dom).toHaveStyle({'flex': '1 1 0px'}, styler);
87+
expectEl(dom).toHaveStyle({
88+
'flex-grow': '1',
89+
'flex-shrink': '1',
90+
'flex-basis': '0px'
91+
}, styler);
8092
} else {
81-
expectEl(dom).toHaveStyle({'flex': '1 1 0.000000001px'}, styler);
93+
expectEl(dom).toHaveStyle({
94+
'flex-grow': '1',
95+
'flex-shrink': '1',
96+
'flex-basis': '0.000000001px'
97+
}, styler);
8298
}
8399
});
84100

85101

86102
it('should work with percentage values', () => {
87103
componentWithTemplate(`<div fxFlexOffset='17' fxFlex='37'></div>`);
88104
expectNativeEl(fixture).toHaveStyle({
89-
'flex': '1 1 100%',
105+
'flex-grow': '1',
106+
'flex-shrink': '1',
107+
'flex-basis': '100%',
90108
'box-sizing': 'border-box',
91109
'margin-left': '17%'
92110
}, styler);
@@ -153,7 +171,9 @@ describe('flex-offset directive', () => {
153171
`);
154172
expectNativeEl(fixture).not.toHaveStyle({
155173
'flex-direction': 'row',
156-
'flex': '1 1 100%',
174+
'flex-grow': '1',
175+
'flex-shrink': '1',
176+
'flex-basis': '100%',
157177
'margin-left': '52px',
158178
}, styler);
159179
});

0 commit comments

Comments
 (0)