mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-07-31 12:22:14 +03:00
This commit is contained in:
committed by
GitHub
parent
cdb4998ea4
commit
d84ccbc67c
1
changelog.d/fixes/7161-free-pool-handletogglesource.md
Normal file
1
changelog.d/fixes/7161-free-pool-handletogglesource.md
Normal file
@@ -0,0 +1 @@
|
||||
- fix(dashboard): implement missing `handleToggleSource` callback on the Free Pool tab so the page no longer crashes with a `ReferenceError` (#7161)
|
||||
@@ -139,6 +139,16 @@ export default function FreePoolTab() {
|
||||
});
|
||||
};
|
||||
|
||||
const handleToggleSource = (source: SourceId) => {
|
||||
setDisabledSources((prev) => {
|
||||
const next = new Set(prev);
|
||||
if (next.has(source)) next.delete(source);
|
||||
else next.add(source);
|
||||
saveDisabledSources(next);
|
||||
return next;
|
||||
});
|
||||
};
|
||||
|
||||
const handleToggleSelect = (id: string) => {
|
||||
setSelected((prev) => {
|
||||
const next = new Set(prev);
|
||||
|
||||
@@ -91,13 +91,13 @@ afterEach(() => {
|
||||
// ── Tests ─────────────────────────────────────────────────────────────────────
|
||||
|
||||
describe("FreePoolTab source toggles", () => {
|
||||
it("renders a toggle group with exactly 3 buttons", async () => {
|
||||
it("renders a toggle group with exactly 4 buttons", async () => {
|
||||
const el = renderTab();
|
||||
await waitForCondition(() => el.querySelector("[role='group']") !== null);
|
||||
const bar = el.querySelector("[role='group']")!;
|
||||
expect(bar).toBeTruthy();
|
||||
const buttons = bar.querySelectorAll("button");
|
||||
expect(buttons.length).toBe(3);
|
||||
expect(buttons.length).toBe(4);
|
||||
});
|
||||
|
||||
it("all toggles start enabled (aria-pressed=true)", async () => {
|
||||
@@ -160,7 +160,7 @@ describe("FreePoolTab source toggles", () => {
|
||||
expect(stored).toContain("1proxy");
|
||||
});
|
||||
|
||||
it("button labels are 1proxy, Proxifly, IPLocate", async () => {
|
||||
it("button labels are 1proxy, Proxifly, IPLocate, Webshare", async () => {
|
||||
const el = renderTab();
|
||||
await waitForCondition(() => el.querySelector("[role='group']") !== null);
|
||||
const texts = Array.from(el.querySelector("[role='group']")!.querySelectorAll("button")).map(
|
||||
@@ -169,6 +169,7 @@ describe("FreePoolTab source toggles", () => {
|
||||
expect(texts).toContain("1proxy");
|
||||
expect(texts).toContain("Proxifly");
|
||||
expect(texts).toContain("IPLocate");
|
||||
expect(texts).toContain("Webshare");
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user