Skip to content

Commit

Permalink
fix(OnyxToast): changed order of new toasts (#2417)
Browse files Browse the repository at this point in the history
- new toasts are added to the bottom
  • Loading branch information
ChristianBusshoff authored Dec 28, 2024
1 parent acb5826 commit a1dcd73
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Object.entries(ONYX_BREAKPOINTS).forEach(([breakpoint, width]) => {
await expect(component).toContainText("Example toast 1");

// ACT
await component.getByLabel("Close").nth(4).click();
await component.getByLabel("Close").first().click();

// ASSERT
await expect(component).not.toContainText("Example toast 1");
Expand Down
8 changes: 4 additions & 4 deletions packages/sit-onyx/src/components/OnyxToast/useToast.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ describe("useToast", () => {

expect(provider.toasts.value).toStrictEqual([
{
id: 2,
headline: "Test 2",
id: 1,
headline: "Test 1",
onClose: expect.any(Function),
},
{
id: 1,
headline: "Test 1",
id: 2,
headline: "Test 2",
onClose: expect.any(Function),
},
]);
Expand Down
2 changes: 1 addition & 1 deletion packages/sit-onyx/src/components/OnyxToast/useToast.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export const createToastProvider = (): ToastProvider => {
const show: ToastProvider["show"] = (toast: ShowToastOptions) => {
const id = nextId++;

toasts.value.unshift({
toasts.value.push({
...toast,
id,
onClose: () => remove(id),
Expand Down

0 comments on commit a1dcd73

Please sign in to comment.