From 1c5443175cf55addb63ee04a00a0939e9bbb0db6 Mon Sep 17 00:00:00 2001 From: Ben Alpert Date: Fri, 21 Nov 2014 02:23:46 -0800 Subject: [PATCH] Add example for how to use `style` properly Test Plan: jest --- src/browser/ui/ReactDOMComponent.js | 3 ++- src/browser/ui/__tests__/ReactDOMComponent-test.js | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/browser/ui/ReactDOMComponent.js b/src/browser/ui/ReactDOMComponent.js index 42a044d15d..0a6f60e14a 100644 --- a/src/browser/ui/ReactDOMComponent.js +++ b/src/browser/ui/ReactDOMComponent.js @@ -69,7 +69,8 @@ function assertValidProps(props) { invariant( props.style == null || typeof props.style === 'object', 'The `style` prop expects a mapping from style properties to values, ' + - 'not a string.' + 'not a string. For example, style={{marginRight: spacing + \'em\'}} when ' + + 'using JSX.' ); } diff --git a/src/browser/ui/__tests__/ReactDOMComponent-test.js b/src/browser/ui/__tests__/ReactDOMComponent-test.js index 7bb8e24650..aa557c662d 100644 --- a/src/browser/ui/__tests__/ReactDOMComponent-test.js +++ b/src/browser/ui/__tests__/ReactDOMComponent-test.js @@ -353,7 +353,8 @@ describe('ReactDOMComponent', function() { mountComponent({ style: 'display: none' }); }).toThrow( 'Invariant Violation: The `style` prop expects a mapping from style ' + - 'properties to values, not a string.' + 'properties to values, not a string. For example, ' + + 'style={{marginRight: spacing + \'em\'}} when using JSX.' ); }); }); @@ -398,7 +399,8 @@ describe('ReactDOMComponent', function() { React.render(
, container); }).toThrow( 'Invariant Violation: The `style` prop expects a mapping from style ' + - 'properties to values, not a string.' + 'properties to values, not a string. For example, ' + + 'style={{marginRight: spacing + \'em\'}} when using JSX.' ); }); });