



























@@ -14,6 +14,16 @@ function expectButtonByText(container: Element, text: string): HTMLButtonElement
1414return button;
1515}
161617+function expectRowByLabel(container: Element, text: string): HTMLElement {
18+const row = Array.from(container.querySelectorAll<HTMLElement>(".qs-row")).find(
19+(candidate) => candidate.querySelector(".qs-row__label")?.textContent?.trim() === text,
20+);
21+if (!(row instanceof HTMLElement)) {
22+throw new Error(`Expected quick settings row "${text}"`);
23+}
24+return row;
25+}
26+1727function expectFileInput(input: Element | null | undefined): HTMLInputElement {
1828if (!(input instanceof HTMLInputElement)) {
1929throw new Error("Expected file input");
@@ -143,9 +153,9 @@ describe("renderQuickSettings", () => {
143153container,
144154);
145155146-const browserInput = Array.from(container.querySelectorAll("input")).find((input) =>
147- input.closest(".qs-row")?.textContent?.includes("Browser enabled"),
148-);
156+const browserRow = expectRowByLabel(container, "Browser enabled");
157+expect(browserRow.querySelector(".qs-toggle__hint")?.textContent).toBe("Disabled");
158+const browserInput = browserRow.querySelector("input");
149159expect(browserInput).toBeInstanceOf(HTMLInputElement);
150160expect((browserInput as HTMLInputElement).checked).toBe(false);
151161此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。