Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix obscure error message when passing an invalid style value for SSR #11173

Merged
merged 7 commits into from
Oct 10, 2017
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,15 @@ describe('ReactDOMServer', () => {
'Objects are not valid as a React child (found: object with keys {x})',
);
});

it('should throw prop mapping error for an <iframe /> with invalid props', () => {
expect(() =>
ReactDOMServer.renderToString(<iframe style="border:none;" />),
).toThrowError(
'The `style` prop expects a mapping from style properties to values, not ' +
"a string. For example, style={{marginRight: spacing + 'em'}} when using JSX.",
);
});
});

describe('renderToStaticMarkup', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/renderers/shared/server/ReactPartialRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -780,7 +780,7 @@ class ReactDOMServerRenderer {
validatePropertiesInDevelopment(tag, props);
}

assertValidProps(tag, props);
assertValidProps(tag, props, () => null);

var out = createOpenTagMarkup(
element.type,
Expand Down