@symbiote-native/test-utils 0.3.1 → 0.4.1
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/build/recording-host.js +24 -0
- package/package.json +2 -2
package/build/recording-host.js
CHANGED
|
@@ -280,6 +280,9 @@ export function createRecordingHost() {
|
|
|
280
280
|
childrenOf(handle) {
|
|
281
281
|
return nodeOf(handle, 'childrenOf').children.map(child => child.handle);
|
|
282
282
|
},
|
|
283
|
+
firstChildOf(handle) {
|
|
284
|
+
return nodeOf(handle, 'firstChildOf').children[0]?.handle;
|
|
285
|
+
},
|
|
283
286
|
nextSiblingOf(handle) {
|
|
284
287
|
const node = nodeOf(handle, 'nextSiblingOf');
|
|
285
288
|
const siblings = node.parent?.children;
|
|
@@ -301,6 +304,27 @@ export function createRecordingHost() {
|
|
|
301
304
|
walk(nodeOf(root, 'subtreesOf'));
|
|
302
305
|
return out;
|
|
303
306
|
},
|
|
307
|
+
// The twin of the engine's narrowed walk, and it MUST narrow here too: the vitest suite is where
|
|
308
|
+
// the sweep's behaviour is asserted, so a recording host that handed back everything would make
|
|
309
|
+
// every one of those cases pass whatever the engine does.
|
|
310
|
+
teardownSubtreesOf(roots) {
|
|
311
|
+
const out = [];
|
|
312
|
+
const walk = (node, isRoot) => {
|
|
313
|
+
const reserved = out.length;
|
|
314
|
+
out.push(node.handle);
|
|
315
|
+
let isWanted = isRoot || node.tagName !== '';
|
|
316
|
+
for (const child of node.children) {
|
|
317
|
+
if (walk(child, false))
|
|
318
|
+
isWanted = true;
|
|
319
|
+
}
|
|
320
|
+
if (!isWanted)
|
|
321
|
+
out.length = reserved;
|
|
322
|
+
return isWanted;
|
|
323
|
+
};
|
|
324
|
+
for (const root of roots)
|
|
325
|
+
walk(nodeOf(root, 'teardownSubtreesOf'), true);
|
|
326
|
+
return out;
|
|
327
|
+
},
|
|
304
328
|
ancestorsOf(handle) {
|
|
305
329
|
const chain = [];
|
|
306
330
|
for (let node = nodeOf(handle, 'ancestorsOf'); node !== undefined; node = node.parent) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@symbiote-native/test-utils",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"description": "Shared, framework-agnostic fake-Fabric test harness for SymbioteNative — the fake nativeFabricUIManager recorder used by the co-located test suites across the engine, every adapter, and the example apps.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"access": "public"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@symbiote-native/engine": "1.
|
|
43
|
+
"@symbiote-native/engine": "1.2.0"
|
|
44
44
|
},
|
|
45
45
|
"scripts": {
|
|
46
46
|
"typecheck": "tsc --build",
|