react-component-snapshot 0.0.29 → 0.0.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/src/index.mjs +10 -26
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-component-snapshot",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.30",
|
|
4
4
|
"description": "Transform a React component to match its snapshot in Jest",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"@testing-library/react": "^16.3.0",
|
|
45
45
|
"@types/debug": "^4.1.12",
|
|
46
46
|
"@types/jest": "^29.5.14",
|
|
47
|
-
"@types/react": "^19.1.
|
|
47
|
+
"@types/react": "^19.1.1",
|
|
48
48
|
"@types/react-dom": "^19.1.2",
|
|
49
49
|
"@typescript-eslint/parser": "^8.29.1",
|
|
50
50
|
"core-js": "^3.41.0",
|
package/src/index.mjs
CHANGED
|
@@ -56,19 +56,11 @@ function getComponentElementFromContainerElement ({
|
|
|
56
56
|
* @returns {Record<PropertyKey, unknown> | null}
|
|
57
57
|
*/
|
|
58
58
|
export function toSnapshotFromRender (render) {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
if (fiberNode) {
|
|
65
|
-
return (
|
|
66
|
-
getSnapshot(fiberNode)
|
|
67
|
-
)
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
return null
|
|
59
|
+
return (
|
|
60
|
+
toSnapshotFromComponentElement(
|
|
61
|
+
getComponentElementFromRender(render)
|
|
62
|
+
)
|
|
63
|
+
)
|
|
72
64
|
}
|
|
73
65
|
|
|
74
66
|
/**
|
|
@@ -76,19 +68,11 @@ export function toSnapshotFromRender (render) {
|
|
|
76
68
|
* @returns {Record<PropertyKey, unknown> | null}
|
|
77
69
|
*/
|
|
78
70
|
export function toSnapshotFromContainerElement (containerElement) {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
if (fiberNode) {
|
|
85
|
-
return (
|
|
86
|
-
getSnapshot(fiberNode)
|
|
87
|
-
)
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
return null
|
|
71
|
+
return (
|
|
72
|
+
toSnapshotFromComponentElement(
|
|
73
|
+
getComponentElementFromContainerElement(containerElement)
|
|
74
|
+
)
|
|
75
|
+
)
|
|
92
76
|
}
|
|
93
77
|
|
|
94
78
|
/**
|