jest-styled-components
Advanced tools
Comparing version 6.2.2 to 6.3.0
@@ -7,2 +7,6 @@ # Changelog | ||
## [6.2.2](https://github.com/styled-components/jest-styled-components/compare/v6.2.1...v6.2.2) - 2018-10-21 | ||
### Fixed | ||
- Avoid using object spread to make this package compatible with Node <8.6 (see [#196](https://github.com/styled-components/jest-styled-components/pull/196)). | ||
## [6.2.1](https://github.com/styled-components/jest-styled-components/compare/v6.2.0...v6.2.1) - 2018-09-22 | ||
@@ -12,3 +16,2 @@ ### Fixed | ||
## [6.2.0](https://github.com/styled-components/jest-styled-components/compare/v6.1.1...v6.2.0) - 2018-09-08 | ||
@@ -15,0 +18,0 @@ ### Added |
{ | ||
"name": "jest-styled-components", | ||
"version": "6.2.2", | ||
"version": "6.3.0", | ||
"description": "Jest utilities for Styled Components", | ||
@@ -5,0 +5,0 @@ "main": "./src/index.js", |
@@ -351,2 +351,3 @@ [![NPM version](https://img.shields.io/npm/v/jest-styled-components.svg)](https://www.npmjs.com/package/jest-styled-components) | ||
The first argument is the expected property, the second is the expected value which can be a String, RegExp, Jest asymmetric matcher or `undefined`. | ||
When used with a negated ".not" modifier the second argument is optional and can be omitted. | ||
@@ -366,4 +367,5 @@ ```js | ||
expect(tree).toHaveStyleRule('cursor', 'pointer') | ||
expect(tree).toHaveStyleRule('opacity', undefined) // equivalent of the following | ||
expect(tree).not.toHaveStyleRule('opacity') // equivalent of the following two | ||
expect(tree).not.toHaveStyleRule('opacity', expect.any(String)) | ||
expect(tree).toHaveStyleRule('opacity', undefined) | ||
}) | ||
@@ -370,0 +372,0 @@ |
@@ -19,3 +19,5 @@ const { matcherTest, buildReturnMessage } = require('../utils') | ||
const received = mergedStyles[camelCasedProperty] | ||
const pass = matcherTest(received, expected) | ||
const matches = matcherTest(received, expected) | ||
// if expected value is not passed and we have a negated ".not" modifier we need to flip our assertion | ||
const pass = !expected && this.isNot ? !matches : matches | ||
@@ -22,0 +24,0 @@ return { |
@@ -104,9 +104,9 @@ const { getCSS, matcherTest, buildReturnMessage } = require('./utils') | ||
const normalizeOptions = (options) => | ||
const normalizeOptions = options => | ||
options.modifier | ||
? Object.assign( | ||
{}, | ||
options, | ||
{ modifier: Array.isArray(options.modifier) ? options.modifier.join('') : options.modifier }, | ||
) | ||
? Object.assign({}, options, { | ||
modifier: Array.isArray(options.modifier) | ||
? options.modifier.join('') | ||
: options.modifier, | ||
}) | ||
: options | ||
@@ -127,3 +127,5 @@ | ||
const received = declaration.value | ||
const pass = matcherTest(received, expected) | ||
const matches = matcherTest(received, expected) | ||
// if expected value is not passed and we have a negated ".not" modifier we need to flip our assertion | ||
const pass = !expected && this.isNot ? !matches : matches | ||
@@ -130,0 +132,0 @@ return { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
36172
352
460