@emotion/jest
Advanced tools
Comparing version 11.3.0 to 11.5.0
# @emotion/jest | ||
## 11.5.0 | ||
### Minor Changes | ||
- [#2456](https://github.com/emotion-js/emotion/pull/2456) [`500cdd82`](https://github.com/emotion-js/emotion/commit/500cdd828b65ad4b778c8a1459094b099d50f08a) Thanks [@billyjanitsch](https://github.com/billyjanitsch)! - Support typings for Jest v27 | ||
### Patch Changes | ||
- [#2457](https://github.com/emotion-js/emotion/pull/2457) [`218e4f78`](https://github.com/emotion-js/emotion/commit/218e4f78ca03b36cd8ed595bc1a93892b9783eda) Thanks [@jcleefw](https://github.com/jcleefw)! - Add `RegExp` as a valid type for the `target` option accepted by `toHaveStyleRule`. | ||
## 11.3.0 | ||
@@ -4,0 +14,0 @@ |
{ | ||
"name": "@emotion/jest", | ||
"version": "11.3.0", | ||
"version": "11.5.0", | ||
"description": "Jest utilities for emotion", | ||
@@ -24,6 +24,6 @@ "main": "dist/emotion-jest.cjs.js", | ||
"specificity": "^0.4.1", | ||
"stylis": "^4.0.3" | ||
"stylis": "^4.0.10" | ||
}, | ||
"peerDependencies": { | ||
"@types/jest": "^26.0.14", | ||
"@types/jest": "^26.0.14 || ^27.0.0", | ||
"enzyme-to-json": "^3.2.1" | ||
@@ -40,4 +40,4 @@ }, | ||
"devDependencies": { | ||
"@emotion/css": "11.1.3", | ||
"@emotion/react": "11.1.5", | ||
"@emotion/css": "11.5.0", | ||
"@emotion/react": "11.5.0", | ||
"@types/jest": "^26.0.14", | ||
@@ -44,0 +44,0 @@ "dtslint": "^0.3.0", |
@@ -118,43 +118,42 @@ // @flow | ||
const createConvertEmotionElements = (keys: string[], printer: *) => ( | ||
node: any | ||
) => { | ||
if (isPrimitive(node)) { | ||
return node | ||
} | ||
if (isEmotionCssPropEnzymeElement(node)) { | ||
const className = enzymeTickler.getTickledClassName(node.props.css) | ||
const labels = getLabelsFromClassName(keys, className || '') | ||
const createConvertEmotionElements = | ||
(keys: string[], printer: *) => (node: any) => { | ||
if (isPrimitive(node)) { | ||
return node | ||
} | ||
if (isEmotionCssPropEnzymeElement(node)) { | ||
const className = enzymeTickler.getTickledClassName(node.props.css) | ||
const labels = getLabelsFromClassName(keys, className || '') | ||
if (isShallowEnzymeElement(node, keys, labels)) { | ||
const emotionType = node.props.__EMOTION_TYPE_PLEASE_DO_NOT_USE__ | ||
// emotionType will be a string for DOM elements | ||
const type = | ||
typeof emotionType === 'string' | ||
? emotionType | ||
: emotionType.displayName || emotionType.name || 'Component' | ||
if (isShallowEnzymeElement(node, keys, labels)) { | ||
const emotionType = node.props.__EMOTION_TYPE_PLEASE_DO_NOT_USE__ | ||
// emotionType will be a string for DOM elements | ||
const type = | ||
typeof emotionType === 'string' | ||
? emotionType | ||
: emotionType.displayName || emotionType.name || 'Component' | ||
return { | ||
...node, | ||
props: filterEmotionProps({ | ||
...node.props, | ||
className | ||
}), | ||
type | ||
} | ||
} else { | ||
return node.children[0] | ||
} | ||
} | ||
if (isEmotionCssPropElementType(node)) { | ||
return { | ||
...node, | ||
props: filterEmotionProps({ | ||
...node.props, | ||
className | ||
}), | ||
type | ||
props: filterEmotionProps(node.props), | ||
type: node.props.__EMOTION_TYPE_PLEASE_DO_NOT_USE__ | ||
} | ||
} else { | ||
return node.children[0] | ||
} | ||
} | ||
if (isEmotionCssPropElementType(node)) { | ||
return { | ||
...node, | ||
props: filterEmotionProps(node.props), | ||
type: node.props.__EMOTION_TYPE_PLEASE_DO_NOT_USE__ | ||
if (isReactElement(node)) { | ||
return copyProps({}, node) | ||
} | ||
return node | ||
} | ||
if (isReactElement(node)) { | ||
return copyProps({}, node) | ||
} | ||
return node | ||
} | ||
@@ -232,4 +231,4 @@ function clean(node: any, classNames: string[]) { | ||
val && | ||
(!isTransformed(val) && | ||
(isReactElement(val) || (DOMElements && isDOMElement(val)))) | ||
!isTransformed(val) && | ||
(isReactElement(val) || (DOMElements && isDOMElement(val))) | ||
) | ||
@@ -236,0 +235,0 @@ }, |
@@ -46,3 +46,3 @@ // @flow | ||
value: *, | ||
options?: { target?: string, media?: string } = {} | ||
options?: { target?: string | RegExp, media?: string } = {} | ||
) { | ||
@@ -49,0 +49,0 @@ const { target, media } = options |
@@ -12,3 +12,3 @@ // Definitions by: Junyoung Clare Jang <https://github.com/Ailrun> | ||
export interface StyleRuleOptions { | ||
target?: string | ||
target?: string | RegExp | ||
media?: string | ||
@@ -15,0 +15,0 @@ } |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
119183
0
2390
+ Added@types/jest@27.5.2(transitive)
+ Added@types/node@22.8.7(transitive)
+ Addedansi-styles@5.2.0(transitive)
+ Addeddiff-sequences@27.5.1(transitive)
+ Addedjest-diff@27.5.1(transitive)
+ Addedjest-get-type@27.5.1(transitive)
+ Addedjest-matcher-utils@27.5.1(transitive)
+ Addedobject-inspect@1.13.2(transitive)
+ Addedpretty-format@27.5.1(transitive)
- Removed@jest/types@26.6.2(transitive)
- Removed@types/istanbul-lib-coverage@2.0.6(transitive)
- Removed@types/istanbul-lib-report@3.0.3(transitive)
- Removed@types/istanbul-reports@3.0.4(transitive)
- Removed@types/jest@26.0.24(transitive)
- Removed@types/node@22.9.0(transitive)
- Removed@types/yargs@15.0.19(transitive)
- Removed@types/yargs-parser@21.0.3(transitive)
- Removeddiff-sequences@26.6.2(transitive)
- Removedjest-diff@26.6.2(transitive)
- Removedjest-get-type@26.3.0(transitive)
- Removedobject-inspect@1.13.3(transitive)
- Removedpretty-format@26.6.2(transitive)
Updatedstylis@^4.0.10