Skip to content

Commit 9f34ac5

Browse files
committed
test(flex-layout): correct column layout assertion for modern Safari versions
Since Safari 16, the result of setting `flex: 1 1 auto` via style properties is `flex: 1 1 0px;`.
1 parent 6f738c7 commit 9f34ac5

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

projects/libs/flex-layout/flex/flex/flex.spec.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@ import {
2727
FlexStyleBuilder,
2828
} from '@ngbracket/ngx-layout/flex';
2929

30+
function getSafariMajorVersion(): number {
31+
const ua = navigator.userAgent;
32+
const match = /Version\/(\d+)/.exec(ua);
33+
return match ? Number.parseInt(match[1], 10) : 0;
34+
}
35+
3036
describe('flex directive', () => {
3137
let fixture: ComponentFixture<any>;
3238
let mediaController: MockMatchMedia;
@@ -424,15 +430,15 @@ describe('flex directive', () => {
424430
},
425431
styler
426432
);
427-
} else if (platform.FIREFOX || platform.WEBKIT || platform.IOS) {
433+
} else if (platform.FIREFOX) {
428434
expectEl(element).toHaveInlineStyle(
429435
{
430436
flex: '1 1 1e-9px',
431437
'box-sizing': 'border-box',
432438
},
433439
styler
434440
);
435-
} else if (platform.EDGE) {
441+
} else if (platform.EDGE || platform.WEBKIT || platform.IOS) {
436442
expectEl(element).toHaveInlineStyle(
437443
{
438444
flex: '1 1 0px',

0 commit comments

Comments
 (0)