diff --git a/src/lib/components/dialog/dialog.test.ts b/src/lib/components/dialog/dialog.test.ts index 28484e3..7beb7f8 100644 --- a/src/lib/components/dialog/dialog.test.ts +++ b/src/lib/components/dialog/dialog.test.ts @@ -25,20 +25,20 @@ import { click, Keys, press } from "$lib/test-utils/interactions"; import Transition from "$lib/components/transitions/TransitionRoot.svelte"; import { tick } from "svelte"; -let id = 0; +let mockId = 0; jest.mock("../../hooks/use-id", () => { return { - useId: jest.fn(() => ++id), + useId: jest.fn(() => ++mockId), }; }); // @ts-expect-error global.IntersectionObserver = class FakeIntersectionObserver { - observe() {} - disconnect() {} + observe() { } + disconnect() { } }; -beforeEach(() => (id = 0)); +beforeEach(() => (mockId = 0)); afterAll(() => jest.restoreAllMocks()); describe("Safe guards", () => { diff --git a/src/lib/components/disclosure/disclosure.test.ts b/src/lib/components/disclosure/disclosure.test.ts index eb7cc8d..ef14e0b 100644 --- a/src/lib/components/disclosure/disclosure.test.ts +++ b/src/lib/components/disclosure/disclosure.test.ts @@ -15,14 +15,14 @@ import { click, Keys, MouseButton, press } from "$lib/test-utils/interactions"; import { Transition, TransitionChild } from "../transitions"; import TransitionDebug from "./_TransitionDebug.svelte"; -let id = 0; +let mockId = 0; jest.mock("../../hooks/use-id", () => { return { - useId: jest.fn(() => ++id), + useId: jest.fn(() => ++mockId), }; }); -beforeEach(() => (id = 0)); +beforeEach(() => (mockId = 0)); afterAll(() => jest.restoreAllMocks()); function nextFrame() { diff --git a/src/lib/components/listbox/listbox.test.ts b/src/lib/components/listbox/listbox.test.ts index a25f288..a3f94da 100644 --- a/src/lib/components/listbox/listbox.test.ts +++ b/src/lib/components/listbox/listbox.test.ts @@ -46,14 +46,14 @@ import Button from "$lib/internal/elements/Button.svelte"; import Div from "$lib/internal/elements/Div.svelte"; import Span from "$lib/internal/elements/Span.svelte"; -let id = 0; +let mockId = 0; jest.mock('../../hooks/use-id', () => { return { - useId: jest.fn(() => ++id), + useId: jest.fn(() => ++mockId), } }) -beforeEach(() => id = 0) +beforeEach(() => mockId = 0) beforeAll(() => { // jest.spyOn(window, 'requestAnimationFrame').mockImplementation(setImmediate as any) // jest.spyOn(window, 'cancelAnimationFrame').mockImplementation(clearImmediate as any) diff --git a/src/lib/components/menu/menu.test.ts b/src/lib/components/menu/menu.test.ts index 43f966e..a2d9fde 100644 --- a/src/lib/components/menu/menu.test.ts +++ b/src/lib/components/menu/menu.test.ts @@ -11,14 +11,14 @@ import Div from "$lib/internal/elements/Div.svelte"; import Form from "$lib/internal/elements/Form.svelte"; import Span from "$lib/internal/elements/Span.svelte"; -let id = 0; +let mockId = 0; jest.mock('../../hooks/use-id', () => { return { - useId: jest.fn(() => ++id), + useId: jest.fn(() => ++mockId), } }) -beforeEach(() => id = 0) +beforeEach(() => mockId = 0) beforeAll(() => { // jest.spyOn(window, 'requestAnimationFrame').mockImplementation(setImmediate as any) // jest.spyOn(window, 'cancelAnimationFrame').mockImplementation(clearImmediate as any) diff --git a/src/lib/components/popover/popover.test.ts b/src/lib/components/popover/popover.test.ts index df9ae05..aae567e 100644 --- a/src/lib/components/popover/popover.test.ts +++ b/src/lib/components/popover/popover.test.ts @@ -11,14 +11,14 @@ import { Transition, TransitionChild } from "$lib/components/transitions"; import TransitionDebug from "$lib/components/disclosure/_TransitionDebug.svelte"; import Portal from "$lib/components/portal/Portal.svelte"; -let id = 0; +let mockId = 0; jest.mock('../../hooks/use-id', () => { return { - useId: jest.fn(() => ++id), + useId: jest.fn(() => ++mockId), } }) -beforeEach(() => id = 0) +beforeEach(() => mockId = 0) beforeAll(() => { // jest.spyOn(window, 'requestAnimationFrame').mockImplementation(setImmediate as any) // jest.spyOn(window, 'cancelAnimationFrame').mockImplementation(clearImmediate as any) diff --git a/src/lib/components/radio-group/radio-group.test.ts b/src/lib/components/radio-group/radio-group.test.ts index 4e5664b..c0516bb 100644 --- a/src/lib/components/radio-group/radio-group.test.ts +++ b/src/lib/components/radio-group/radio-group.test.ts @@ -14,14 +14,14 @@ import { click, Keys, press, shift } from "$lib/test-utils/interactions"; import Button from "$lib/internal/elements/Button.svelte"; import ManagedRadioGroup from "./_ManagedRadioGroup.svelte"; -let id = 0; +let mockId = 0; jest.mock('../../hooks/use-id', () => { return { - useId: jest.fn(() => ++id), + useId: jest.fn(() => ++mockId), } }) -beforeEach(() => id = 0) +beforeEach(() => mockId = 0) beforeAll(() => { // jest.spyOn(window, 'requestAnimationFrame').mockImplementation(setImmediate as any) // jest.spyOn(window, 'cancelAnimationFrame').mockImplementation(clearImmediate as any) diff --git a/src/lib/components/tabs/tabs.test.ts b/src/lib/components/tabs/tabs.test.ts index 82e9efe..f167413 100644 --- a/src/lib/components/tabs/tabs.test.ts +++ b/src/lib/components/tabs/tabs.test.ts @@ -6,14 +6,14 @@ import { assertActiveElement, assertTabs, getByText, getTabs } from "$lib/test-u import { click, Keys, press, shift } from "$lib/test-utils/interactions"; import Button from "$lib/internal/elements/Button.svelte"; -let id = 0; +let mockId = 0; jest.mock('../../hooks/use-id', () => { return { - useId: jest.fn(() => ++id), + useId: jest.fn(() => ++mockId), } }) -beforeEach(() => id = 0) +beforeEach(() => mockId = 0) beforeAll(() => { // jest.spyOn(window, 'requestAnimationFrame').mockImplementation(setImmediate as any) // jest.spyOn(window, 'cancelAnimationFrame').mockImplementation(clearImmediate as any)