Skip to content

Commit 276edb4

Browse files
committed
chore(): lint
1 parent 86f8cf8 commit 276edb4

File tree

3 files changed

+31
-35
lines changed

3 files changed

+31
-35
lines changed

core/src/components/datetime/test/presentation/datetime.e2e.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { expect, Locator } from '@playwright/test';
1+
import { Locator, expect } from '@playwright/test';
22
import { E2EPage, test } from '@utils/test/playwright';
33

44
test.describe('datetime: presentation', () => {
@@ -67,12 +67,12 @@ class TimePickerFixture {
6767

6868
async goto() {
6969
await this.page.goto(`/src/components/datetime/test/presentation`);
70-
this.timePicker = await this.page.locator('ion-datetime[presentation="time"]');
70+
this.timePicker = this.page.locator('ion-datetime[presentation="time"]');
7171
await this.timePicker.scrollIntoViewIfNeeded();
7272
}
7373

7474
async setValue(value: string) {
75-
await this.timePicker.evaluate((el: HTMLIonDatetimeElement, value: string) => el.value = value, value);
75+
await this.timePicker.evaluate((el: HTMLIonDatetimeElement, newValue: string) => el.value = newValue, value);
7676
await this.page.waitForChanges();
7777
}
7878

core/src/components/datetime/test/set-value/e2e.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,4 +62,3 @@ describe('datetime: setting the value', () => {
6262
});
6363

6464
});
65-

core/src/utils/test/playwright.ts

Lines changed: 28 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ export type E2EPage = Page & {
2525
* Shortcut for main frame's [frame.goto(url[, options])](https://playwright.dev/docs/api/class-frame#frame-goto)
2626
* @param url URL to navigate page to. The url should include scheme, e.g. `https://`. When a `baseURL` via the context options was provided and the passed URL is a path, it gets merged via the
2727
* [`new URL()`](https://developer.mozilla.org/en-US/docs/Web/API/URL/URL) constructor.
28-
* @param options
2928
*/
3029
goto: (url: string) => Promise<null | Response>;
3130
/**
@@ -168,35 +167,31 @@ export const test = base.extend<CustomFixtures>({
168167
}
169168
await page.evaluate(() => {
170169
// BROWSER CONTEXT
171-
return new Promise<void>((resolve) => {
172-
const promises: Promise<any>[] = [];
170+
return new Promise<void>(resolve => {
171+
const promiseChain: Promise<any>[] = [];
173172

174173
const waitComponentOnReady = (elm: Element | ShadowRoot, promises: Promise<any>[]) => {
175-
if (elm != null) {
176-
if ('shadowRoot' in elm && elm.shadowRoot instanceof ShadowRoot) {
177-
waitComponentOnReady(elm.shadowRoot, promises);
178-
}
179-
const children = elm.children;
180-
const len = children.length;
181-
for (let i = 0; i < len; i++) {
182-
const childElm = children[i];
183-
if (childElm != null) {
184-
const childStencilElm = childElm as HostElement;
185-
if (
186-
childElm.tagName.includes('-') &&
187-
typeof childStencilElm.componentOnReady === 'function'
188-
) {
189-
promises.push(childStencilElm.componentOnReady());
190-
}
191-
waitComponentOnReady(childElm, promises);
192-
}
174+
if ('shadowRoot' in elm && elm.shadowRoot instanceof ShadowRoot) {
175+
waitComponentOnReady(elm.shadowRoot, promises);
176+
}
177+
const children = elm.children;
178+
const len = children.length;
179+
for (let i = 0; i < len; i++) {
180+
const childElm = children[i];
181+
const childStencilElm = childElm as HostElement;
182+
if (
183+
childElm.tagName.includes('-') &&
184+
typeof childStencilElm.componentOnReady === 'function'
185+
) {
186+
promises.push(childStencilElm.componentOnReady());
193187
}
188+
waitComponentOnReady(childElm, promises);
194189
}
195190
};
196191

197-
waitComponentOnReady(document.documentElement, promises);
192+
waitComponentOnReady(document.documentElement, promiseChain);
198193

199-
Promise.all(promises)
194+
Promise.all(promiseChain)
200195
.then(() => resolve())
201196
.catch(() => resolve())
202197
});
@@ -205,29 +200,31 @@ export const test = base.extend<CustomFixtures>({
205200
return;
206201
}
207202
await page.waitForTimeout(100);
208-
} catch { }
203+
} catch (e) {
204+
console.error(e);
205+
}
209206
}
210207

211208
page.waitForCustomEvent = async (eventName: string) => {
212209
const timeoutMs = 5000;
213-
const ev = await page.evaluate(({ eventName, timeoutMs }) => {
210+
const ev = await page.evaluate(({ type, timeout }) => {
214211
return new Promise<any>((resolve, reject) => {
215212
const tmr = setTimeout(() => {
216213
reject(new Error(`waitForCustomEvent() timeout, eventName: ${eventName}`));
217-
}, timeoutMs);
214+
}, timeout);
218215

219216
window.addEventListener(
220-
eventName,
221-
(ev: any) => {
217+
type,
218+
(event: any) => {
222219
clearTimeout(tmr);
223-
resolve((window as any).stencilSerializeEvent(ev))
220+
resolve((window as any).stencilSerializeEvent(event))
224221
},
225222
{ once: true }
226223
)
227224
});
228225
}, {
229-
eventName,
230-
timeoutMs
226+
type: eventName,
227+
timeout: timeoutMs
231228
});
232229

233230
await page.waitForChanges();

0 commit comments

Comments
 (0)