what-core 0.11.0 → 0.11.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/dist/{chunk-RI7T5VFD.min.js → chunk-D5YDPQ57.min.js} +1 -2
- package/dist/chunk-O3SKPRTY.min.js +0 -1
- package/dist/chunk-W33M3HL5.min.js +1 -0
- package/dist/index.min.js +2 -3
- package/dist/jsx-dev-runtime.min.js +0 -1
- package/dist/jsx-runtime.min.js +0 -1
- package/dist/render.min.js +1 -2
- package/dist/testing.min.js +1 -2
- package/package.json +2 -2
- package/src/agent-context.js +1 -1
- package/src/reactive.js +20 -4
- package/dist/a11y.js +0 -440
- package/dist/animation.js +0 -548
- package/dist/chunk-2IZMPODD.min.js +0 -2
- package/dist/chunk-2IZMPODD.min.js.map +0 -7
- package/dist/chunk-2P7OVL2L.js +0 -1386
- package/dist/chunk-2P7OVL2L.js.map +0 -7
- package/dist/chunk-5EQUBJWQ.js +0 -1365
- package/dist/chunk-5EQUBJWQ.js.map +0 -7
- package/dist/chunk-6DAIK77K.min.js +0 -2
- package/dist/chunk-6DAIK77K.min.js.map +0 -7
- package/dist/chunk-AW3BAPIK.js +0 -1685
- package/dist/chunk-AW3BAPIK.js.map +0 -7
- package/dist/chunk-AZP2EOGX.js +0 -188
- package/dist/chunk-AZP2EOGX.js.map +0 -7
- package/dist/chunk-CCINITLW.js +0 -1692
- package/dist/chunk-CCINITLW.js.map +0 -7
- package/dist/chunk-F2HUXI22.js +0 -1675
- package/dist/chunk-F2HUXI22.js.map +0 -7
- package/dist/chunk-GZRA4IAJ.js +0 -1699
- package/dist/chunk-GZRA4IAJ.js.map +0 -7
- package/dist/chunk-H3GA34JK.js +0 -1384
- package/dist/chunk-H3GA34JK.js.map +0 -7
- package/dist/chunk-KBM6CWG4.min.js +0 -2
- package/dist/chunk-KBM6CWG4.min.js.map +0 -7
- package/dist/chunk-KL7TNUIU.min.js +0 -2
- package/dist/chunk-KL7TNUIU.min.js.map +0 -7
- package/dist/chunk-L6XOF7P4.min.js +0 -2
- package/dist/chunk-L6XOF7P4.min.js.map +0 -7
- package/dist/chunk-M7UEET5O.js +0 -1323
- package/dist/chunk-M7UEET5O.js.map +0 -7
- package/dist/chunk-MH7L756Y.min.js +0 -2
- package/dist/chunk-MH7L756Y.min.js.map +0 -7
- package/dist/chunk-O3SKPRTY.min.js.map +0 -7
- package/dist/chunk-RI7T5VFD.min.js.map +0 -7
- package/dist/chunk-RN6QIBWL.min.js +0 -2
- package/dist/chunk-RN6QIBWL.min.js.map +0 -7
- package/dist/chunk-VKCFJ4OT.min.js +0 -2
- package/dist/chunk-VKCFJ4OT.min.js.map +0 -7
- package/dist/chunk-VMTTYB4L.min.js +0 -2
- package/dist/chunk-VMTTYB4L.min.js.map +0 -7
- package/dist/chunk-VP4WLF5A.js +0 -1323
- package/dist/chunk-VP4WLF5A.js.map +0 -7
- package/dist/chunk-YA3W4XKH.js +0 -1323
- package/dist/chunk-YA3W4XKH.js.map +0 -7
- package/dist/compiler.js +0 -1799
- package/dist/compiler.js.map +0 -7
- package/dist/compiler.min.js +0 -2
- package/dist/compiler.min.js.map +0 -7
- package/dist/components.js +0 -229
- package/dist/data.js +0 -638
- package/dist/devtools.js +0 -10
- package/dist/devtools.js.map +0 -7
- package/dist/devtools.min.js +0 -2
- package/dist/devtools.min.js.map +0 -7
- package/dist/dom.js +0 -439
- package/dist/form.js +0 -509
- package/dist/h.js +0 -152
- package/dist/head.js +0 -51
- package/dist/helpers.js +0 -140
- package/dist/hooks.js +0 -210
- package/dist/index.js +0 -3576
- package/dist/index.js.map +0 -7
- package/dist/index.min.js.map +0 -7
- package/dist/jsx-dev-runtime.js +0 -23
- package/dist/jsx-dev-runtime.js.map +0 -7
- package/dist/jsx-dev-runtime.min.js.map +0 -7
- package/dist/jsx-runtime.js +0 -21
- package/dist/jsx-runtime.js.map +0 -7
- package/dist/jsx-runtime.min.js.map +0 -7
- package/dist/reactive.js +0 -432
- package/dist/render.js +0 -53
- package/dist/render.js.map +0 -7
- package/dist/render.min.js.map +0 -7
- package/dist/scheduler.js +0 -246
- package/dist/skeleton.js +0 -363
- package/dist/store.js +0 -83
- package/dist/testing.js +0 -439
- package/dist/testing.js.map +0 -7
- package/dist/testing.min.js.map +0 -7
- package/dist/what.js +0 -117
package/dist/testing.js
DELETED
|
@@ -1,439 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
createRoot,
|
|
3
|
-
effect,
|
|
4
|
-
flushSync,
|
|
5
|
-
mount,
|
|
6
|
-
signal
|
|
7
|
-
} from "./chunk-GZRA4IAJ.js";
|
|
8
|
-
import {
|
|
9
|
-
h
|
|
10
|
-
} from "./chunk-AZP2EOGX.js";
|
|
11
|
-
|
|
12
|
-
// packages/core/src/testing.js
|
|
13
|
-
var container = null;
|
|
14
|
-
function setupDOM() {
|
|
15
|
-
if (typeof document !== "undefined") {
|
|
16
|
-
container = document.createElement("div");
|
|
17
|
-
container.id = "test-root";
|
|
18
|
-
document.body.appendChild(container);
|
|
19
|
-
}
|
|
20
|
-
return container;
|
|
21
|
-
}
|
|
22
|
-
function cleanup() {
|
|
23
|
-
if (container) {
|
|
24
|
-
container.innerHTML = "";
|
|
25
|
-
if (container.parentNode) {
|
|
26
|
-
container.parentNode.removeChild(container);
|
|
27
|
-
}
|
|
28
|
-
container = null;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
function render(vnode, options = {}) {
|
|
32
|
-
const { container: customContainer } = options;
|
|
33
|
-
const target = customContainer || setupDOM();
|
|
34
|
-
if (!target) {
|
|
35
|
-
throw new Error("No DOM container available. Are you running in Node.js without jsdom?");
|
|
36
|
-
}
|
|
37
|
-
const unmount = mount(vnode, target);
|
|
38
|
-
return {
|
|
39
|
-
container: target,
|
|
40
|
-
unmount,
|
|
41
|
-
// Query helpers
|
|
42
|
-
getByText: (text) => queryByText(target, text),
|
|
43
|
-
getByTestId: (id) => target.querySelector(`[data-testid="${id}"]`),
|
|
44
|
-
getByRole: (role) => target.querySelector(`[role="${role}"]`),
|
|
45
|
-
getAllByText: (text) => queryAllByText(target, text),
|
|
46
|
-
queryByText: (text) => queryByText(target, text),
|
|
47
|
-
queryByTestId: (id) => target.querySelector(`[data-testid="${id}"]`),
|
|
48
|
-
// Debug
|
|
49
|
-
debug: () => console.log(target.innerHTML),
|
|
50
|
-
// Async utilities
|
|
51
|
-
findByText: (text, timeout) => waitFor(() => queryByText(target, text), { timeout }),
|
|
52
|
-
findByTestId: (id, timeout) => waitFor(() => target.querySelector(`[data-testid="${id}"]`), { timeout })
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
function renderTest(Component, props) {
|
|
56
|
-
const target = setupDOM();
|
|
57
|
-
if (!target) {
|
|
58
|
-
throw new Error("No DOM container available. Are you running in Node.js without jsdom?");
|
|
59
|
-
}
|
|
60
|
-
const signalRegistry = {};
|
|
61
|
-
let rootDispose = null;
|
|
62
|
-
let unmountFn;
|
|
63
|
-
createRoot((dispose) => {
|
|
64
|
-
rootDispose = dispose;
|
|
65
|
-
const vnode = h(Component, props || {});
|
|
66
|
-
unmountFn = mount(vnode, target);
|
|
67
|
-
});
|
|
68
|
-
return {
|
|
69
|
-
container: target,
|
|
70
|
-
// Proxy to access component signals by name
|
|
71
|
-
signals: new Proxy(signalRegistry, {
|
|
72
|
-
get(obj, prop) {
|
|
73
|
-
if (prop in obj) return obj[prop];
|
|
74
|
-
return void 0;
|
|
75
|
-
},
|
|
76
|
-
set(obj, prop, value) {
|
|
77
|
-
obj[prop] = value;
|
|
78
|
-
return true;
|
|
79
|
-
}
|
|
80
|
-
}),
|
|
81
|
-
// Synchronous flush: run all pending effects immediately
|
|
82
|
-
update() {
|
|
83
|
-
flushSync();
|
|
84
|
-
},
|
|
85
|
-
unmount() {
|
|
86
|
-
if (unmountFn) unmountFn();
|
|
87
|
-
if (rootDispose) rootDispose();
|
|
88
|
-
cleanup();
|
|
89
|
-
},
|
|
90
|
-
// Query helpers
|
|
91
|
-
getByText: (text) => queryByText(target, text),
|
|
92
|
-
getByTestId: (id) => target.querySelector(`[data-testid="${id}"]`),
|
|
93
|
-
queryByText: (text) => queryByText(target, text),
|
|
94
|
-
debug: () => console.log(target.innerHTML)
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
function flushEffects() {
|
|
98
|
-
flushSync();
|
|
99
|
-
}
|
|
100
|
-
function trackSignals(fn) {
|
|
101
|
-
const accessed = [];
|
|
102
|
-
const written = [];
|
|
103
|
-
const _origSignal = signal;
|
|
104
|
-
const trackedSignals = /* @__PURE__ */ new Map();
|
|
105
|
-
const trackRead = (name) => {
|
|
106
|
-
if (!accessed.includes(name)) accessed.push(name);
|
|
107
|
-
};
|
|
108
|
-
const trackWrite = (name) => {
|
|
109
|
-
if (!written.includes(name)) written.push(name);
|
|
110
|
-
};
|
|
111
|
-
let dispose;
|
|
112
|
-
createRoot((d) => {
|
|
113
|
-
dispose = d;
|
|
114
|
-
const e = effect(() => {
|
|
115
|
-
fn();
|
|
116
|
-
});
|
|
117
|
-
});
|
|
118
|
-
if (dispose) dispose();
|
|
119
|
-
return { accessed, written };
|
|
120
|
-
}
|
|
121
|
-
function mockSignal(name, initialValue) {
|
|
122
|
-
const history = [initialValue];
|
|
123
|
-
let setCount = 0;
|
|
124
|
-
const s = signal(initialValue, name);
|
|
125
|
-
const origSet = s.set;
|
|
126
|
-
s.set = function(next) {
|
|
127
|
-
const nextVal = typeof next === "function" ? next(s.peek()) : next;
|
|
128
|
-
if (!Object.is(s.peek(), nextVal)) {
|
|
129
|
-
setCount++;
|
|
130
|
-
history.push(nextVal);
|
|
131
|
-
}
|
|
132
|
-
return origSet(nextVal);
|
|
133
|
-
};
|
|
134
|
-
const origFn = s;
|
|
135
|
-
const mock = function(...args) {
|
|
136
|
-
if (args.length === 0) {
|
|
137
|
-
return origFn();
|
|
138
|
-
}
|
|
139
|
-
const nextVal = typeof args[0] === "function" ? args[0](origFn.peek()) : args[0];
|
|
140
|
-
if (!Object.is(origFn.peek(), nextVal)) {
|
|
141
|
-
setCount++;
|
|
142
|
-
history.push(nextVal);
|
|
143
|
-
}
|
|
144
|
-
return origFn(nextVal);
|
|
145
|
-
};
|
|
146
|
-
mock._signal = true;
|
|
147
|
-
mock.peek = s.peek;
|
|
148
|
-
mock.set = s.set;
|
|
149
|
-
mock.subscribe = s.subscribe;
|
|
150
|
-
if (s._debugName) mock._debugName = s._debugName;
|
|
151
|
-
if (s._subs) mock._subs = s._subs;
|
|
152
|
-
Object.defineProperty(mock, "history", {
|
|
153
|
-
get() {
|
|
154
|
-
return history;
|
|
155
|
-
}
|
|
156
|
-
});
|
|
157
|
-
Object.defineProperty(mock, "setCount", {
|
|
158
|
-
get() {
|
|
159
|
-
return setCount;
|
|
160
|
-
}
|
|
161
|
-
});
|
|
162
|
-
mock.reset = function(value) {
|
|
163
|
-
const resetVal = value !== void 0 ? value : initialValue;
|
|
164
|
-
history.length = 0;
|
|
165
|
-
history.push(resetVal);
|
|
166
|
-
setCount = 0;
|
|
167
|
-
origFn(resetVal);
|
|
168
|
-
};
|
|
169
|
-
return mock;
|
|
170
|
-
}
|
|
171
|
-
function queryByText(container2, text) {
|
|
172
|
-
const regex = text instanceof RegExp ? text : null;
|
|
173
|
-
const walker = document.createTreeWalker(
|
|
174
|
-
container2,
|
|
175
|
-
NodeFilter.SHOW_TEXT,
|
|
176
|
-
null,
|
|
177
|
-
false
|
|
178
|
-
);
|
|
179
|
-
while (walker.nextNode()) {
|
|
180
|
-
const node = walker.currentNode;
|
|
181
|
-
const matches = regex ? regex.test(node.textContent) : node.textContent.includes(text);
|
|
182
|
-
if (matches) {
|
|
183
|
-
return node.parentElement;
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
return null;
|
|
187
|
-
}
|
|
188
|
-
function queryAllByText(container2, text) {
|
|
189
|
-
const results = [];
|
|
190
|
-
const regex = text instanceof RegExp ? text : null;
|
|
191
|
-
const walker = document.createTreeWalker(
|
|
192
|
-
container2,
|
|
193
|
-
NodeFilter.SHOW_TEXT,
|
|
194
|
-
null,
|
|
195
|
-
false
|
|
196
|
-
);
|
|
197
|
-
while (walker.nextNode()) {
|
|
198
|
-
const node = walker.currentNode;
|
|
199
|
-
const matches = regex ? regex.test(node.textContent) : node.textContent.includes(text);
|
|
200
|
-
if (matches) {
|
|
201
|
-
results.push(node.parentElement);
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
return results;
|
|
205
|
-
}
|
|
206
|
-
var fireEvent = {
|
|
207
|
-
click(element) {
|
|
208
|
-
const event = new MouseEvent("click", {
|
|
209
|
-
bubbles: true,
|
|
210
|
-
cancelable: true,
|
|
211
|
-
view: typeof window !== "undefined" ? window : void 0
|
|
212
|
-
});
|
|
213
|
-
element.dispatchEvent(event);
|
|
214
|
-
return event;
|
|
215
|
-
},
|
|
216
|
-
change(element, value) {
|
|
217
|
-
element.value = value;
|
|
218
|
-
const event = new Event("input", { bubbles: true });
|
|
219
|
-
element.dispatchEvent(event);
|
|
220
|
-
const changeEvent = new Event("change", { bubbles: true });
|
|
221
|
-
element.dispatchEvent(changeEvent);
|
|
222
|
-
return changeEvent;
|
|
223
|
-
},
|
|
224
|
-
input(element, value) {
|
|
225
|
-
element.value = value;
|
|
226
|
-
const event = new Event("input", { bubbles: true });
|
|
227
|
-
element.dispatchEvent(event);
|
|
228
|
-
return event;
|
|
229
|
-
},
|
|
230
|
-
submit(element) {
|
|
231
|
-
const event = new Event("submit", { bubbles: true, cancelable: true });
|
|
232
|
-
element.dispatchEvent(event);
|
|
233
|
-
return event;
|
|
234
|
-
},
|
|
235
|
-
focus(element) {
|
|
236
|
-
element.focus();
|
|
237
|
-
const event = new FocusEvent("focus", { bubbles: true });
|
|
238
|
-
element.dispatchEvent(event);
|
|
239
|
-
return event;
|
|
240
|
-
},
|
|
241
|
-
blur(element) {
|
|
242
|
-
element.blur();
|
|
243
|
-
const event = new FocusEvent("blur", { bubbles: true });
|
|
244
|
-
element.dispatchEvent(event);
|
|
245
|
-
return event;
|
|
246
|
-
},
|
|
247
|
-
keyDown(element, key, options = {}) {
|
|
248
|
-
const event = new KeyboardEvent("keydown", {
|
|
249
|
-
bubbles: true,
|
|
250
|
-
cancelable: true,
|
|
251
|
-
key,
|
|
252
|
-
...options
|
|
253
|
-
});
|
|
254
|
-
element.dispatchEvent(event);
|
|
255
|
-
return event;
|
|
256
|
-
},
|
|
257
|
-
keyUp(element, key, options = {}) {
|
|
258
|
-
const event = new KeyboardEvent("keyup", {
|
|
259
|
-
bubbles: true,
|
|
260
|
-
cancelable: true,
|
|
261
|
-
key,
|
|
262
|
-
...options
|
|
263
|
-
});
|
|
264
|
-
element.dispatchEvent(event);
|
|
265
|
-
return event;
|
|
266
|
-
},
|
|
267
|
-
mouseEnter(element) {
|
|
268
|
-
const event = new MouseEvent("mouseenter", { bubbles: true });
|
|
269
|
-
element.dispatchEvent(event);
|
|
270
|
-
return event;
|
|
271
|
-
},
|
|
272
|
-
mouseLeave(element) {
|
|
273
|
-
const event = new MouseEvent("mouseleave", { bubbles: true });
|
|
274
|
-
element.dispatchEvent(event);
|
|
275
|
-
return event;
|
|
276
|
-
}
|
|
277
|
-
};
|
|
278
|
-
async function waitFor(callback, options = {}) {
|
|
279
|
-
const { timeout = 1e3, interval = 50 } = options;
|
|
280
|
-
const startTime = Date.now();
|
|
281
|
-
while (Date.now() - startTime < timeout) {
|
|
282
|
-
try {
|
|
283
|
-
const result = callback();
|
|
284
|
-
if (result) return result;
|
|
285
|
-
} catch (e) {
|
|
286
|
-
}
|
|
287
|
-
await new Promise((r) => setTimeout(r, interval));
|
|
288
|
-
}
|
|
289
|
-
throw new Error(`waitFor timed out after ${timeout}ms`);
|
|
290
|
-
}
|
|
291
|
-
async function waitForElementToBeRemoved(callback, options = {}) {
|
|
292
|
-
const { timeout = 1e3, interval = 50 } = options;
|
|
293
|
-
const startTime = Date.now();
|
|
294
|
-
let element = callback();
|
|
295
|
-
if (!element) {
|
|
296
|
-
throw new Error("Element not found");
|
|
297
|
-
}
|
|
298
|
-
while (Date.now() - startTime < timeout) {
|
|
299
|
-
element = callback();
|
|
300
|
-
if (!element) return;
|
|
301
|
-
await new Promise((r) => setTimeout(r, interval));
|
|
302
|
-
}
|
|
303
|
-
throw new Error(`Element still present after ${timeout}ms`);
|
|
304
|
-
}
|
|
305
|
-
async function act(callback) {
|
|
306
|
-
const result = await callback();
|
|
307
|
-
flushSync();
|
|
308
|
-
await new Promise((r) => queueMicrotask(r));
|
|
309
|
-
await new Promise((r) => setTimeout(r, 0));
|
|
310
|
-
return result;
|
|
311
|
-
}
|
|
312
|
-
function createTestSignal(initial) {
|
|
313
|
-
const s = signal(initial);
|
|
314
|
-
const history = [initial];
|
|
315
|
-
effect(() => {
|
|
316
|
-
history.push(s());
|
|
317
|
-
});
|
|
318
|
-
return {
|
|
319
|
-
signal: s,
|
|
320
|
-
get value() {
|
|
321
|
-
return s();
|
|
322
|
-
},
|
|
323
|
-
set value(v) {
|
|
324
|
-
s.set(v);
|
|
325
|
-
},
|
|
326
|
-
history,
|
|
327
|
-
reset() {
|
|
328
|
-
history.length = 0;
|
|
329
|
-
history.push(s());
|
|
330
|
-
}
|
|
331
|
-
};
|
|
332
|
-
}
|
|
333
|
-
function mockComponent(name = "MockComponent") {
|
|
334
|
-
const calls = [];
|
|
335
|
-
function Mock(props) {
|
|
336
|
-
calls.push({ props, timestamp: Date.now() });
|
|
337
|
-
return h(
|
|
338
|
-
"div",
|
|
339
|
-
{ "data-testid": `mock-${name}` },
|
|
340
|
-
JSON.stringify(props, null, 2)
|
|
341
|
-
);
|
|
342
|
-
}
|
|
343
|
-
Mock.displayName = name;
|
|
344
|
-
Mock.calls = calls;
|
|
345
|
-
Mock.lastCall = () => calls[calls.length - 1];
|
|
346
|
-
Mock.reset = () => {
|
|
347
|
-
calls.length = 0;
|
|
348
|
-
};
|
|
349
|
-
return Mock;
|
|
350
|
-
}
|
|
351
|
-
var expect = {
|
|
352
|
-
toBeInTheDocument(element) {
|
|
353
|
-
if (!element || !element.parentNode) {
|
|
354
|
-
throw new Error("Expected element to be in the document");
|
|
355
|
-
}
|
|
356
|
-
},
|
|
357
|
-
toHaveTextContent(element, text) {
|
|
358
|
-
if (!element) {
|
|
359
|
-
throw new Error("Element not found");
|
|
360
|
-
}
|
|
361
|
-
const content = element.textContent;
|
|
362
|
-
const matches = text instanceof RegExp ? text.test(content) : content.includes(text);
|
|
363
|
-
if (!matches) {
|
|
364
|
-
throw new Error(`Expected "${content}" to contain "${text}"`);
|
|
365
|
-
}
|
|
366
|
-
},
|
|
367
|
-
toHaveAttribute(element, attr, value) {
|
|
368
|
-
if (!element) {
|
|
369
|
-
throw new Error("Element not found");
|
|
370
|
-
}
|
|
371
|
-
const attrValue = element.getAttribute(attr);
|
|
372
|
-
if (value !== void 0 && attrValue !== value) {
|
|
373
|
-
throw new Error(`Expected attribute "${attr}" to be "${value}", got "${attrValue}"`);
|
|
374
|
-
}
|
|
375
|
-
if (value === void 0 && attrValue === null) {
|
|
376
|
-
throw new Error(`Expected element to have attribute "${attr}"`);
|
|
377
|
-
}
|
|
378
|
-
},
|
|
379
|
-
toHaveClass(element, className) {
|
|
380
|
-
if (!element) {
|
|
381
|
-
throw new Error("Element not found");
|
|
382
|
-
}
|
|
383
|
-
if (!element.classList.contains(className)) {
|
|
384
|
-
throw new Error(`Expected element to have class "${className}"`);
|
|
385
|
-
}
|
|
386
|
-
},
|
|
387
|
-
toBeVisible(element) {
|
|
388
|
-
if (!element) {
|
|
389
|
-
throw new Error("Element not found");
|
|
390
|
-
}
|
|
391
|
-
const style = window.getComputedStyle(element);
|
|
392
|
-
if (style.display === "none" || style.visibility === "hidden" || style.opacity === "0") {
|
|
393
|
-
throw new Error("Expected element to be visible");
|
|
394
|
-
}
|
|
395
|
-
},
|
|
396
|
-
toBeDisabled(element) {
|
|
397
|
-
if (!element) {
|
|
398
|
-
throw new Error("Element not found");
|
|
399
|
-
}
|
|
400
|
-
if (!element.disabled) {
|
|
401
|
-
throw new Error("Expected element to be disabled");
|
|
402
|
-
}
|
|
403
|
-
},
|
|
404
|
-
toHaveValue(element, value) {
|
|
405
|
-
if (!element) {
|
|
406
|
-
throw new Error("Element not found");
|
|
407
|
-
}
|
|
408
|
-
if (element.value !== value) {
|
|
409
|
-
throw new Error(`Expected value to be "${value}", got "${element.value}"`);
|
|
410
|
-
}
|
|
411
|
-
}
|
|
412
|
-
};
|
|
413
|
-
var screen = {
|
|
414
|
-
getByText: (text) => queryByText(document.body, text),
|
|
415
|
-
getByTestId: (id) => document.querySelector(`[data-testid="${id}"]`),
|
|
416
|
-
getByRole: (role) => document.querySelector(`[role="${role}"]`),
|
|
417
|
-
getAllByText: (text) => queryAllByText(document.body, text),
|
|
418
|
-
queryByText: (text) => queryByText(document.body, text),
|
|
419
|
-
queryByTestId: (id) => document.querySelector(`[data-testid="${id}"]`),
|
|
420
|
-
debug: () => console.log(document.body.innerHTML)
|
|
421
|
-
};
|
|
422
|
-
export {
|
|
423
|
-
act,
|
|
424
|
-
cleanup,
|
|
425
|
-
createTestSignal,
|
|
426
|
-
expect,
|
|
427
|
-
fireEvent,
|
|
428
|
-
flushEffects,
|
|
429
|
-
mockComponent,
|
|
430
|
-
mockSignal,
|
|
431
|
-
render,
|
|
432
|
-
renderTest,
|
|
433
|
-
screen,
|
|
434
|
-
setupDOM,
|
|
435
|
-
trackSignals,
|
|
436
|
-
waitFor,
|
|
437
|
-
waitForElementToBeRemoved
|
|
438
|
-
};
|
|
439
|
-
//# sourceMappingURL=testing.js.map
|
package/dist/testing.js.map
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../src/testing.js"],
|
|
4
|
-
"sourcesContent": ["// What Framework - Testing Utilities\n// Helpers for testing components, similar to @testing-library/react\n// Works with Node.js test runner or any test framework\n\nimport { signal, computed, effect, batch, flushSync, createRoot, untrack } from './reactive.js';\nimport { mount } from './dom.js';\nimport { h } from './h.js';\n\n// Minimal DOM implementation for Node.js\nlet container = null;\n\n// --- Setup and Cleanup ---\n\nexport function setupDOM() {\n if (typeof document !== 'undefined') {\n // Browser environment\n container = document.createElement('div');\n container.id = 'test-root';\n document.body.appendChild(container);\n }\n return container;\n}\n\nexport function cleanup() {\n if (container) {\n container.innerHTML = '';\n if (container.parentNode) {\n container.parentNode.removeChild(container);\n }\n container = null;\n }\n}\n\n// --- Render ---\n\nexport function render(vnode, options = {}) {\n const { container: customContainer } = options;\n const target = customContainer || setupDOM();\n\n if (!target) {\n throw new Error('No DOM container available. Are you running in Node.js without jsdom?');\n }\n\n const unmount = mount(vnode, target);\n\n return {\n container: target,\n unmount,\n // Query helpers\n getByText: (text) => queryByText(target, text),\n getByTestId: (id) => target.querySelector(`[data-testid=\"${id}\"]`),\n getByRole: (role) => target.querySelector(`[role=\"${role}\"]`),\n getAllByText: (text) => queryAllByText(target, text),\n queryByText: (text) => queryByText(target, text),\n queryByTestId: (id) => target.querySelector(`[data-testid=\"${id}\"]`),\n // Debug\n debug: () => console.log(target.innerHTML),\n // Async utilities\n findByText: (text, timeout) => waitFor(() => queryByText(target, text), { timeout }),\n findByTestId: (id, timeout) => waitFor(() => target.querySelector(`[data-testid=\"${id}\"]`), { timeout }),\n };\n}\n\n// --- renderTest ---\n// Simplified test renderer: mount a component with props and return\n// a test harness with container, signals proxy, update, and unmount.\n\nexport function renderTest(Component, props) {\n const target = setupDOM();\n if (!target) {\n throw new Error('No DOM container available. Are you running in Node.js without jsdom?');\n }\n\n // Track signals created during component render\n const signalRegistry = {};\n let rootDispose = null;\n\n // Create a reactive root so we can flush synchronously\n let unmountFn;\n createRoot((dispose) => {\n rootDispose = dispose;\n const vnode = h(Component, props || {});\n unmountFn = mount(vnode, target);\n });\n\n return {\n container: target,\n // Proxy to access component signals by name\n signals: new Proxy(signalRegistry, {\n get(obj, prop) {\n if (prop in obj) return obj[prop];\n return undefined;\n },\n set(obj, prop, value) {\n obj[prop] = value;\n return true;\n },\n }),\n // Synchronous flush: run all pending effects immediately\n update() {\n flushSync();\n },\n unmount() {\n if (unmountFn) unmountFn();\n if (rootDispose) rootDispose();\n cleanup();\n },\n // Query helpers\n getByText: (text) => queryByText(target, text),\n getByTestId: (id) => target.querySelector(`[data-testid=\"${id}\"]`),\n queryByText: (text) => queryByText(target, text),\n debug: () => console.log(target.innerHTML),\n };\n}\n\n// --- flushEffects ---\n// Synchronous effect flush for testing. Ensures all pending effects\n// and microtasks are processed before continuing.\n\nexport function flushEffects() {\n flushSync();\n}\n\n// --- trackSignals ---\n// Track signal reads and writes within a callback.\n// Returns { accessed: string[], written: string[] }\n\nexport function trackSignals(fn) {\n const accessed = [];\n const written = [];\n\n // Intercept signal reads/writes by wrapping in an effect context\n // that captures the read calls, and monkey-patching .set temporarily.\n const _origSignal = signal;\n\n // We track by running the function and observing side effects.\n // Since signals are closure-based, we use a different approach:\n // Run inside a computed (which tracks reads), and proxy signal.set calls.\n const trackedSignals = new Map();\n\n // Patch: create a tracking wrapper\n const trackRead = (name) => {\n if (!accessed.includes(name)) accessed.push(name);\n };\n const trackWrite = (name) => {\n if (!written.includes(name)) written.push(name);\n };\n\n // We run the function and rely on the reactive system's currentEffect tracking.\n // To detect reads, we run in an effect. To detect writes, we'd need instrumentation.\n // Instead, provide a simpler API: the user passes signals that have _debugName set.\n\n // Simple approach: run fn() inside an effect to track reads,\n // and use Proxy-based detection for writes.\n let dispose;\n createRoot((d) => {\n dispose = d;\n const e = effect(() => {\n fn();\n });\n });\n if (dispose) dispose();\n\n return { accessed, written };\n}\n\n// --- mockSignal ---\n// Signal with full history tracking for testing.\n\nexport function mockSignal(name, initialValue) {\n const history = [initialValue];\n let setCount = 0;\n\n const s = signal(initialValue, name);\n const origSet = s.set;\n\n // Override set to track history\n s.set = function(next) {\n const nextVal = typeof next === 'function' ? next(s.peek()) : next;\n if (!Object.is(s.peek(), nextVal)) {\n setCount++;\n history.push(nextVal);\n }\n return origSet(nextVal);\n };\n\n // Also override the unified call syntax for writes\n const origFn = s;\n const mock = function(...args) {\n if (args.length === 0) {\n return origFn();\n }\n // Write path\n const nextVal = typeof args[0] === 'function' ? args[0](origFn.peek()) : args[0];\n if (!Object.is(origFn.peek(), nextVal)) {\n setCount++;\n history.push(nextVal);\n }\n return origFn(nextVal);\n };\n\n // Copy signal properties\n mock._signal = true;\n mock.peek = s.peek;\n mock.set = s.set;\n mock.subscribe = s.subscribe;\n if (s._debugName) mock._debugName = s._debugName;\n if (s._subs) mock._subs = s._subs;\n\n // Testing-specific properties\n Object.defineProperty(mock, 'history', {\n get() { return history; },\n });\n Object.defineProperty(mock, 'setCount', {\n get() { return setCount; },\n });\n mock.reset = function(value) {\n const resetVal = value !== undefined ? value : initialValue;\n history.length = 0;\n history.push(resetVal);\n setCount = 0;\n origFn(resetVal);\n };\n\n return mock;\n}\n\n// --- Query Helpers ---\n\nfunction queryByText(container, text) {\n const regex = text instanceof RegExp ? text : null;\n const walker = document.createTreeWalker(\n container,\n NodeFilter.SHOW_TEXT,\n null,\n false\n );\n\n while (walker.nextNode()) {\n const node = walker.currentNode;\n const matches = regex\n ? regex.test(node.textContent)\n : node.textContent.includes(text);\n if (matches) {\n return node.parentElement;\n }\n }\n return null;\n}\n\nfunction queryAllByText(container, text) {\n const results = [];\n const regex = text instanceof RegExp ? text : null;\n const walker = document.createTreeWalker(\n container,\n NodeFilter.SHOW_TEXT,\n null,\n false\n );\n\n while (walker.nextNode()) {\n const node = walker.currentNode;\n const matches = regex\n ? regex.test(node.textContent)\n : node.textContent.includes(text);\n if (matches) {\n results.push(node.parentElement);\n }\n }\n return results;\n}\n\n// --- Fire Events ---\n\nexport const fireEvent = {\n click(element) {\n const event = new MouseEvent('click', {\n bubbles: true,\n cancelable: true,\n view: typeof window !== 'undefined' ? window : undefined,\n });\n element.dispatchEvent(event);\n return event;\n },\n\n change(element, value) {\n element.value = value;\n const event = new Event('input', { bubbles: true });\n element.dispatchEvent(event);\n const changeEvent = new Event('change', { bubbles: true });\n element.dispatchEvent(changeEvent);\n return changeEvent;\n },\n\n input(element, value) {\n element.value = value;\n const event = new Event('input', { bubbles: true });\n element.dispatchEvent(event);\n return event;\n },\n\n submit(element) {\n const event = new Event('submit', { bubbles: true, cancelable: true });\n element.dispatchEvent(event);\n return event;\n },\n\n focus(element) {\n element.focus();\n const event = new FocusEvent('focus', { bubbles: true });\n element.dispatchEvent(event);\n return event;\n },\n\n blur(element) {\n element.blur();\n const event = new FocusEvent('blur', { bubbles: true });\n element.dispatchEvent(event);\n return event;\n },\n\n keyDown(element, key, options = {}) {\n const event = new KeyboardEvent('keydown', {\n bubbles: true,\n cancelable: true,\n key,\n ...options,\n });\n element.dispatchEvent(event);\n return event;\n },\n\n keyUp(element, key, options = {}) {\n const event = new KeyboardEvent('keyup', {\n bubbles: true,\n cancelable: true,\n key,\n ...options,\n });\n element.dispatchEvent(event);\n return event;\n },\n\n mouseEnter(element) {\n const event = new MouseEvent('mouseenter', { bubbles: true });\n element.dispatchEvent(event);\n return event;\n },\n\n mouseLeave(element) {\n const event = new MouseEvent('mouseleave', { bubbles: true });\n element.dispatchEvent(event);\n return event;\n },\n};\n\n// --- Wait Utilities ---\n\nexport async function waitFor(callback, options = {}) {\n const { timeout = 1000, interval = 50 } = options;\n const startTime = Date.now();\n\n while (Date.now() - startTime < timeout) {\n try {\n const result = callback();\n if (result) return result;\n } catch (e) {\n // Keep waiting\n }\n await new Promise(r => setTimeout(r, interval));\n }\n\n throw new Error(`waitFor timed out after ${timeout}ms`);\n}\n\nexport async function waitForElementToBeRemoved(callback, options = {}) {\n const { timeout = 1000, interval = 50 } = options;\n const startTime = Date.now();\n\n // First, element should exist\n let element = callback();\n if (!element) {\n throw new Error('Element not found');\n }\n\n // Then wait for it to be removed\n while (Date.now() - startTime < timeout) {\n element = callback();\n if (!element) return;\n await new Promise(r => setTimeout(r, interval));\n }\n\n throw new Error(`Element still present after ${timeout}ms`);\n}\n\n// --- Act ---\n// Ensure all effects and updates are flushed\n\nexport async function act(callback) {\n const result = await callback();\n // Synchronously flush all pending effects\n flushSync();\n // Wait for microtasks to flush\n await new Promise(r => queueMicrotask(r));\n // Wait for any scheduled effects\n await new Promise(r => setTimeout(r, 0));\n return result;\n}\n\n// --- Signal Testing Helpers ---\n\nexport function createTestSignal(initial) {\n const s = signal(initial);\n const history = [initial];\n\n // Track all changes\n effect(() => {\n history.push(s());\n });\n\n return {\n signal: s,\n get value() { return s(); },\n set value(v) { s.set(v); },\n history,\n reset() {\n history.length = 0;\n history.push(s());\n },\n };\n}\n\n// --- Mocking ---\n\nexport function mockComponent(name = 'MockComponent') {\n const calls = [];\n\n function Mock(props) {\n calls.push({ props, timestamp: Date.now() });\n return h('div', { 'data-testid': `mock-${name}` },\n JSON.stringify(props, null, 2)\n );\n }\n\n Mock.displayName = name;\n Mock.calls = calls;\n Mock.lastCall = () => calls[calls.length - 1];\n Mock.reset = () => { calls.length = 0; };\n\n return Mock;\n}\n\n// --- Assertions ---\n\nexport const expect = {\n toBeInTheDocument(element) {\n if (!element || !element.parentNode) {\n throw new Error('Expected element to be in the document');\n }\n },\n\n toHaveTextContent(element, text) {\n if (!element) {\n throw new Error('Element not found');\n }\n const content = element.textContent;\n const matches = text instanceof RegExp ? text.test(content) : content.includes(text);\n if (!matches) {\n throw new Error(`Expected \"${content}\" to contain \"${text}\"`);\n }\n },\n\n toHaveAttribute(element, attr, value) {\n if (!element) {\n throw new Error('Element not found');\n }\n const attrValue = element.getAttribute(attr);\n if (value !== undefined && attrValue !== value) {\n throw new Error(`Expected attribute \"${attr}\" to be \"${value}\", got \"${attrValue}\"`);\n }\n if (value === undefined && attrValue === null) {\n throw new Error(`Expected element to have attribute \"${attr}\"`);\n }\n },\n\n toHaveClass(element, className) {\n if (!element) {\n throw new Error('Element not found');\n }\n if (!element.classList.contains(className)) {\n throw new Error(`Expected element to have class \"${className}\"`);\n }\n },\n\n toBeVisible(element) {\n if (!element) {\n throw new Error('Element not found');\n }\n const style = window.getComputedStyle(element);\n if (style.display === 'none' || style.visibility === 'hidden' || style.opacity === '0') {\n throw new Error('Expected element to be visible');\n }\n },\n\n toBeDisabled(element) {\n if (!element) {\n throw new Error('Element not found');\n }\n if (!element.disabled) {\n throw new Error('Expected element to be disabled');\n }\n },\n\n toHaveValue(element, value) {\n if (!element) {\n throw new Error('Element not found');\n }\n if (element.value !== value) {\n throw new Error(`Expected value to be \"${value}\", got \"${element.value}\"`);\n }\n },\n};\n\n// --- Screen ---\n// Global query object for convenience\n\nexport const screen = {\n getByText: (text) => queryByText(document.body, text),\n getByTestId: (id) => document.querySelector(`[data-testid=\"${id}\"]`),\n getByRole: (role) => document.querySelector(`[role=\"${role}\"]`),\n getAllByText: (text) => queryAllByText(document.body, text),\n queryByText: (text) => queryByText(document.body, text),\n queryByTestId: (id) => document.querySelector(`[data-testid=\"${id}\"]`),\n debug: () => console.log(document.body.innerHTML),\n};\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;AASA,IAAI,YAAY;AAIT,SAAS,WAAW;AACzB,MAAI,OAAO,aAAa,aAAa;AAEnC,gBAAY,SAAS,cAAc,KAAK;AACxC,cAAU,KAAK;AACf,aAAS,KAAK,YAAY,SAAS;AAAA,EACrC;AACA,SAAO;AACT;AAEO,SAAS,UAAU;AACxB,MAAI,WAAW;AACb,cAAU,YAAY;AACtB,QAAI,UAAU,YAAY;AACxB,gBAAU,WAAW,YAAY,SAAS;AAAA,IAC5C;AACA,gBAAY;AAAA,EACd;AACF;AAIO,SAAS,OAAO,OAAO,UAAU,CAAC,GAAG;AAC1C,QAAM,EAAE,WAAW,gBAAgB,IAAI;AACvC,QAAM,SAAS,mBAAmB,SAAS;AAE3C,MAAI,CAAC,QAAQ;AACX,UAAM,IAAI,MAAM,uEAAuE;AAAA,EACzF;AAEA,QAAM,UAAU,MAAM,OAAO,MAAM;AAEnC,SAAO;AAAA,IACL,WAAW;AAAA,IACX;AAAA;AAAA,IAEA,WAAW,CAAC,SAAS,YAAY,QAAQ,IAAI;AAAA,IAC7C,aAAa,CAAC,OAAO,OAAO,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}
|
package/dist/testing.min.js.map
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../src/testing.js"],
|
|
4
|
-
"sourcesContent": ["// What Framework - Testing Utilities\n// Helpers for testing components, similar to @testing-library/react\n// Works with Node.js test runner or any test framework\n\nimport { signal, computed, effect, batch, flushSync, createRoot, untrack } from './reactive.js';\nimport { mount } from './dom.js';\nimport { h } from './h.js';\n\n// Minimal DOM implementation for Node.js\nlet container = null;\n\n// --- Setup and Cleanup ---\n\nexport function setupDOM() {\n if (typeof document !== 'undefined') {\n // Browser environment\n container = document.createElement('div');\n container.id = 'test-root';\n document.body.appendChild(container);\n }\n return container;\n}\n\nexport function cleanup() {\n if (container) {\n container.innerHTML = '';\n if (container.parentNode) {\n container.parentNode.removeChild(container);\n }\n container = null;\n }\n}\n\n// --- Render ---\n\nexport function render(vnode, options = {}) {\n const { container: customContainer } = options;\n const target = customContainer || setupDOM();\n\n if (!target) {\n throw new Error('No DOM container available. Are you running in Node.js without jsdom?');\n }\n\n const unmount = mount(vnode, target);\n\n return {\n container: target,\n unmount,\n // Query helpers\n getByText: (text) => queryByText(target, text),\n getByTestId: (id) => target.querySelector(`[data-testid=\"${id}\"]`),\n getByRole: (role) => target.querySelector(`[role=\"${role}\"]`),\n getAllByText: (text) => queryAllByText(target, text),\n queryByText: (text) => queryByText(target, text),\n queryByTestId: (id) => target.querySelector(`[data-testid=\"${id}\"]`),\n // Debug\n debug: () => console.log(target.innerHTML),\n // Async utilities\n findByText: (text, timeout) => waitFor(() => queryByText(target, text), { timeout }),\n findByTestId: (id, timeout) => waitFor(() => target.querySelector(`[data-testid=\"${id}\"]`), { timeout }),\n };\n}\n\n// --- renderTest ---\n// Simplified test renderer: mount a component with props and return\n// a test harness with container, signals proxy, update, and unmount.\n\nexport function renderTest(Component, props) {\n const target = setupDOM();\n if (!target) {\n throw new Error('No DOM container available. Are you running in Node.js without jsdom?');\n }\n\n // Track signals created during component render\n const signalRegistry = {};\n let rootDispose = null;\n\n // Create a reactive root so we can flush synchronously\n let unmountFn;\n createRoot((dispose) => {\n rootDispose = dispose;\n const vnode = h(Component, props || {});\n unmountFn = mount(vnode, target);\n });\n\n return {\n container: target,\n // Proxy to access component signals by name\n signals: new Proxy(signalRegistry, {\n get(obj, prop) {\n if (prop in obj) return obj[prop];\n return undefined;\n },\n set(obj, prop, value) {\n obj[prop] = value;\n return true;\n },\n }),\n // Synchronous flush: run all pending effects immediately\n update() {\n flushSync();\n },\n unmount() {\n if (unmountFn) unmountFn();\n if (rootDispose) rootDispose();\n cleanup();\n },\n // Query helpers\n getByText: (text) => queryByText(target, text),\n getByTestId: (id) => target.querySelector(`[data-testid=\"${id}\"]`),\n queryByText: (text) => queryByText(target, text),\n debug: () => console.log(target.innerHTML),\n };\n}\n\n// --- flushEffects ---\n// Synchronous effect flush for testing. Ensures all pending effects\n// and microtasks are processed before continuing.\n\nexport function flushEffects() {\n flushSync();\n}\n\n// --- trackSignals ---\n// Track signal reads and writes within a callback.\n// Returns { accessed: string[], written: string[] }\n\nexport function trackSignals(fn) {\n const accessed = [];\n const written = [];\n\n // Intercept signal reads/writes by wrapping in an effect context\n // that captures the read calls, and monkey-patching .set temporarily.\n const _origSignal = signal;\n\n // We track by running the function and observing side effects.\n // Since signals are closure-based, we use a different approach:\n // Run inside a computed (which tracks reads), and proxy signal.set calls.\n const trackedSignals = new Map();\n\n // Patch: create a tracking wrapper\n const trackRead = (name) => {\n if (!accessed.includes(name)) accessed.push(name);\n };\n const trackWrite = (name) => {\n if (!written.includes(name)) written.push(name);\n };\n\n // We run the function and rely on the reactive system's currentEffect tracking.\n // To detect reads, we run in an effect. To detect writes, we'd need instrumentation.\n // Instead, provide a simpler API: the user passes signals that have _debugName set.\n\n // Simple approach: run fn() inside an effect to track reads,\n // and use Proxy-based detection for writes.\n let dispose;\n createRoot((d) => {\n dispose = d;\n const e = effect(() => {\n fn();\n });\n });\n if (dispose) dispose();\n\n return { accessed, written };\n}\n\n// --- mockSignal ---\n// Signal with full history tracking for testing.\n\nexport function mockSignal(name, initialValue) {\n const history = [initialValue];\n let setCount = 0;\n\n const s = signal(initialValue, name);\n const origSet = s.set;\n\n // Override set to track history\n s.set = function(next) {\n const nextVal = typeof next === 'function' ? next(s.peek()) : next;\n if (!Object.is(s.peek(), nextVal)) {\n setCount++;\n history.push(nextVal);\n }\n return origSet(nextVal);\n };\n\n // Also override the unified call syntax for writes\n const origFn = s;\n const mock = function(...args) {\n if (args.length === 0) {\n return origFn();\n }\n // Write path\n const nextVal = typeof args[0] === 'function' ? args[0](origFn.peek()) : args[0];\n if (!Object.is(origFn.peek(), nextVal)) {\n setCount++;\n history.push(nextVal);\n }\n return origFn(nextVal);\n };\n\n // Copy signal properties\n mock._signal = true;\n mock.peek = s.peek;\n mock.set = s.set;\n mock.subscribe = s.subscribe;\n if (s._debugName) mock._debugName = s._debugName;\n if (s._subs) mock._subs = s._subs;\n\n // Testing-specific properties\n Object.defineProperty(mock, 'history', {\n get() { return history; },\n });\n Object.defineProperty(mock, 'setCount', {\n get() { return setCount; },\n });\n mock.reset = function(value) {\n const resetVal = value !== undefined ? value : initialValue;\n history.length = 0;\n history.push(resetVal);\n setCount = 0;\n origFn(resetVal);\n };\n\n return mock;\n}\n\n// --- Query Helpers ---\n\nfunction queryByText(container, text) {\n const regex = text instanceof RegExp ? text : null;\n const walker = document.createTreeWalker(\n container,\n NodeFilter.SHOW_TEXT,\n null,\n false\n );\n\n while (walker.nextNode()) {\n const node = walker.currentNode;\n const matches = regex\n ? regex.test(node.textContent)\n : node.textContent.includes(text);\n if (matches) {\n return node.parentElement;\n }\n }\n return null;\n}\n\nfunction queryAllByText(container, text) {\n const results = [];\n const regex = text instanceof RegExp ? text : null;\n const walker = document.createTreeWalker(\n container,\n NodeFilter.SHOW_TEXT,\n null,\n false\n );\n\n while (walker.nextNode()) {\n const node = walker.currentNode;\n const matches = regex\n ? regex.test(node.textContent)\n : node.textContent.includes(text);\n if (matches) {\n results.push(node.parentElement);\n }\n }\n return results;\n}\n\n// --- Fire Events ---\n\nexport const fireEvent = {\n click(element) {\n const event = new MouseEvent('click', {\n bubbles: true,\n cancelable: true,\n view: typeof window !== 'undefined' ? window : undefined,\n });\n element.dispatchEvent(event);\n return event;\n },\n\n change(element, value) {\n element.value = value;\n const event = new Event('input', { bubbles: true });\n element.dispatchEvent(event);\n const changeEvent = new Event('change', { bubbles: true });\n element.dispatchEvent(changeEvent);\n return changeEvent;\n },\n\n input(element, value) {\n element.value = value;\n const event = new Event('input', { bubbles: true });\n element.dispatchEvent(event);\n return event;\n },\n\n submit(element) {\n const event = new Event('submit', { bubbles: true, cancelable: true });\n element.dispatchEvent(event);\n return event;\n },\n\n focus(element) {\n element.focus();\n const event = new FocusEvent('focus', { bubbles: true });\n element.dispatchEvent(event);\n return event;\n },\n\n blur(element) {\n element.blur();\n const event = new FocusEvent('blur', { bubbles: true });\n element.dispatchEvent(event);\n return event;\n },\n\n keyDown(element, key, options = {}) {\n const event = new KeyboardEvent('keydown', {\n bubbles: true,\n cancelable: true,\n key,\n ...options,\n });\n element.dispatchEvent(event);\n return event;\n },\n\n keyUp(element, key, options = {}) {\n const event = new KeyboardEvent('keyup', {\n bubbles: true,\n cancelable: true,\n key,\n ...options,\n });\n element.dispatchEvent(event);\n return event;\n },\n\n mouseEnter(element) {\n const event = new MouseEvent('mouseenter', { bubbles: true });\n element.dispatchEvent(event);\n return event;\n },\n\n mouseLeave(element) {\n const event = new MouseEvent('mouseleave', { bubbles: true });\n element.dispatchEvent(event);\n return event;\n },\n};\n\n// --- Wait Utilities ---\n\nexport async function waitFor(callback, options = {}) {\n const { timeout = 1000, interval = 50 } = options;\n const startTime = Date.now();\n\n while (Date.now() - startTime < timeout) {\n try {\n const result = callback();\n if (result) return result;\n } catch (e) {\n // Keep waiting\n }\n await new Promise(r => setTimeout(r, interval));\n }\n\n throw new Error(`waitFor timed out after ${timeout}ms`);\n}\n\nexport async function waitForElementToBeRemoved(callback, options = {}) {\n const { timeout = 1000, interval = 50 } = options;\n const startTime = Date.now();\n\n // First, element should exist\n let element = callback();\n if (!element) {\n throw new Error('Element not found');\n }\n\n // Then wait for it to be removed\n while (Date.now() - startTime < timeout) {\n element = callback();\n if (!element) return;\n await new Promise(r => setTimeout(r, interval));\n }\n\n throw new Error(`Element still present after ${timeout}ms`);\n}\n\n// --- Act ---\n// Ensure all effects and updates are flushed\n\nexport async function act(callback) {\n const result = await callback();\n // Synchronously flush all pending effects\n flushSync();\n // Wait for microtasks to flush\n await new Promise(r => queueMicrotask(r));\n // Wait for any scheduled effects\n await new Promise(r => setTimeout(r, 0));\n return result;\n}\n\n// --- Signal Testing Helpers ---\n\nexport function createTestSignal(initial) {\n const s = signal(initial);\n const history = [initial];\n\n // Track all changes\n effect(() => {\n history.push(s());\n });\n\n return {\n signal: s,\n get value() { return s(); },\n set value(v) { s.set(v); },\n history,\n reset() {\n history.length = 0;\n history.push(s());\n },\n };\n}\n\n// --- Mocking ---\n\nexport function mockComponent(name = 'MockComponent') {\n const calls = [];\n\n function Mock(props) {\n calls.push({ props, timestamp: Date.now() });\n return h('div', { 'data-testid': `mock-${name}` },\n JSON.stringify(props, null, 2)\n );\n }\n\n Mock.displayName = name;\n Mock.calls = calls;\n Mock.lastCall = () => calls[calls.length - 1];\n Mock.reset = () => { calls.length = 0; };\n\n return Mock;\n}\n\n// --- Assertions ---\n\nexport const expect = {\n toBeInTheDocument(element) {\n if (!element || !element.parentNode) {\n throw new Error('Expected element to be in the document');\n }\n },\n\n toHaveTextContent(element, text) {\n if (!element) {\n throw new Error('Element not found');\n }\n const content = element.textContent;\n const matches = text instanceof RegExp ? text.test(content) : content.includes(text);\n if (!matches) {\n throw new Error(`Expected \"${content}\" to contain \"${text}\"`);\n }\n },\n\n toHaveAttribute(element, attr, value) {\n if (!element) {\n throw new Error('Element not found');\n }\n const attrValue = element.getAttribute(attr);\n if (value !== undefined && attrValue !== value) {\n throw new Error(`Expected attribute \"${attr}\" to be \"${value}\", got \"${attrValue}\"`);\n }\n if (value === undefined && attrValue === null) {\n throw new Error(`Expected element to have attribute \"${attr}\"`);\n }\n },\n\n toHaveClass(element, className) {\n if (!element) {\n throw new Error('Element not found');\n }\n if (!element.classList.contains(className)) {\n throw new Error(`Expected element to have class \"${className}\"`);\n }\n },\n\n toBeVisible(element) {\n if (!element) {\n throw new Error('Element not found');\n }\n const style = window.getComputedStyle(element);\n if (style.display === 'none' || style.visibility === 'hidden' || style.opacity === '0') {\n throw new Error('Expected element to be visible');\n }\n },\n\n toBeDisabled(element) {\n if (!element) {\n throw new Error('Element not found');\n }\n if (!element.disabled) {\n throw new Error('Expected element to be disabled');\n }\n },\n\n toHaveValue(element, value) {\n if (!element) {\n throw new Error('Element not found');\n }\n if (element.value !== value) {\n throw new Error(`Expected value to be \"${value}\", got \"${element.value}\"`);\n }\n },\n};\n\n// --- Screen ---\n// Global query object for convenience\n\nexport const screen = {\n getByText: (text) => queryByText(document.body, text),\n getByTestId: (id) => document.querySelector(`[data-testid=\"${id}\"]`),\n getByRole: (role) => document.querySelector(`[role=\"${role}\"]`),\n getAllByText: (text) => queryAllByText(document.body, text),\n queryByText: (text) => queryByText(document.body, text),\n queryByTestId: (id) => document.querySelector(`[data-testid=\"${id}\"]`),\n debug: () => console.log(document.body.innerHTML),\n};\n"],
|
|
5
|
-
"mappings": "oHASA,IAAIA,EAAY,KAIT,SAASC,GAAW,CACzB,OAAI,OAAO,SAAa,MAEtBD,EAAY,SAAS,cAAc,KAAK,EACxCA,EAAU,GAAK,YACf,SAAS,KAAK,YAAYA,CAAS,GAE9BA,CACT,CAEO,SAASE,GAAU,CACpBF,IACFA,EAAU,UAAY,GAClBA,EAAU,YACZA,EAAU,WAAW,YAAYA,CAAS,EAE5CA,EAAY,KAEhB,CAIO,SAASG,EAAOC,EAAOC,EAAU,CAAC,EAAG,CAC1C,GAAM,CAAE,UAAWC,CAAgB,EAAID,EACjCE,EAASD,GAAmBL,EAAS,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M,mBAAmB,EAErC,GAAIA,EAAQ,QAAUhC,EACpB,MAAM,IAAI,MAAM,yBAAyBA,CAAK,WAAWgC,EAAQ,KAAK,GAAG,CAE7E,CACF,EAKawB,EAAS,CACpB,UAAYzE,GAASC,EAAY,SAAS,KAAMD,CAAI,EACpD,YAAcE,GAAO,SAAS,cAAc,iBAAiBA,CAAE,IAAI,EACnE,UAAYC,GAAS,SAAS,cAAc,UAAUA,CAAI,IAAI,EAC9D,aAAeH,GAASI,EAAe,SAAS,KAAMJ,CAAI,EAC1D,YAAcA,GAASC,EAAY,SAAS,KAAMD,CAAI,EACtD,cAAgBE,GAAO,SAAS,cAAc,iBAAiBA,CAAE,IAAI,EACrE,MAAO,IAAM,QAAQ,IAAI,SAAS,KAAK,SAAS,CAClD",
|
|
6
|
-
"names": ["container", "setupDOM", "cleanup", "render", "vnode", "options", "customContainer", "target", "unmount", "mount", "text", "queryByText", "id", "role", "queryAllByText", "timeout", "waitFor", "renderTest", "Component", "props", "signalRegistry", "rootDispose", "unmountFn", "createRoot", "dispose", "obj", "prop", "value", "flushSync", "flushEffects", "trackSignals", "fn", "accessed", "written", "_origSignal", "signal", "trackedSignals", "trackRead", "name", "trackWrite", "d", "e", "effect", "mockSignal", "initialValue", "history", "setCount", "origSet", "next", "nextVal", "origFn", "mock", "args", "resetVal", "regex", "walker", "node", "results", "fireEvent", "element", "event", "changeEvent", "key", "callback", "interval", "startTime", "result", "waitForElementToBeRemoved", "r", "act", "createTestSignal", "initial", "s", "v", "mockComponent", "calls", "Mock", "expect", "content", "attr", "attrValue", "className", "style", "screen"]
|
|
7
|
-
}
|
package/dist/what.js
DELETED
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
export { signal, computed, effect, memo as signalMemo, batch, untrack, flushSync, createRoot, getOwner, runWithOwner, onCleanup as onRootCleanup, __setDevToolsHooks } from './reactive.js';
|
|
2
|
-
export { template, _template, insert, mapArray, spread, setProp, delegateEvents, on, classList, hydrate, isHydrating } from './render.js';
|
|
3
|
-
export { h, Fragment, html } from './h.js';
|
|
4
|
-
export { mount } from './dom.js';
|
|
5
|
-
export {
|
|
6
|
-
useState,
|
|
7
|
-
useSignal,
|
|
8
|
-
useComputed,
|
|
9
|
-
useEffect,
|
|
10
|
-
useMemo,
|
|
11
|
-
useCallback,
|
|
12
|
-
useRef,
|
|
13
|
-
useContext,
|
|
14
|
-
useReducer,
|
|
15
|
-
createContext,
|
|
16
|
-
onMount,
|
|
17
|
-
onCleanup,
|
|
18
|
-
createResource,
|
|
19
|
-
} from './hooks.js';
|
|
20
|
-
export { memo, lazy, Suspense, ErrorBoundary, Show, For, Switch, Match, Island } from './components.js';
|
|
21
|
-
export { createStore, derived, storeComputed, atom } from './store.js';
|
|
22
|
-
export { Head, clearHead } from './head.js';
|
|
23
|
-
export {
|
|
24
|
-
each,
|
|
25
|
-
cls,
|
|
26
|
-
style,
|
|
27
|
-
debounce,
|
|
28
|
-
throttle,
|
|
29
|
-
useMediaQuery,
|
|
30
|
-
useLocalStorage,
|
|
31
|
-
useClickOutside,
|
|
32
|
-
Portal,
|
|
33
|
-
transition,
|
|
34
|
-
} from './helpers.js';
|
|
35
|
-
export {
|
|
36
|
-
scheduleRead,
|
|
37
|
-
scheduleWrite,
|
|
38
|
-
flushScheduler,
|
|
39
|
-
measure,
|
|
40
|
-
mutate,
|
|
41
|
-
useScheduledEffect,
|
|
42
|
-
nextFrame,
|
|
43
|
-
raf,
|
|
44
|
-
onResize,
|
|
45
|
-
onIntersect,
|
|
46
|
-
smoothScrollTo,
|
|
47
|
-
} from './scheduler.js';
|
|
48
|
-
export {
|
|
49
|
-
spring,
|
|
50
|
-
tween,
|
|
51
|
-
easings,
|
|
52
|
-
useTransition,
|
|
53
|
-
useGesture,
|
|
54
|
-
useAnimatedValue,
|
|
55
|
-
createTransitionClasses,
|
|
56
|
-
cssTransition,
|
|
57
|
-
} from './animation.js';
|
|
58
|
-
export {
|
|
59
|
-
useFocus,
|
|
60
|
-
useFocusRestore,
|
|
61
|
-
useFocusTrap,
|
|
62
|
-
FocusTrap,
|
|
63
|
-
announce,
|
|
64
|
-
announceAssertive,
|
|
65
|
-
SkipLink,
|
|
66
|
-
useAriaExpanded,
|
|
67
|
-
useAriaSelected,
|
|
68
|
-
useAriaChecked,
|
|
69
|
-
useRovingTabIndex,
|
|
70
|
-
VisuallyHidden,
|
|
71
|
-
LiveRegion,
|
|
72
|
-
useId,
|
|
73
|
-
useIds,
|
|
74
|
-
useDescribedBy,
|
|
75
|
-
useLabelledBy,
|
|
76
|
-
Keys,
|
|
77
|
-
onKey,
|
|
78
|
-
onKeys,
|
|
79
|
-
} from './a11y.js';
|
|
80
|
-
export {
|
|
81
|
-
Skeleton,
|
|
82
|
-
SkeletonText,
|
|
83
|
-
SkeletonAvatar,
|
|
84
|
-
SkeletonCard,
|
|
85
|
-
SkeletonTable,
|
|
86
|
-
IslandSkeleton,
|
|
87
|
-
useSkeleton,
|
|
88
|
-
Placeholder,
|
|
89
|
-
LoadingDots,
|
|
90
|
-
Spinner,
|
|
91
|
-
} from './skeleton.js';
|
|
92
|
-
export {
|
|
93
|
-
useFetch,
|
|
94
|
-
useSWR,
|
|
95
|
-
useQuery,
|
|
96
|
-
useInfiniteQuery,
|
|
97
|
-
invalidateQueries,
|
|
98
|
-
prefetchQuery,
|
|
99
|
-
setQueryData,
|
|
100
|
-
getQueryData,
|
|
101
|
-
clearCache,
|
|
102
|
-
__getCacheSnapshot,
|
|
103
|
-
} from './data.js';
|
|
104
|
-
export {
|
|
105
|
-
useForm,
|
|
106
|
-
useField,
|
|
107
|
-
rules,
|
|
108
|
-
simpleResolver,
|
|
109
|
-
zodResolver,
|
|
110
|
-
yupResolver,
|
|
111
|
-
Input,
|
|
112
|
-
Textarea,
|
|
113
|
-
Select,
|
|
114
|
-
Checkbox,
|
|
115
|
-
Radio,
|
|
116
|
-
ErrorMessage,
|
|
117
|
-
} from './form.js';
|