@playwright/experimental-ct-react17 1.40.0-alpha-oct-27-2023 → 1.40.0-alpha-oct-29-2023
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/registerSource.mjs +15 -11
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@playwright/experimental-ct-react17",
|
|
3
|
-
"version": "1.40.0-alpha-oct-
|
|
3
|
+
"version": "1.40.0-alpha-oct-29-2023",
|
|
4
4
|
"description": "Playwright Component Testing for React",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
}
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@playwright/experimental-ct-core": "1.40.0-alpha-oct-
|
|
32
|
+
"@playwright/experimental-ct-core": "1.40.0-alpha-oct-29-2023",
|
|
33
33
|
"@vitejs/plugin-react": "^4.0.0"
|
|
34
34
|
},
|
|
35
35
|
"bin": {
|
package/registerSource.mjs
CHANGED
|
@@ -75,23 +75,27 @@ async function __pwResolveComponent(component) {
|
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
/**
|
|
78
|
-
* @param {
|
|
78
|
+
* @param {JsxComponentChild} child
|
|
79
79
|
*/
|
|
80
|
-
function
|
|
81
|
-
if (
|
|
82
|
-
return
|
|
80
|
+
function __renderChild(child) {
|
|
81
|
+
if (Array.isArray(child))
|
|
82
|
+
return child.map(grandChild => __renderChild(grandChild));
|
|
83
|
+
if (isComponent(child))
|
|
84
|
+
return __pwRender(child);
|
|
85
|
+
return child;
|
|
86
|
+
}
|
|
83
87
|
|
|
88
|
+
/**
|
|
89
|
+
* @param {JsxComponent} component
|
|
90
|
+
*/
|
|
91
|
+
function __pwRender(component) {
|
|
84
92
|
const componentFunc = __pwRegistry.get(component.type);
|
|
85
|
-
|
|
86
|
-
return __pwReact.createElement(componentFunc || component.type, component.props, ...component.children.map(child => {
|
|
87
|
-
if (typeof child === 'string')
|
|
88
|
-
return child;
|
|
89
|
-
return __pwRender(child);
|
|
90
|
-
}).filter(child => {
|
|
93
|
+
const children = component.children.map(child => __renderChild(child)).filter(child => {
|
|
91
94
|
if (typeof child === 'string')
|
|
92
95
|
return !!child.trim();
|
|
93
96
|
return true;
|
|
94
|
-
})
|
|
97
|
+
});
|
|
98
|
+
return __pwReact.createElement(componentFunc || component.type, component.props, children);
|
|
95
99
|
}
|
|
96
100
|
|
|
97
101
|
window.playwrightMount = async (component, rootElement, hooksConfig) => {
|