From 33088dc2b204724b5242a2a374a171401c5c0d36 Mon Sep 17 00:00:00 2001 From: lttb Date: Fri, 2 Mar 2018 05:32:20 +0300 Subject: [PATCH] Fix function values in composition --- .../__snapshots__/functional.spec.jsx.snap | 3 + src/tests/functional.spec.jsx | 15 ++--- src/types/index.js | 2 +- src/utils/getSeparatedStyles.js | 59 ++++++++++++------- 4 files changed, 49 insertions(+), 30 deletions(-) diff --git a/src/tests/__snapshots__/functional.spec.jsx.snap b/src/tests/__snapshots__/functional.spec.jsx.snap index b9e9fa3..14ca18e 100644 --- a/src/tests/__snapshots__/functional.spec.jsx.snap +++ b/src/tests/__snapshots__/functional.spec.jsx.snap @@ -135,6 +135,7 @@ exports[`functional tests composable styles should merge and compose all styles padding: 20px; } .button-2-id { + font-weight: 400; border-radius: 100%; color: red; background-color: green; @@ -147,9 +148,11 @@ exports[`functional tests composable styles should merge and compose all styles padding: 20px; } .button-2-id { + font-weight: 400; border-radius: 100%; color: black; background-color: white; + font-size: 15px; }" `; diff --git a/src/tests/functional.spec.jsx b/src/tests/functional.spec.jsx index 894ced8..bac6321 100644 --- a/src/tests/functional.spec.jsx +++ b/src/tests/functional.spec.jsx @@ -281,11 +281,11 @@ describe('functional tests', () => { const Button = styled('button')( (props => props.theme === 'action' && ({ color: 'red', - 'background-color': 'green' + backgroundColor: 'green' })), (props => props.theme === 'normal' && ({ color: 'white', - 'background-color': 'black' + backgroundColor: 'black' })), (() => ({ margin: 20, @@ -312,18 +312,19 @@ describe('functional tests', () => { const theme = props => ({ action: { color: 'red', - 'background-color': 'green', + backgroundColor: 'green', }, normal: { color: 'black', - 'background-color': 'white', + backgroundColor: 'white', }, })[props.theme] const Button = styled('button')({ margin: 20, - padding: 20 - }, round, theme) + padding: 20, + fontWeight: () => 400, + }, round, theme, {fontSize: ({fontSize}) => fontSize}) const wrapper = mount(