-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0c35694
commit 4c08e10
Showing
4 changed files
with
90 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
node_modules | ||
dist | ||
coverage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
language: node_js | ||
node_js: | ||
- "0.10" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
import themeable from '../src'; | ||
import { expect } from 'chai'; | ||
|
||
describe('className', () => { | ||
const classes = { foo: 'aaa', bar: 'bbb' }; | ||
const classTheme = themeable(classes); | ||
|
||
it('should return a single class', () => { | ||
expect(classTheme(1, 'foo')) | ||
.to.deep.equal({ | ||
key: 1, | ||
className: classes.foo | ||
}); | ||
}); | ||
|
||
it('should return multiple classes', () => { | ||
expect(classTheme(2, 'foo', 'bar')) | ||
.to.deep.equal({ | ||
key: 2, | ||
className: `${classes.foo} ${classes.bar}` | ||
}); | ||
}); | ||
|
||
it('should ignore falsy values', () => { | ||
expect(classTheme(1, null, 'foo', undefined, false)) | ||
.to.deep.equal({ | ||
key: 1, | ||
className: classes.foo | ||
}); | ||
}); | ||
|
||
}); | ||
|
||
describe('style', () => { | ||
const styles = { | ||
foo: { | ||
color: 'red', | ||
fontSize: '16px' | ||
}, | ||
bar: { | ||
color: 'blue', | ||
fontWeight: 'bold' | ||
} | ||
}; | ||
const styleTheme = themeable(styles); | ||
|
||
it('should return a single style', () => { | ||
expect(styleTheme(1, 'foo')) | ||
.to.deep.equal({ | ||
key: 1, | ||
style: { | ||
color: 'red', | ||
fontSize: '16px' | ||
} | ||
}); | ||
}); | ||
|
||
it('should return multiple styles merged', () => { | ||
expect(styleTheme(1, 'foo', 'bar')) | ||
.to.deep.equal({ | ||
key: 1, | ||
style: { | ||
fontSize: '16px', | ||
color: 'blue', | ||
fontWeight: 'bold' | ||
} | ||
}); | ||
}); | ||
|
||
it('should ignore falsy values', () => { | ||
expect(styleTheme(1, false, undefined, 'foo', null)) | ||
.to.deep.equal({ | ||
key: 1, | ||
style: { | ||
color: 'red', | ||
fontSize: '16px' | ||
} | ||
}); | ||
}); | ||
|
||
}); |