mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
test: remove special handling for getSelection() with Firefox from tests (#35271)
This commit is contained in:
parent
0ace76a4b1
commit
a7df837809
@ -22,12 +22,7 @@ it('should select textarea', async ({ page, server, browserName }) => {
|
||||
const textarea = await page.$('textarea');
|
||||
await textarea.evaluate(textarea => textarea.value = 'some value');
|
||||
await textarea.selectText();
|
||||
if (browserName === 'firefox') {
|
||||
expect(await textarea.evaluate(el => el.selectionStart)).toBe(0);
|
||||
expect(await textarea.evaluate(el => el.selectionEnd)).toBe(10);
|
||||
} else {
|
||||
expect(await page.evaluate(() => window.getSelection().toString())).toBe('some value');
|
||||
}
|
||||
expect(await page.evaluate(() => window.getSelection().toString())).toBe('some value');
|
||||
});
|
||||
|
||||
it('should select input', async ({ page, server, browserName }) => {
|
||||
@ -35,12 +30,7 @@ it('should select input', async ({ page, server, browserName }) => {
|
||||
const input = await page.$('input');
|
||||
await input.evaluate(input => input.value = 'some value');
|
||||
await input.selectText();
|
||||
if (browserName === 'firefox') {
|
||||
expect(await input.evaluate(el => el.selectionStart)).toBe(0);
|
||||
expect(await input.evaluate(el => el.selectionEnd)).toBe(10);
|
||||
} else {
|
||||
expect(await page.evaluate(() => window.getSelection().toString())).toBe('some value');
|
||||
}
|
||||
expect(await page.evaluate(() => window.getSelection().toString())).toBe('some value');
|
||||
});
|
||||
|
||||
it('should select plain div', async ({ page, server }) => {
|
||||
|
||||
@ -78,12 +78,7 @@ it('should select textarea', async ({ page, server, browserName }) => {
|
||||
const textarea = page.locator('textarea');
|
||||
await textarea.evaluate(textarea => (textarea as HTMLTextAreaElement).value = 'some value');
|
||||
await textarea.selectText();
|
||||
if (browserName === 'firefox') {
|
||||
expect(await textarea.evaluate(el => (el as HTMLTextAreaElement).selectionStart)).toBe(0);
|
||||
expect(await textarea.evaluate(el => (el as HTMLTextAreaElement).selectionEnd)).toBe(10);
|
||||
} else {
|
||||
expect(await page.evaluate(() => window.getSelection().toString())).toBe('some value');
|
||||
}
|
||||
expect(await page.evaluate(() => window.getSelection().toString())).toBe('some value');
|
||||
});
|
||||
|
||||
it('should type', async ({ page }) => {
|
||||
|
||||
@ -239,12 +239,7 @@ it('input value retargeting', async ({ page, browserName }) => {
|
||||
await expect(target).toHaveValue('bar');
|
||||
|
||||
await target.selectText();
|
||||
if (browserName === 'firefox') {
|
||||
expect(await page.locator('#target').evaluate((el: HTMLInputElement) => el.selectionStart)).toBe(0);
|
||||
expect(await page.locator('#target').evaluate((el: HTMLInputElement) => el.selectionEnd)).toBe(3);
|
||||
} else {
|
||||
expect(await page.evaluate(() => window.getSelection()!.toString())).toBe('bar');
|
||||
}
|
||||
expect(await page.evaluate(() => window.getSelection()!.toString())).toBe('bar');
|
||||
});
|
||||
}
|
||||
});
|
||||
@ -270,14 +265,7 @@ it('selection retargeting', async ({ page, browserName }) => {
|
||||
await expect(page.locator('#target')).toHaveText('foo');
|
||||
|
||||
await target.selectText();
|
||||
if (browserName === 'firefox') {
|
||||
expect(await page.$eval('#target', target => {
|
||||
const selection = window.getSelection()!;
|
||||
return selection.anchorNode === target && selection.focusNode === target;
|
||||
})).toBe(true);
|
||||
} else {
|
||||
expect(await page.evaluate(() => window.getSelection()!.toString())).toBe('foo');
|
||||
}
|
||||
expect(await page.evaluate(() => window.getSelection()!.toString())).toBe('foo');
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user