Skip to content

Commit c27854b

Browse files
authored
Merge pull request #675 from rofrischmann/feature/allow-empty-style-prop-in-felaComponent
feat(FelaComponent): Allow style prop with empty value
2 parents 664db27 + 8825ccc commit c27854b

3 files changed

Lines changed: 19 additions & 6 deletions

File tree

packages/fela-bindings/src/FelaComponentFactory.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,6 @@ export default function FelaComponentFactory(
3434
'The `render` prop in FelaComponent is deprecated. It will be removed in react-fela@11.0.0.\nPlease always use `children` instead. See http://fela.js.org/docs/api/bindings/fela-component'
3535
)
3636

37-
if (!style) {
38-
throw new Error(
39-
'A valid `style` prop must be passed to FelaComponent in order to render.\nSee http://fela.js.org/docs/api/bindings/fela-component'
40-
)
41-
}
42-
4337
const renderFn = renderer =>
4438
createElement(FelaTheme, undefined, theme => {
4539
// TODO: could optimise perf by not calling combineRules if not neccessary

packages/fela-integration/src/jest-react-fela_react-fela/__tests__/FelaComponent-test.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,4 +219,16 @@ describe('Using the FelaComponent component', () => {
219219
)
220220
).toMatchSnapshot()
221221
})
222+
223+
it('should render without style', () => {
224+
expect(
225+
createSnapshot(
226+
<FelaComponent>
227+
{({ className }) => (
228+
<div className={className}>I am an unstyled div</div>
229+
)}
230+
</FelaComponent>
231+
)
232+
).toMatchSnapshot()
233+
})
222234
})

packages/fela-integration/src/jest-react-fela_react-fela/__tests__/__snapshots__/FelaComponent-test.js.snap

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,3 +169,10 @@ exports[`Using the FelaComponent component should render children using the corr
169169
<h1 className=a b>Hello World</h1>;
170170
"
171171
`;
172+
173+
exports[`Using the FelaComponent component should render without style 1`] = `
174+
"
175+
176+
<div className>I am an unstyled div</div>;
177+
"
178+
`;

0 commit comments

Comments
 (0)