Skip to content

Commit

Permalink
fix(lib): read correct styles during SSR and add test for layout-wrap
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
CaerusKaru authored and ThomasBurleson committed Feb 1, 2018
1 parent 1b6101e commit 71e2dae
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions src/lib/api/flexbox/layout.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,13 @@ describe('layout directive', () => {
});
});

it('should have valid wrap with flex children', () => {
createTestComponent(`<div fxLayout='row wrap'><div fxFlex></div></div>`);
expectNativeEl(fixture).toHaveStyle({
'flex-wrap': 'wrap'
});
});

});

describe('with inline options', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/utils/style-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand Down

0 comments on commit 71e2dae

Please sign in to comment.