Skip to content

Commit

Permalink
Add OverlayToaster.createAsync test
Browse files Browse the repository at this point in the history
  • Loading branch information
gluxon committed Dec 12, 2023
1 parent 26c8e34 commit 32af487
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions packages/core/test/toast/overlayToasterTests.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ const SPECS = [
OverlayToaster.create(props, containerElement),
name: "create",
},
{
cleanup: unmountReact16Toaster,
create: (props: OverlayToasterProps | undefined, containerElement: HTMLElement) =>
OverlayToaster.createAsync(props, { container: containerElement }),
name: "createAsync",
},
];

/**
Expand Down Expand Up @@ -63,10 +69,10 @@ describe("OverlayToaster", () => {

describeEach(SPECS, spec => {
describe("with default props", () => {
before(() => {
before(async () => {
testsContainerElement = document.createElement("div");
document.documentElement.appendChild(testsContainerElement);
toaster = spec.create({}, testsContainerElement);
toaster = await spec.create({}, testsContainerElement);
});

afterEach(() => {
Expand Down Expand Up @@ -189,10 +195,10 @@ describe("OverlayToaster", () => {
});

describe("with maxToasts set to finite value", () => {
before(() => {
before(async () => {
testsContainerElement = document.createElement("div");
document.documentElement.appendChild(testsContainerElement);
toaster = spec.create({ maxToasts: 3 }, testsContainerElement);
toaster = await spec.create({ maxToasts: 3 }, testsContainerElement);
});

after(() => {
Expand All @@ -210,10 +216,10 @@ describe("OverlayToaster", () => {
});

describe("with autoFocus set to true", () => {
before(() => {
before(async () => {
testsContainerElement = document.createElement("div");
document.documentElement.appendChild(testsContainerElement);
toaster = spec.create({ autoFocus: true }, testsContainerElement);
toaster = await spec.create({ autoFocus: true }, testsContainerElement);
});

after(() => {
Expand Down

0 comments on commit 32af487

Please sign in to comment.