diff --git a/package.json b/package.json index 754b1e5..b6ada66 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-theme", - "version": "0.1.2", + "version": "0.1.3", "description": "organise your inline styles flexible and forkable", "main": "lib/react-theme.js", "scripts": { diff --git a/src/react-theme.js b/src/react-theme.js index 4acc65d..6c60a63 100644 --- a/src/react-theme.js +++ b/src/react-theme.js @@ -9,7 +9,9 @@ export default class ReactTheme { } clone() { - return new ReactTheme(cloneDeep(this._sources)) + var clonedTheme = new ReactTheme(cloneDeep(this._sources)) + clonedTheme.setPostProcessor(this.getPostProcessor()) + return clonedTheme } setSource(name, source) { diff --git a/test/test.js b/test/test.js index a0c8c5e..867ab7d 100644 --- a/test/test.js +++ b/test/test.js @@ -39,16 +39,19 @@ describe('Theme', () => { var theme = new Theme() theme.setSource('a', () => ({foo: 1})) - var style = theme.get('a') + var style = theme.getStyle('a') assert.strictEqual(style.foo, 1) }) it('is cloneable', () => { var theme = new Theme() + var processor = () => {} theme.setSource('a', () => ({foo: 1})) + theme.setPostProcessor(processor) var themeClone = theme.clone() + assert.strictEqual(themeClone.getPostProcessor(), processor) assert.notEqual(themeClone, theme) assert.deepEqual(theme.getStyle('a'), themeClone.getStyle('a')) })