From b6c001935b4e51a04aa94b0bd6d849e783c8f607 Mon Sep 17 00:00:00 2001 From: Amanda Johnston <90629384+amandaejohnston@users.noreply.github.com> Date: Tue, 6 Dec 2022 09:42:21 -0600 Subject: [PATCH] Revert "feat(toast): add global config toastDuration (#26401)" (#26424) This reverts commit e375e9a1e7d30c481772e84c0ae34f39a019aad3. --- core/api.txt | 2 +- .../components/toast/test/basic/toast.e2e.ts | 30 +------------------ core/src/components/toast/toast.tsx | 5 ++-- core/src/utils/config.ts | 5 ---- 4 files changed, 4 insertions(+), 38 deletions(-) diff --git a/core/api.txt b/core/api.txt index 54c1190f31..56db72b84a 100644 --- a/core/api.txt +++ b/core/api.txt @@ -1382,7 +1382,7 @@ ion-toast,prop,animated,boolean,true,false,false ion-toast,prop,buttons,(string | ToastButton)[] | undefined,undefined,false,false ion-toast,prop,color,"danger" | "dark" | "light" | "medium" | "primary" | "secondary" | "success" | "tertiary" | "warning" | string & Record | undefined,undefined,false,true ion-toast,prop,cssClass,string | string[] | undefined,undefined,false,false -ion-toast,prop,duration,number,config.getNumber('toastDuration', 0),false,false +ion-toast,prop,duration,number,0,false,false ion-toast,prop,enterAnimation,((baseEl: any, opts?: any) => Animation) | undefined,undefined,false,false ion-toast,prop,header,string | undefined,undefined,false,false ion-toast,prop,htmlAttributes,undefined | { [key: string]: any; },undefined,false,false diff --git a/core/src/components/toast/test/basic/toast.e2e.ts b/core/src/components/toast/test/basic/toast.e2e.ts index 4bea4bedda..21e23008bd 100644 --- a/core/src/components/toast/test/basic/toast.e2e.ts +++ b/core/src/components/toast/test/basic/toast.e2e.ts @@ -1,5 +1,5 @@ -import type { Locator, TestInfo } from '@playwright/test'; import { expect } from '@playwright/test'; +import type { Locator, TestInfo } from '@playwright/test'; import type { E2EPage, EventSpy } from '@utils/test/playwright'; import { test } from '@utils/test/playwright'; @@ -134,31 +134,3 @@ test.describe('toast: properties', () => { await expect(toast).toHaveClass(/my-custom-class/); }); }); - -test.describe('toast: duration config', () => { - test.beforeEach(({ skip }) => { - skip.rtl(); - skip.mode('ios'); - }); - test('should have duration set to 0', async ({ page }) => { - await page.setContent(` - - `); - const toast = page.locator('ion-toast'); - await expect(toast).toHaveJSProperty('duration', 0); - }); - - test('should have duration set to 5000', async ({ page }) => { - await page.setContent(` - - - `); - - const toast = page.locator('ion-toast'); - await expect(toast).toHaveJSProperty('duration', 5000); - }); -}); diff --git a/core/src/components/toast/toast.tsx b/core/src/components/toast/toast.tsx index 5422eab422..efb6e29a11 100644 --- a/core/src/components/toast/toast.tsx +++ b/core/src/components/toast/toast.tsx @@ -1,7 +1,6 @@ import type { ComponentInterface, EventEmitter } from '@stencil/core'; -import { Component, Element, Event, h, Host, Method, Prop } from '@stencil/core'; +import { Component, Element, Event, Host, Method, Prop, h } from '@stencil/core'; -import { config } from '../../global/config'; import { getIonMode } from '../../global/ionic-global'; import type { AnimationBuilder, @@ -78,7 +77,7 @@ export class Toast implements ComponentInterface, OverlayInterface { * How many milliseconds to wait before hiding the toast. By default, it will show * until `dismiss()` is called. */ - @Prop() duration = config.getNumber('toastDuration', 0); + @Prop() duration = 0; /** * Header to be shown in the toast. diff --git a/core/src/utils/config.ts b/core/src/utils/config.ts index 1336de4669..ecb07cefc1 100644 --- a/core/src/utils/config.ts +++ b/core/src/utils/config.ts @@ -96,11 +96,6 @@ export interface IonicConfig { */ tabButtonLayout?: TabButtonLayout; - /** - * Overrides the default `duration` for all `ion-toast` components. - */ - toastDuration?: number; - /** * Overrides the default "animation" of all `ion-nav` and `ion-router-outlet` across the whole application. * This prop allows to replace the default transition and provide a custom one that applies to all navigation outlets.