Fix tests after introduction of babel step

This commit is contained in:
Ryan Gossiaux
2021-12-30 09:56:22 -10:00
parent 809cf84164
commit 2b705fd1ae
7 changed files with 23 additions and 23 deletions

View File

@@ -25,10 +25,10 @@ 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),
};
});
@@ -38,7 +38,7 @@ global.IntersectionObserver = class FakeIntersectionObserver {
disconnect() { }
};
beforeEach(() => (id = 0));
beforeEach(() => (mockId = 0));
afterAll(() => jest.restoreAllMocks());
describe("Safe guards", () => {

View File

@@ -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() {

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)