From 003e6a4690b276a41dac69e00c6531d07f8f12a1 Mon Sep 17 00:00:00 2001 From: Adam Plumer Date: Wed, 31 Jan 2018 11:45:06 -0500 Subject: [PATCH] fix(lib): read correct styles during SSR and add test for layout-wrap * Domino can be stupid about parsing styles on the server, so add an additional inline style read for the property value * Add a test case for nested flex children when parent uses layout wrap. This will be useful when adding SSR testing mode to ensure this case is accounted for in the future --- src/lib/api/flexbox/layout.spec.ts | 7 +++++++ src/lib/utils/style-utils.ts | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/lib/api/flexbox/layout.spec.ts b/src/lib/api/flexbox/layout.spec.ts index 5c72e98df..c5b9ace50 100644 --- a/src/lib/api/flexbox/layout.spec.ts +++ b/src/lib/api/flexbox/layout.spec.ts @@ -167,6 +167,13 @@ describe('layout directive', () => { }); }); + it('should have valid wrap with flex children', () => { + createTestComponent(`
`); + expectNativeEl(fixture).toHaveStyle({ + 'flex-wrap': 'wrap' + }); + }); + }); describe('with inline options', () => { diff --git a/src/lib/utils/style-utils.ts b/src/lib/utils/style-utils.ts index 37049296b..255c8be4c 100644 --- a/src/lib/utils/style-utils.ts +++ b/src/lib/utils/style-utils.ts @@ -72,7 +72,7 @@ export function lookupAttributeValue(element: HTMLElement, attribute: string): s * Find the DOM element's inline style value (if any) */ export function lookupInlineStyle(element: HTMLElement, styleName: string): string { - return element.style[styleName]; + return element.style[styleName] || element.style.getPropertyValue(styleName); } /**