@symbiote-native/test-utils 0.5.0 → 0.5.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/recorded-tree.d.ts
CHANGED
|
@@ -5,6 +5,8 @@ export type IRecordedTree = {
|
|
|
5
5
|
commits: number;
|
|
6
6
|
/** Every node the ops created, in creation order, which is what `find` searches. */
|
|
7
7
|
readonly authored: IRecorded[];
|
|
8
|
+
/** The process-wide `:root` table, as native holds it after the ops so far. */
|
|
9
|
+
readonly globalVariables: Map<string, string>;
|
|
8
10
|
applyOps: (batch: IMutationBatch) => void;
|
|
9
11
|
recordedOf: (handle: object) => IRecorded | undefined;
|
|
10
12
|
nodeOf: (handle: object, what: string) => IRecorded;
|
package/build/recorded-tree.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// The authored tree an op batch describes, and the walk that builds it. Apart from
|
|
2
2
|
// `recording-host` so that file holds the `ITreeHost` surface and this one the mechanism
|
|
3
|
-
import { NO_VALUE, OP_APPEND_CHILD, OP_COMMIT, OP_CREATE_ANCHOR, OP_CREATE_ELEMENT, OP_CREATE_RAW_TEXT, OP_INSERT_BEFORE, OP_REMOVE_CHILD, OP_SET_COMPONENT, OP_SET_OWNED_LISTENER, OP_SET_TAG, OP_SET_UNDERLAY_SHOWN, OP_SET_PROP, OP_SET_TEXT, OP_STRIDE, } from '@symbiote-native/engine/mutation-buffer';
|
|
3
|
+
import { NO_VALUE, OP_APPEND_CHILD, OP_COMMIT, OP_CREATE_ANCHOR, OP_CREATE_ELEMENT, OP_CREATE_RAW_TEXT, OP_INSERT_BEFORE, OP_REMOVE_CHILD, OP_SET_COMPONENT, OP_SET_CONTAINER_VARIANTS, OP_SET_GLOBAL_VARIABLE, OP_SET_OWNED_LISTENER, OP_SET_RELEASE_MARK, OP_SET_TAG, OP_SET_UNDERLAY_SHOWN, OP_SET_PROP, OP_SET_TEXT, OP_STRIDE, } from '@symbiote-native/engine/mutation-buffer';
|
|
4
4
|
import { isSymbioteNode } from '@symbiote-native/engine';
|
|
5
5
|
function detach(node) {
|
|
6
6
|
const { parent } = node;
|
|
@@ -81,6 +81,18 @@ function applyValueOp(ctx, op) {
|
|
|
81
81
|
case OP_SET_TAG:
|
|
82
82
|
ctx.at(op.a).tagName = strings[op.b];
|
|
83
83
|
return true;
|
|
84
|
+
case OP_SET_RELEASE_MARK:
|
|
85
|
+
ctx.at(op.a).isReleaseMarked = true;
|
|
86
|
+
return true;
|
|
87
|
+
case OP_SET_CONTAINER_VARIANTS:
|
|
88
|
+
ctx.at(op.a).containerVariants = op.b === NO_VALUE ? undefined : strings[op.b];
|
|
89
|
+
return true;
|
|
90
|
+
case OP_SET_GLOBAL_VARIABLE:
|
|
91
|
+
if (op.b === NO_VALUE)
|
|
92
|
+
ctx.globalVariables.delete(strings[op.a]);
|
|
93
|
+
else
|
|
94
|
+
ctx.globalVariables.set(strings[op.a], strings[op.b]);
|
|
95
|
+
return true;
|
|
84
96
|
case OP_SET_OWNED_LISTENER:
|
|
85
97
|
ctx.at(op.a).ownedListeners[strings[op.b]] = op.c !== 0;
|
|
86
98
|
return true;
|
|
@@ -129,8 +141,10 @@ function newRecord(handle, viewName, props, instanceHandle) {
|
|
|
129
141
|
instanceHandle,
|
|
130
142
|
viewName,
|
|
131
143
|
tagName: '',
|
|
144
|
+
isReleaseMarked: false,
|
|
132
145
|
ownedListeners: {},
|
|
133
146
|
underlayShown: false,
|
|
147
|
+
containerVariants: undefined,
|
|
134
148
|
props,
|
|
135
149
|
parent: undefined,
|
|
136
150
|
children: [],
|
|
@@ -142,6 +156,7 @@ export function createRecordedTree() {
|
|
|
142
156
|
// A `WeakMap` cannot be enumerated and `find` has to start somewhere. Strong references, so
|
|
143
157
|
// `forget()` is what a long file calls to stop this growing
|
|
144
158
|
const authored = [];
|
|
159
|
+
const globalVariables = new Map();
|
|
145
160
|
const nodeOf = (handle, what) => {
|
|
146
161
|
const node = recorded.get(handle);
|
|
147
162
|
if (node === undefined) {
|
|
@@ -152,11 +167,13 @@ export function createRecordedTree() {
|
|
|
152
167
|
const tree = {
|
|
153
168
|
commits: 0,
|
|
154
169
|
authored,
|
|
170
|
+
globalVariables,
|
|
155
171
|
recordedOf: handle => recorded.get(handle),
|
|
156
172
|
nodeOf,
|
|
157
173
|
applyOps(batch) {
|
|
158
174
|
walkBatch({
|
|
159
175
|
batch,
|
|
176
|
+
globalVariables,
|
|
160
177
|
at: slot => nodeOf(handleAt(batch, slot), 'applyOps'),
|
|
161
178
|
create: (slot, viewName, props, instanceHandle) => {
|
|
162
179
|
const node = newRecord(handleAt(batch, slot), viewName, props, instanceHandle);
|
|
@@ -171,6 +188,7 @@ export function createRecordedTree() {
|
|
|
171
188
|
},
|
|
172
189
|
reset() {
|
|
173
190
|
authored.length = 0;
|
|
191
|
+
globalVariables.clear();
|
|
174
192
|
tree.commits = 0;
|
|
175
193
|
},
|
|
176
194
|
forget() {
|
|
@@ -10,8 +10,10 @@ export type IRecorded = {
|
|
|
10
10
|
instanceHandle: unknown;
|
|
11
11
|
viewName: string;
|
|
12
12
|
tagName: string;
|
|
13
|
+
isReleaseMarked: boolean;
|
|
13
14
|
ownedListeners: Record<string, boolean>;
|
|
14
15
|
underlayShown: boolean;
|
|
16
|
+
containerVariants: string | undefined;
|
|
15
17
|
props: Record<string, unknown>;
|
|
16
18
|
parent: IRecorded | undefined;
|
|
17
19
|
children: IRecorded[];
|
package/build/recording-host.js
CHANGED
|
@@ -129,7 +129,7 @@ export function createRecordingHost() {
|
|
|
129
129
|
const walk = (node, isRoot) => {
|
|
130
130
|
const reserved = out.length;
|
|
131
131
|
out.push(node.handle);
|
|
132
|
-
let isWanted = isRoot || node.tagName !== '';
|
|
132
|
+
let isWanted = isRoot || node.tagName !== '' || node.isReleaseMarked;
|
|
133
133
|
for (const child of node.children) {
|
|
134
134
|
if (walk(child, false))
|
|
135
135
|
isWanted = true;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@symbiote-native/test-utils",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.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.8.0"
|
|
44
44
|
},
|
|
45
45
|
"scripts": {
|
|
46
46
|
"typecheck": "tsc --build",
|