Skip to content

Commit

Permalink
test(hslToRgb): negative hue test
Browse files Browse the repository at this point in the history
Test hslToRgb's ability to handle negative hues passed in through adjustHue.

tests styled-components#437
  • Loading branch information
davidde committed May 18, 2019
1 parent 9b4f594 commit 4852d6f
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/internalHelpers/test/__snapshots__/_hslToRgb.test.js.snap
Expand Up @@ -6,6 +6,24 @@ Object {
}
`;

exports[`hslToRgb should convert correctly even when passed a "faulty" negative hue 1`] = `
Object {
"background": "rgb(255,0,43)",
}
`;

exports[`hslToRgb should convert correctly even when passed a "faulty" negative hue 2`] = `
Object {
"background": "rgb(85,0,255)",
}
`;

exports[`hslToRgb should convert correctly even when passed a "faulty" negative hue 3`] = `
Object {
"background": "rgb(170,255,0)",
}
`;

exports[`hslToRgb should convert numbers to a hex color 1`] = `
Object {
"background": "rgb(179,25,25)",
Expand Down
6 changes: 6 additions & 0 deletions src/internalHelpers/test/_hslToRgb.test.js
Expand Up @@ -34,4 +34,10 @@ describe('hslToRgb', () => {
it('should convert black', () => {
expect({ background: `rgb(${hslToRgb(360, 0, 0.4)})` }).toMatchSnapshot()
})

it('should convert correctly even when passed a "faulty" negative hue', () => {
expect({ background: `rgb(${hslToRgb(-10, 1, 0.5)})` }).toMatchSnapshot()
expect({ background: `rgb(${hslToRgb(-100, 1, 0.5)})` }).toMatchSnapshot()
expect({ background: `rgb(${hslToRgb(-1000, 1, 0.5)})` }).toMatchSnapshot()
})
})

0 comments on commit 4852d6f

Please sign in to comment.