Skip to content

Commit 976790c

Browse files
authored
Merge pull request #5 from erikras/fixed-alpha-bug
Fixed alpha bug
2 parents c8e5a16 + 1cef9e4 commit 976790c

File tree

5 files changed

+10
-8
lines changed

5 files changed

+10
-8
lines changed

src/__tests__/addModifier.spec.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,14 @@ import Color from 'color'
33
import addModifer from '../addModifier'
44
import methods from '../colorMethods'
55

6-
const selector = () => new Color('#2A2A2A').hex()
6+
const selector = () => new Color('#2A2A2A').toString()
77

88
const testModifier = (modifier, ...args) => {
99
const modified = addModifer(selector, modifier, ...args)
1010
expect(modified).toBeA('function')
11-
expect(modified()).toEqual(new Color(selector())[modifier](...args).hex())
11+
expect(modified()).toEqual(
12+
new Color(selector())[modifier](...args).toString()
13+
)
1214
}
1315

1416
describe('addModifier', () => {

src/__tests__/decorateSelector.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const testHasAllMethods = selector =>
1010
describe('decorateSelector', () => {
1111
colorMethods.forEach(method => {
1212
it(`adds ${method} method`, () => {
13-
const selector = () => new Color('#2A2A2A').hex()
13+
const selector = () => new Color('#2A2A2A').toString()
1414
decorateSelector(selector)
1515
expect(selector[method]).toBeA('function')
1616
testHasAllMethods(selector[method]())
@@ -19,7 +19,7 @@ describe('decorateSelector', () => {
1919
Object.keys(aliases).forEach(method => {
2020
aliases[method].forEach(alias => {
2121
it(`adds ${alias} alias for ${method}`, () => {
22-
const selector = () => new Color('#2A2A2A').hex()
22+
const selector = () => new Color('#2A2A2A').toString()
2323
decorateSelector(selector)
2424
expect(selector[alias]).toBeA('function')
2525
testHasAllMethods(selector[alias]())

src/__tests__/index.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ describe('makeTheme', () => {
3232
const darkerRed = redSelector.darken(0.1)
3333

3434
expect(lighterGray(themeFromProvider)).toBe(
35-
new Color(colors.gray).lighten(0.4).hex()
35+
new Color(colors.gray).lighten(0.4).toString()
3636
)
3737
expect(darkerRed(themeFromProvider)).toBe(
38-
new Color(colors.red).darken(0.1).hex()
38+
new Color(colors.red).darken(0.1).toString()
3939
)
4040
})
4141
})

src/addModifier.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ import Color from 'color'
66
* color string.
77
*/
88
const addModifier = (fn, method, ...modifierArgs) => (...args) =>
9-
new Color(fn(...args))[method](...modifierArgs).hex()
9+
new Color(fn(...args))[method](...modifierArgs).toString()
1010

1111
export default addModifier

src/decorateSelector.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import addModifier from './addModifier'
33
import aliases from './aliases'
44

55
/**
6-
* Add useful methods directly to selector function, as well as put an hex() call at the end
6+
* Add useful methods directly to selector function, as well as put an toString() call at the end
77
* @param selector
88
*/
99
const decorateSelector = selector => {

0 commit comments

Comments
 (0)