diff --git a/core/src/components/datetime/datetime.tsx b/core/src/components/datetime/datetime.tsx index 137ca09f4f..f898c581fd 100644 --- a/core/src/components/datetime/datetime.tsx +++ b/core/src/components/datetime/datetime.tsx @@ -1,6 +1,6 @@ -import { printIonError } from '@utils/logging'; import type { ComponentInterface, EventEmitter } from '@stencil/core'; import { Component, Element, Event, Host, Method, Prop, State, Watch, h, writeTask } from '@stencil/core'; +import { printIonError } from '@utils/logging'; import { caretDownSharp, caretUpSharp, chevronBack, chevronDown, chevronForward } from 'ionicons/icons'; import { getIonMode } from '../../global/ionic-global'; diff --git a/core/src/components/footer/test/scroll-target/e2e.ts b/core/src/components/footer/test/scroll-target/e2e.ts index 27b17a28b3..a578057090 100644 --- a/core/src/components/footer/test/scroll-target/e2e.ts +++ b/core/src/components/footer/test/scroll-target/e2e.ts @@ -1,6 +1,5 @@ import type { E2EPage } from '@stencil/core/testing'; import { newE2EPage } from '@stencil/core/testing'; - import { scrollToBottom } from '@utils/test'; /** diff --git a/core/src/components/header/header.tsx b/core/src/components/header/header.tsx index 874db7d13c..6cd2642fdf 100644 --- a/core/src/components/header/header.tsx +++ b/core/src/components/header/header.tsx @@ -1,8 +1,8 @@ -import { findIonContent, getScrollElement, printIonContentErrorMsg } from '@utils/content'; import type { ComponentInterface } from '@stencil/core'; import { Component, Element, Host, Prop, h, writeTask } from '@stencil/core'; +import { findIonContent, getScrollElement, printIonContentErrorMsg } from '@utils/content'; import { getIonMode } from '../../global/ionic-global'; import type { Attributes } from '../../utils/helpers'; diff --git a/core/src/components/header/test/scroll-target/e2e.ts b/core/src/components/header/test/scroll-target/e2e.ts index 95bd5050db..232190b82c 100644 --- a/core/src/components/header/test/scroll-target/e2e.ts +++ b/core/src/components/header/test/scroll-target/e2e.ts @@ -1,6 +1,5 @@ import { newE2EPage } from '@stencil/core/testing'; import type { E2EPage } from '@stencil/core/testing'; - import { scrollToBottom } from '@utils/test'; describe('ion-header: custom scroll target', () => { diff --git a/core/src/components/infinite-scroll/test/scroll-target/e2e.ts b/core/src/components/infinite-scroll/test/scroll-target/e2e.ts index 0dbd9f9af9..22e2ba7588 100644 --- a/core/src/components/infinite-scroll/test/scroll-target/e2e.ts +++ b/core/src/components/infinite-scroll/test/scroll-target/e2e.ts @@ -1,6 +1,5 @@ import { newE2EPage } from '@stencil/core/testing'; import type { E2EPage } from '@stencil/core/testing'; - import { scrollToBottom } from '@utils/test'; /** diff --git a/core/src/components/item/item.tsx b/core/src/components/item/item.tsx index 411f1daebd..d55d13e8e1 100644 --- a/core/src/components/item/item.tsx +++ b/core/src/components/item/item.tsx @@ -2,7 +2,6 @@ import type { ComponentInterface } from '@stencil/core'; import { Component, Element, Host, Listen, Prop, State, Watch, forceUpdate, h } from '@stencil/core'; import { printIonError } from '@utils/logging'; - import { chevronForward } from 'ionicons/icons'; import { getIonMode } from '../../global/ionic-global'; @@ -12,7 +11,7 @@ import { raf } from '../../utils/helpers'; import { createColorClasses, hostContext, openURL } from '../../utils/theme'; import type { InputChangeEventDetail } from '../input/input-interface'; -import { CounterFormatter } from './item-interface'; +import type { CounterFormatter } from './item-interface'; /** * @virtualProp {"ios" | "md"} mode - The mode determines which platform styles to use. diff --git a/core/src/components/item/test/counter/e2e.ts b/core/src/components/item/test/counter/e2e.ts index a068d25981..ac97469cc3 100644 --- a/core/src/components/item/test/counter/e2e.ts +++ b/core/src/components/item/test/counter/e2e.ts @@ -1,4 +1,5 @@ -import { E2EPage, newE2EPage } from '@stencil/core/testing'; +import type { E2EPage} from '@stencil/core/testing'; +import { newE2EPage } from '@stencil/core/testing'; describe('item: counter', () => { @@ -75,7 +76,7 @@ describe('item: counter', () => { } }); - let itemCounter = await page.find('ion-item >>> .item-counter'); + const itemCounter = await page.find('ion-item >>> .item-counter'); expect(itemCounter.textContent).toBe('0 / 20'); @@ -105,13 +106,5 @@ describe('item: counter', () => { }); }); - -<<<<<<< HEAD -======= -test('item: counter-rtl', async () => { - const page = await newE2EPage({ - url: '/src/components/item/test/counter?ionic:_testing=true&rtl=true', ->>>>>>> origin/main }); - }) diff --git a/core/src/components/modal/gestures/sheet.ts b/core/src/components/modal/gestures/sheet.ts index 5d768551fa..c2027dcaf1 100644 --- a/core/src/components/modal/gestures/sheet.ts +++ b/core/src/components/modal/gestures/sheet.ts @@ -1,5 +1,6 @@ -import { Animation } from '../../../interface'; -import { GestureDetail, createGesture } from '../../../utils/gesture'; +import type { Animation } from '../../../interface'; +import type { GestureDetail} from '../../../utils/gesture'; +import { createGesture } from '../../../utils/gesture'; import { clamp, raf } from '../../../utils/helpers'; import { getBackdropValueForSheet } from '../utils'; diff --git a/core/src/components/modal/gestures/swipe-to-close.ts b/core/src/components/modal/gestures/swipe-to-close.ts index 77bfb3a0fe..b8e735f4e3 100644 --- a/core/src/components/modal/gestures/swipe-to-close.ts +++ b/core/src/components/modal/gestures/swipe-to-close.ts @@ -1,6 +1,7 @@ -import { Animation } from '../../../interface'; +import type { Animation } from '../../../interface'; import { getTimeGivenProgression } from '../../../utils/animation/cubic-bezier'; -import { GestureDetail, createGesture } from '../../../utils/gesture'; +import type { GestureDetail} from '../../../utils/gesture'; +import { createGesture } from '../../../utils/gesture'; import { clamp } from '../../../utils/helpers'; import { calculateSpringStep, handleCanDismiss } from './utils'; diff --git a/core/src/components/modal/gestures/utils.ts b/core/src/components/modal/gestures/utils.ts index 3f72408a73..efff403def 100644 --- a/core/src/components/modal/gestures/utils.ts +++ b/core/src/components/modal/gestures/utils.ts @@ -1,4 +1,4 @@ -import { Animation } from '../../../interface'; +import type { Animation } from '../../../interface'; export const handleCanDismiss = async ( el: HTMLIonModalElement, diff --git a/core/src/components/modal/modal-interface.ts b/core/src/components/modal/modal-interface.ts index a765b934b5..1e1cb4b848 100644 --- a/core/src/components/modal/modal-interface.ts +++ b/core/src/components/modal/modal-interface.ts @@ -1,6 +1,6 @@ -import { JSXBase } from '@stencil/core/internal'; +import type { JSXBase } from '@stencil/core/internal'; -import { AnimationBuilder, ComponentProps, ComponentRef, FrameworkDelegate, Mode } from '../../interface'; +import type { AnimationBuilder, ComponentProps, ComponentRef, FrameworkDelegate, Mode } from '../../interface'; export interface ModalOptions { component: T; @@ -33,7 +33,7 @@ export interface ModalAnimationOptions { backdropBreakpoint?: number; } -export interface ModalAttributes extends JSXBase.HTMLAttributes { } +export type ModalAttributes = JSXBase.HTMLAttributes export interface ModalBreakpointChangeEventDetail { breakpoint: number; diff --git a/core/src/components/modal/modal.tsx b/core/src/components/modal/modal.tsx index 180c2ad1b0..fde148894c 100644 --- a/core/src/components/modal/modal.tsx +++ b/core/src/components/modal/modal.tsx @@ -1,9 +1,10 @@ -import { Component, ComponentInterface, Element, Event, EventEmitter, Host, Method, Prop, State, Watch, h, writeTask } from '@stencil/core'; +import type { ComponentInterface, EventEmitter} from '@stencil/core'; +import { Component, Element, Event, Host, Method, Prop, State, Watch, h, writeTask } from '@stencil/core'; import { printIonWarning } from '@utils/logging'; import { config } from '../../global/config'; import { getIonMode } from '../../global/ionic-global'; -import { Animation, AnimationBuilder, ComponentProps, ComponentRef, FrameworkDelegate, Gesture, ModalAttributes, ModalBreakpointChangeEventDetail, OverlayEventDetail, OverlayInterface } from '../../interface'; +import type { Animation, AnimationBuilder, ComponentProps, ComponentRef, FrameworkDelegate, Gesture, ModalAttributes, ModalBreakpointChangeEventDetail, OverlayEventDetail, OverlayInterface } from '../../interface'; import { CoreDelegate, attachComponent, detachComponent } from '../../utils/framework-delegate'; import { raf } from '../../utils/helpers'; import { KEYBOARD_DID_OPEN } from '../../utils/keyboard/keyboard'; @@ -15,7 +16,8 @@ import { iosEnterAnimation } from './animations/ios.enter'; import { iosLeaveAnimation } from './animations/ios.leave'; import { mdEnterAnimation } from './animations/md.enter'; import { mdLeaveAnimation } from './animations/md.leave'; -import { MoveSheetToBreakpointOptions, createSheetGesture } from './gestures/sheet'; +import type { MoveSheetToBreakpointOptions} from './gestures/sheet'; +import { createSheetGesture } from './gestures/sheet'; import { createSwipeToCloseGesture } from './gestures/swipe-to-close'; /** diff --git a/core/src/components/modal/test/basic/e2e.ts b/core/src/components/modal/test/basic/e2e.ts index 95786cbbb6..907cdcd92a 100644 --- a/core/src/components/modal/test/basic/e2e.ts +++ b/core/src/components/modal/test/basic/e2e.ts @@ -1,10 +1,11 @@ -import { openModal, testModal } from '../test.utils'; import { newE2EPage } from '@stencil/core/testing'; +import { openModal, testModal } from '../test.utils'; + const DIRECTORY = 'basic'; const getActiveElementText = async (page) => { const activeElement = await page.evaluateHandle(() => document.activeElement); - return await page.evaluate(el => el && el.textContent, activeElement); + return await page.evaluate(el => el?.textContent, activeElement); } test('modal: focus trap', async () => { @@ -14,7 +15,7 @@ test('modal: focus trap', async () => { await page.click('#basic-modal'); await page.waitForSelector('#basic-modal'); - let modal = await page.find('ion-modal'); + const modal = await page.find('ion-modal'); expect(modal).not.toBe(null); await ionModalDidPresent.next(); @@ -45,7 +46,7 @@ test('modal: return focus', async () => { await page.click('#basic-modal'); await page.waitForSelector('#basic-modal'); - let modal = await page.find('ion-modal'); + const modal = await page.find('ion-modal'); expect(modal).not.toBe(null); await ionModalDidPresent.next() @@ -75,12 +76,12 @@ test('modal: htmlAttributes', async () => { await page.click('#basic-modal'); await page.waitForSelector('#basic-modal'); - let alert = await page.find('ion-modal'); + const alert = await page.find('ion-modal'); expect(alert).not.toBe(null); await alert.waitForVisible(); - const attribute = await page.evaluate((el) => document.querySelector('ion-modal').getAttribute('data-testid')); + const attribute = await page.evaluate(() => document.querySelector('ion-modal').getAttribute('data-testid')); expect(attribute).toEqual('basic-modal'); }); diff --git a/core/src/components/modal/test/canDismiss/e2e.ts b/core/src/components/modal/test/canDismiss/e2e.ts index 61ff3fc755..3bdfae8d7f 100644 --- a/core/src/components/modal/test/canDismiss/e2e.ts +++ b/core/src/components/modal/test/canDismiss/e2e.ts @@ -332,7 +332,6 @@ describe('modal - canDismiss handler', () => { it('should not dismiss on swipe when not attempting to close', async () => { const ionModalDidPresent = await page.spyOnEvent('ionModalDidPresent'); - const ionHandlerDone = await page.spyOnEvent('ionHandlerDone'); const screenshotCompares = []; await page.click('#radio-promise-true'); diff --git a/core/src/components/modal/test/sheet/e2e.ts b/core/src/components/modal/test/sheet/e2e.ts index d2ac17626d..b5ca2697a1 100644 --- a/core/src/components/modal/test/sheet/e2e.ts +++ b/core/src/components/modal/test/sheet/e2e.ts @@ -1,8 +1,9 @@ -import { E2EElement, E2EPage, newE2EPage } from '@stencil/core/testing'; -import { openModal, testModal } from '../test.utils'; +import type { E2EElement, E2EPage} from '@stencil/core/testing'; +import { newE2EPage } from '@stencil/core/testing'; import { getActiveElement, getActiveElementParent, dragElementBy } from '@utils/test'; -import { testModal } from '../test.utils'; +import { openModal, testModal , testModal } from '../test.utils'; + const DIRECTORY = 'sheet'; diff --git a/core/src/components/modal/test/test.utils.ts b/core/src/components/modal/test/test.utils.ts index 5253c7b6d1..247a66459a 100644 --- a/core/src/components/modal/test/test.utils.ts +++ b/core/src/components/modal/test/test.utils.ts @@ -1,5 +1,5 @@ -import { E2EPage, newE2EPage } from '@stencil/core/testing'; - +import type { E2EPage} from '@stencil/core/testing'; +import { newE2EPage } from '@stencil/core/testing'; import { generateE2EUrl } from '@utils/test'; export const openModal = async ( diff --git a/core/src/components/reorder-group/reorder-group.tsx b/core/src/components/reorder-group/reorder-group.tsx index aecc89f310..0d0cb9f35d 100644 --- a/core/src/components/reorder-group/reorder-group.tsx +++ b/core/src/components/reorder-group/reorder-group.tsx @@ -1,8 +1,8 @@ -import { findClosestIonContent, getScrollElement } from '@utils/content'; import type { ComponentInterface, EventEmitter } from '@stencil/core'; import { Component, Element, Event, Host, Method, Prop, State, Watch, h } from '@stencil/core'; +import { findClosestIonContent, getScrollElement } from '@utils/content'; import { getIonMode } from '../../global/ionic-global'; import type { Gesture, GestureDetail, ItemReorderEventDetail } from '../../interface'; diff --git a/core/src/components/reorder-group/test/scroll-target/e2e.ts b/core/src/components/reorder-group/test/scroll-target/e2e.ts index 7e31d5d09a..170bc851b8 100644 --- a/core/src/components/reorder-group/test/scroll-target/e2e.ts +++ b/core/src/components/reorder-group/test/scroll-target/e2e.ts @@ -1,7 +1,7 @@ import type { E2EPage } from '@stencil/core/testing'; import { newE2EPage } from '@stencil/core/testing'; -import { getElementProperty, queryDeep } from '../../../../utils/test/utils'; +import { getElementProperty } from '../../../../utils/test/utils'; import { moveReorderItem } from '../test.utils'; it('reorder: custom scroll target', async () => { diff --git a/core/src/utils/content/content.utils.spec.ts b/core/src/utils/content/content.utils.spec.ts index a5dd43e1dd..960cb7024a 100644 --- a/core/src/utils/content/content.utils.spec.ts +++ b/core/src/utils/content/content.utils.spec.ts @@ -5,12 +5,12 @@ describe('Content Utils', () => { describe('getScrollElement', () => { it('should return the scroll element for ion-content', async () => { - const res = await getScrollElement({ + const res = await getScrollElement({ tagName: 'ION-CONTENT', getScrollElement: () => Promise.resolve({ tagName: 'my-scroll-element' }) - }); + } as any); expect(res).toStrictEqual({ tagName: 'my-scroll-element' @@ -24,9 +24,9 @@ describe('Content Utils', () => { it('should query the ion-content element', () => { const querySelectorMock = jest.fn(); - findIonContent({ + findIonContent({ querySelector: querySelectorMock - }); + } as any); expect(querySelectorMock).toHaveBeenCalledWith('ion-content, .ion-content-scroll-host'); }); @@ -38,9 +38,9 @@ describe('Content Utils', () => { it('should query the closest ion-content', () => { const closestMock = jest.fn(); - findClosestIonContent({ + findClosestIonContent({ closest: closestMock - }); + } as any); expect(closestMock).toHaveBeenCalledWith('ion-content, .ion-content-scroll-host'); }); @@ -53,10 +53,10 @@ describe('Content Utils', () => { it('should call scrollToTop when the tag name is ion-content', () => { const scrollToTopMock = jest.fn(); - scrollToTop({ + scrollToTop({ tagName: 'ION-CONTENT', scrollToTop: scrollToTopMock - }, 0); + } as any, 0); expect(scrollToTopMock).toHaveBeenCalledWith(0); }); @@ -64,10 +64,10 @@ describe('Content Utils', () => { it('should call the element scrollTo when the tag name is not ion-content', async () => { const scrollToMock = jest.fn(); - await scrollToTop({ + await scrollToTop({ tagName: 'DIV', scrollTo: scrollToMock - }, 0); + } as any, 0); expect(scrollToMock).toHaveBeenCalledWith({ top: 0, @@ -83,10 +83,10 @@ describe('Content Utils', () => { it('should smooth scroll ion-content', () => { const scrollToTopMock = jest.fn(); - scrollToTop({ + scrollToTop({ tagName: 'ION-CONTENT', scrollToTop: scrollToTopMock - }, 300); + } as any, 300); expect(scrollToTopMock).toHaveBeenCalledWith(300); }); @@ -94,10 +94,10 @@ describe('Content Utils', () => { it('should smooth scroll the element', async () => { const scrollToMock = jest.fn(); - await scrollToTop({ + await scrollToTop({ tagName: 'DIV', scrollTo: scrollToMock - }, 300); + } as any, 300); expect(scrollToMock).toHaveBeenCalledWith({ top: 0, @@ -117,10 +117,10 @@ describe('Content Utils', () => { it('should call scrollByPoint when the tag name is ion-content', async () => { const scrollByPointMock = jest.fn(); - await scrollByPoint({ + await scrollByPoint({ tagName: 'ION-CONTENT', scrollByPoint: scrollByPointMock - }, 10, 15, 0); + } as any, 10, 15, 0); expect(scrollByPointMock).toHaveBeenCalledWith(10, 15, 0); }); @@ -128,10 +128,10 @@ describe('Content Utils', () => { it('should call the element scrollBy when the tag name is not ion-content', async () => { const scrollByMock = jest.fn(); - await scrollByPoint({ + await scrollByPoint({ tagName: 'DIV', scrollBy: scrollByMock - }, 10, 15, 0); + } as any, 10, 15, 0); expect(scrollByMock).toHaveBeenCalledWith({ top: 15, @@ -147,10 +147,10 @@ describe('Content Utils', () => { it('should smooth scroll ion-content', async () => { const scrollByPointMock = jest.fn(); - await scrollByPoint({ + await scrollByPoint({ tagName: 'ION-CONTENT', scrollByPoint: scrollByPointMock - }, 10, 15, 300); + } as any, 10, 15, 300); expect(scrollByPointMock).toHaveBeenCalledWith(10, 15, 300); }); @@ -158,10 +158,10 @@ describe('Content Utils', () => { it('should smooth scroll the element', async () => { const scrollByMock = jest.fn(); - await scrollByPoint({ + await scrollByPoint({ tagName: 'DIV', scrollBy: scrollByMock - }, 10, 15, 300); + } as any, 10, 15, 300); expect(scrollByMock).toHaveBeenCalledWith({ top: 15, @@ -177,9 +177,9 @@ describe('Content Utils', () => { it('printIonContentErrorMsg should display " must be used inside ion-content."', () => { const consoleErrorMock = jest.spyOn(console, 'error').mockImplementation(); - printIonContentErrorMsg({ + printIonContentErrorMsg({ tagName: 'MY-EL' - }); + } as any); expect(consoleErrorMock).toHaveBeenCalledWith(' must be used inside ion-content.');