mirror of
https://github.com/openclaw/openclaw.git
synced 2026-10-03 01:29:56 +00:00
test: retire sidebar indicator fixtures before later visibility events (#156408)
This commit is contained in:
parent
a78f122918
commit
b2727e7663
1 changed files with 12 additions and 0 deletions
|
|
@ -14,11 +14,17 @@ import type { SessionCapability } from "../lib/sessions/index.ts";
|
|||
import { SessionPullRequestIndicatorsController } from "./app-sidebar-session-pr-indicators.ts";
|
||||
import type { SidebarRecentSession } from "./app-sidebar-session-types.ts";
|
||||
|
||||
const testHosts = new Set<TestHost>();
|
||||
|
||||
class TestHost implements ReactiveControllerHost {
|
||||
readonly controllers: ReactiveController[] = [];
|
||||
readonly requestUpdate = vi.fn();
|
||||
readonly updateComplete = Promise.resolve(true);
|
||||
|
||||
constructor() {
|
||||
testHosts.add(this);
|
||||
}
|
||||
|
||||
addController(controller: ReactiveController): void {
|
||||
this.controllers.push(controller);
|
||||
}
|
||||
|
|
@ -120,6 +126,12 @@ function createGatewayHarness() {
|
|||
}
|
||||
|
||||
afterEach(() => {
|
||||
for (const host of testHosts) {
|
||||
for (const controller of host.controllers) {
|
||||
controller.hostDisconnected?.();
|
||||
}
|
||||
}
|
||||
testHosts.clear();
|
||||
document.querySelectorAll(LIFECYCLE_HOST_TAG).forEach((host) => host.remove());
|
||||
vi.useRealTimers();
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue