fix(updates): sync entry-point states after component updates
This commit is contained in:
7 files changed
+86
-7
No files matched your search
@@ -26,6 +26,23 @@ describe("plugin center integration", () => {
|
||||
expect(driverStoreSource).not.toContain("PluginContributionsPanel");
|
||||
});
|
||||
|
||||
it("refreshes toolbar update state after manual and component update checks", () => {
|
||||
expect(appSource).toContain('if (componentRefresh.status === "fulfilled" && componentRefresh.value) syncToolbarComponentUpdateState()');
|
||||
expect(appSource).toContain("if (result.failed.length === 0) syncToolbarComponentUpdateState()");
|
||||
expect(appSource).toContain("function syncToolbarComponentUpdateState()");
|
||||
});
|
||||
|
||||
it("refreshes all update sources in the background whenever the update center opens", () => {
|
||||
expect(appSource).toContain("function handleToolbarUpdateClick() {\n showUpdateDialog.value = true;\n if (!checkingAllUpdates.value) void checkAllUpdates();\n}");
|
||||
});
|
||||
|
||||
it("refreshes the plugin center after component-level plugin updates", () => {
|
||||
expect(appSource).toContain("notifyComponentPluginsUpdated()");
|
||||
expect(pluginCenterSource).toContain("COMPONENT_PLUGINS_UPDATED_EVENT");
|
||||
expect(pluginCenterSource).toContain("window.addEventListener(COMPONENT_PLUGINS_UPDATED_EVENT, handleComponentPluginsUpdated)");
|
||||
expect(pluginCenterSource).toContain("installedPlugins.value = await api.listPlugins()");
|
||||
});
|
||||
|
||||
it("formats structured backend errors for local and URL package installs", () => {
|
||||
const localInstall = pluginCenterSource.slice(pluginCenterSource.indexOf("async function installPlugin("), pluginCenterSource.indexOf("function isHttpPackageUrl("));
|
||||
const urlInstall = pluginCenterSource.slice(pluginCenterSource.indexOf("async function installPluginFromUrl("), pluginCenterSource.indexOf("const urlProgressPercent"));
|
||||
|
||||
@@ -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