fix(updates): sync entry-point states after component updates
This commit is contained in:
7 files changed
+86
-7
No files matched your search
@@ -0,0 +1,16 @@
|
||||
// @vitest-environment happy-dom
|
||||
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
import { COMPONENT_PLUGINS_UPDATED_EVENT, notifyComponentPluginsUpdated } from "@/lib/updates/componentUpdateEvents";
|
||||
|
||||
describe("component update events", () => {
|
||||
it("notifies plugin surfaces after component-level plugin updates", () => {
|
||||
const listener = vi.fn();
|
||||
window.addEventListener(COMPONENT_PLUGINS_UPDATED_EVENT, listener);
|
||||
|
||||
notifyComponentPluginsUpdated();
|
||||
|
||||
expect(listener).toHaveBeenCalledOnce();
|
||||
window.removeEventListener(COMPONENT_PLUGINS_UPDATED_EVENT, listener);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,5 @@
|
||||
export const COMPONENT_PLUGINS_UPDATED_EVENT = "dbx:component-plugins-updated";
|
||||
|
||||
export function notifyComponentPluginsUpdated(): void {
|
||||
window.dispatchEvent(new Event(COMPONENT_PLUGINS_UPDATED_EVENT));
|
||||
}
|
||||
Reference in new issue
Block a user