Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
clone postProcessor
  • Loading branch information
azazdeaz committed Jul 13, 2015
1 parent 945f825 commit 8f8a5b8
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion 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": {
Expand Down
4 changes: 3 additions & 1 deletion src/react-theme.js
Expand Up @@ -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) {
Expand Down
5 changes: 4 additions & 1 deletion test/test.js
Expand Up @@ -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'))
})
Expand Down

0 comments on commit 8f8a5b8

Please sign in to comment.