mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-11-16 20:11:08 +00:00
fix(ci): wait for plugin log dialog focus cleanup
This commit is contained in:
1 parent
db3a9e88e2
commit
0cb540c3f8
1 file changed
+7
-1
@@ -66,9 +66,15 @@ test('local logging controls default off, disclose verbose risk, and call host-o
|
||||
assert.match(document.querySelector('[role=alert]')!.textContent!, /synthetic preferences write failed/);
|
||||
await act(async () => button('Close').click());
|
||||
assert.equal(document.querySelector('[role=dialog]'), null);
|
||||
assert.equal(document.activeElement, configure);
|
||||
// Radix restores focus in a setTimeout(0) after the dialog unmounts.
|
||||
// act() can finish before that timer, so drain it before checking focus.
|
||||
await new Promise((resolve) => setTimeout(resolve, 0));
|
||||
// Comparing DOM objects directly makes Node inspect the entire JSDOM graph
|
||||
// on failure, which can stall the test process while formatting the diff.
|
||||
assert.ok(document.activeElement === configure, `expected focus on Configure, got ${document.activeElement?.tagName}`);
|
||||
} finally {
|
||||
await act(async () => root.unmount());
|
||||
await new Promise((resolve) => setTimeout(resolve, 0));
|
||||
dom.window.close();
|
||||
for (const [key, descriptor] of previous) {
|
||||
if (descriptor) Object.defineProperty(globalThis, key, descriptor);
|
||||
|
||||
Reference in new issue
Block a user