Keep media selections explicit across refreshed catalogs and let page playback commands progress while buffering. Align file availability with eligible sources, restore independent rooms after policy refusal, and retain pending Unicode releases. Correct Android root failure reporting, bookmark refresh, lazy-module guidance and compact playback feedback; use the shared native modal backdrop for the title bar.
29 lines
1.5 KiB
TypeScript
29 lines
1.5 KiB
TypeScript
import { createElement } from "react";
|
|
import { renderToStaticMarkup } from "react-dom/server";
|
|
import { expect, test, vi } from "vitest";
|
|
import { ChannelSettingsError } from "../src/client/channel/components/ChannelSettingsDialog";
|
|
import { installDeferredModuleFailureTracking, isDeferredModuleFailure } from "../src/client/lib/deferred-module-failure";
|
|
import { currentLang, t } from "../src/client/ui/copy";
|
|
|
|
test("deferred module failures show a user-triggered refresh in the shared result", () => {
|
|
const target = new EventTarget();
|
|
vi.stubGlobal("window", target);
|
|
try {
|
|
installDeferredModuleFailureTracking();
|
|
} finally {
|
|
vi.unstubAllGlobals();
|
|
}
|
|
const error = new TypeError("The operation failed");
|
|
const event = Object.assign(new Event("vite:preloadError", { cancelable: true }), { payload: error });
|
|
expect(target.dispatchEvent(event)).toBe(true);
|
|
expect(isDeferredModuleFailure(error)).toBe(true);
|
|
expect(isDeferredModuleFailure(new TypeError(error.message))).toBe(false);
|
|
|
|
const html = renderToStaticMarkup(createElement(ChannelSettingsError, { error: "deferred_module_load_failed" }));
|
|
expect(html).toContain(t(currentLang(), "channel.error.deferredModuleLoad"));
|
|
expect(html).toContain(`aria-label="${t(currentLang(), "common.refresh")}"`);
|
|
const ordinaryResult = renderToStaticMarkup(createElement(ChannelSettingsError, { error: "operation_failed" }));
|
|
expect(ordinaryResult).toContain(t(currentLang(), "channel.error.actionFailed"));
|
|
expect(ordinaryResult).not.toContain("<button");
|
|
});
|