Skip to content

Commit 9b6ee1e

Browse files
committed
style: lint
1 parent 6b65ceb commit 9b6ee1e

File tree

1 file changed

+19
-114
lines changed

1 file changed

+19
-114
lines changed

core/src/components/input-otp/test/basic/input-otp.e2e.ts

Lines changed: 19 additions & 114 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,7 @@ async function simulatePaste(input: any, value: string) {
2424
configs({ modes: ['ios'] }).forEach(({ title, config }) => {
2525
test.describe(title('input-otp: basic functionality'), () => {
2626
test('should render with 4 input boxes and a default value', async ({ page }) => {
27-
await page.setContent(
28-
`
29-
<ion-input-otp value="12">Description</ion-input-otp>
30-
`,
31-
config
32-
);
27+
await page.setContent(`<ion-input-otp value="12">Description</ion-input-otp>`, config);
3328

3429
const inputBoxes = page.locator('ion-input-otp input');
3530
await expect(inputBoxes).toHaveCount(4);
@@ -42,12 +37,7 @@ configs({ modes: ['ios'] }).forEach(({ title, config }) => {
4237
});
4338

4439
test('should render with 8 input boxes when length is set to 8 and a default value', async ({ page }) => {
45-
await page.setContent(
46-
`
47-
<ion-input-otp length="8" value="12345678">Description</ion-input-otp>
48-
`,
49-
config
50-
);
40+
await page.setContent(`<ion-input-otp length="8" value="12345678">Description</ion-input-otp>`, config);
5141

5242
const inputBoxes = page.locator('ion-input-otp input');
5343
await expect(inputBoxes).toHaveCount(8);
@@ -66,12 +56,7 @@ configs({ modes: ['ios'] }).forEach(({ title, config }) => {
6656
});
6757

6858
test('should accept numbers only by default', async ({ page }) => {
69-
await page.setContent(
70-
`
71-
<ion-input-otp>Description</ion-input-otp>
72-
`,
73-
config
74-
);
59+
await page.setContent(`<ion-input-otp>Description</ion-input-otp>`, config);
7560

7661
const firstInput = page.locator('ion-input-otp input').first();
7762
await firstInput.focus();
@@ -86,12 +71,7 @@ configs({ modes: ['ios'] }).forEach(({ title, config }) => {
8671
});
8772

8873
test('should accept text and numbers when type is set to text', async ({ page }) => {
89-
await page.setContent(
90-
`
91-
<ion-input-otp type="text">Description</ion-input-otp>
92-
`,
93-
config
94-
);
74+
await page.setContent(`<ion-input-otp type="text">Description</ion-input-otp>`, config);
9575

9676
const firstInput = page.locator('ion-input-otp input').first();
9777
await firstInput.focus();
@@ -106,12 +86,7 @@ configs({ modes: ['ios'] }).forEach(({ title, config }) => {
10686
});
10787

10888
test('should accept custom pattern of lowercase and uppercase letters when pattern is set', async ({ page }) => {
109-
await page.setContent(
110-
`
111-
<ion-input-otp type="text" pattern="[a-fA-F]">Description</ion-input-otp>
112-
`,
113-
config
114-
);
89+
await page.setContent(`<ion-input-otp type="text" pattern="[a-fA-F]">Description</ion-input-otp>`, config);
11590

11691
const firstInput = page.locator('ion-input-otp input').first();
11792
await firstInput.focus();
@@ -126,12 +101,7 @@ configs({ modes: ['ios'] }).forEach(({ title, config }) => {
126101
});
127102

128103
test('should accept custom pattern of uppercase letters only when pattern is set', async ({ page }) => {
129-
await page.setContent(
130-
`
131-
<ion-input-otp type="text" pattern="[D-L]">Description</ion-input-otp>
132-
`,
133-
config
134-
);
104+
await page.setContent(`<ion-input-otp type="text" pattern="[D-L]">Description</ion-input-otp>`, config);
135105

136106
const firstInput = page.locator('ion-input-otp input').first();
137107
await firstInput.focus();
@@ -148,12 +118,7 @@ configs({ modes: ['ios'] }).forEach(({ title, config }) => {
148118

149119
test.describe(title('input-otp: input functionality'), () => {
150120
test('should update the input value when typing 4 digits from the 1st box', async ({ page }) => {
151-
await page.setContent(
152-
`
153-
<ion-input-otp>Description</ion-input-otp>
154-
`,
155-
config
156-
);
121+
await page.setContent(`<ion-input-otp>Description</ion-input-otp>`, config);
157122

158123
const firstInput = page.locator('ion-input-otp input').first();
159124
await firstInput.focus();
@@ -185,12 +150,7 @@ configs({ modes: ['ios'] }).forEach(({ title, config }) => {
185150
});
186151

187152
test('should update the 1st input value when typing in the 3rd box', async ({ page }) => {
188-
await page.setContent(
189-
`
190-
<ion-input-otp>Description</ion-input-otp>
191-
`,
192-
config
193-
);
153+
await page.setContent(`<ion-input-otp>Description</ion-input-otp>`, config);
194154

195155
const thirdInput = page.locator('ion-input-otp input').nth(2);
196156
await thirdInput.focus();
@@ -213,12 +173,7 @@ configs({ modes: ['ios'] }).forEach(({ title, config }) => {
213173
test('should update the 3rd input value and shift the values to the right when typing in the 3rd box containing a value', async ({
214174
page,
215175
}) => {
216-
await page.setContent(
217-
`
218-
<ion-input-otp value="123">Description</ion-input-otp>
219-
`,
220-
config
221-
);
176+
await page.setContent(`<ion-input-otp value="123">Description</ion-input-otp>`, config);
222177

223178
const thirdInput = page.locator('ion-input-otp input').nth(2);
224179
await thirdInput.focus();
@@ -239,12 +194,7 @@ configs({ modes: ['ios'] }).forEach(({ title, config }) => {
239194
});
240195

241196
test('should update the 2nd input value when typing in the 2nd box containing a value', async ({ page }) => {
242-
await page.setContent(
243-
`
244-
<ion-input-otp value="1234">Description</ion-input-otp>
245-
`,
246-
config
247-
);
197+
await page.setContent(`<ion-input-otp value="1234">Description</ion-input-otp>`, config);
248198

249199
const secondInput = page.locator('ion-input-otp input').nth(1);
250200
await secondInput.focus();
@@ -265,12 +215,7 @@ configs({ modes: ['ios'] }).forEach(({ title, config }) => {
265215
});
266216

267217
test('should not shift values right when selecting the text in the 2nd input box', async ({ page }) => {
268-
await page.setContent(
269-
`
270-
<ion-input-otp value="123">Description</ion-input-otp>
271-
`,
272-
config
273-
);
218+
await page.setContent(`<ion-input-otp value="123">Description</ion-input-otp>`, config);
274219

275220
const secondInput = page.locator('ion-input-otp input').nth(1);
276221
await secondInput.focus();
@@ -291,12 +236,7 @@ configs({ modes: ['ios'] }).forEach(({ title, config }) => {
291236

292237
test.describe(title('input-otp: focus functionality'), () => {
293238
test('should focus the first input box when tabbed to', async ({ page }) => {
294-
await page.setContent(
295-
`
296-
<ion-input-otp>Description</ion-input-otp>
297-
`,
298-
config
299-
);
239+
await page.setContent(`<ion-input-otp>Description</ion-input-otp>`, config);
300240

301241
await page.keyboard.press('Tab');
302242

@@ -305,12 +245,7 @@ configs({ modes: ['ios'] }).forEach(({ title, config }) => {
305245
});
306246

307247
test('should focus the third input box when tabbed to with a default value of 2 digits', async ({ page }) => {
308-
await page.setContent(
309-
`
310-
<ion-input-otp value="12">Description</ion-input-otp>
311-
`,
312-
config
313-
);
248+
await page.setContent(`<ion-input-otp value="12">Description</ion-input-otp>`, config);
314249

315250
await page.keyboard.press('Tab');
316251

@@ -319,12 +254,7 @@ configs({ modes: ['ios'] }).forEach(({ title, config }) => {
319254
});
320255

321256
test('should focus the last input box when tabbed to with a default value of 4 digits', async ({ page }) => {
322-
await page.setContent(
323-
`
324-
<ion-input-otp value="1234">Description</ion-input-otp>
325-
`,
326-
config
327-
);
257+
await page.setContent(`<ion-input-otp value="1234">Description</ion-input-otp>`, config);
328258

329259
await page.keyboard.press('Tab');
330260

@@ -350,12 +280,7 @@ configs({ modes: ['ios'] }).forEach(({ title, config }) => {
350280
});
351281

352282
test('should focus the first input box when clicking on the 2nd input box without a value', async ({ page }) => {
353-
await page.setContent(
354-
`
355-
<ion-input-otp>Description</ion-input-otp>
356-
`,
357-
config
358-
);
283+
await page.setContent(`<ion-input-otp>Description</ion-input-otp>`, config);
359284

360285
const secondInput = page.locator('ion-input-otp input').nth(1);
361286
await secondInput.click();
@@ -369,12 +294,7 @@ configs({ modes: ['ios'] }).forEach(({ title, config }) => {
369294
test('should backspace the first input box when backspace is pressed twice from the 2nd input box and the first input box has a value', async ({
370295
page,
371296
}) => {
372-
await page.setContent(
373-
`
374-
<ion-input-otp value="1">Description</ion-input-otp>
375-
`,
376-
config
377-
);
297+
await page.setContent(`<ion-input-otp value="1">Description</ion-input-otp>`, config);
378298

379299
await page.keyboard.press('Tab');
380300
await page.keyboard.press('Backspace');
@@ -390,12 +310,7 @@ configs({ modes: ['ios'] }).forEach(({ title, config }) => {
390310
test('should backspace the last input box when backspace is pressed and all values are filled', async ({
391311
page,
392312
}) => {
393-
await page.setContent(
394-
`
395-
<ion-input-otp value="1234">Description</ion-input-otp>
396-
`,
397-
config
398-
);
313+
await page.setContent(`<ion-input-otp value="1234">Description</ion-input-otp>`, config);
399314

400315
await page.keyboard.press('Tab');
401316
await page.keyboard.press('Backspace');
@@ -410,12 +325,7 @@ configs({ modes: ['ios'] }).forEach(({ title, config }) => {
410325
test('should backspace the 2nd input box and fill it with the 3rd value when backspace is pressed and 3 values are filled', async ({
411326
page,
412327
}) => {
413-
await page.setContent(
414-
`
415-
<ion-input-otp value="123">Description</ion-input-otp>
416-
`,
417-
config
418-
);
328+
await page.setContent(`<ion-input-otp value="123">Description</ion-input-otp>`, config);
419329

420330
await page.keyboard.press('Tab');
421331

@@ -648,12 +558,7 @@ configs({ modes: ['ios'], directions: ['ltr'] }).forEach(({ title, config }) =>
648558
});
649559

650560
test('should emit ionChange event when blurring with a new value', async ({ page }) => {
651-
await page.setContent(
652-
`
653-
<ion-input-otp>Description</ion-input-otp>
654-
`,
655-
config
656-
);
561+
await page.setContent(`<ion-input-otp>Description</ion-input-otp>`, config);
657562

658563
const ionChange = await page.spyOnEvent('ionChange');
659564

0 commit comments

Comments
 (0)