mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
test: split out test for "text" option of ElementHandle.press (#4051)
This commit is contained in:
parent
ed984ac479
commit
7d39aca93c
@ -55,16 +55,22 @@ module.exports.addTests = function({testRunner, expect, FFOX}) {
|
|||||||
await page.keyboard.press('Backspace');
|
await page.keyboard.press('Backspace');
|
||||||
expect(await page.evaluate(() => document.querySelector('textarea').value)).toBe('Hello World!');
|
expect(await page.evaluate(() => document.querySelector('textarea').value)).toBe('Hello World!');
|
||||||
});
|
});
|
||||||
it_fails_ffox('should send a character with ElementHandle.press', async({page, server}) => {
|
it('should send a character with ElementHandle.press', async({page, server}) => {
|
||||||
await page.goto(server.PREFIX + '/input/textarea.html');
|
await page.goto(server.PREFIX + '/input/textarea.html');
|
||||||
const textarea = await page.$('textarea');
|
const textarea = await page.$('textarea');
|
||||||
await textarea.press('a', {text: 'f'});
|
await textarea.press('a');
|
||||||
expect(await page.evaluate(() => document.querySelector('textarea').value)).toBe('f');
|
expect(await page.evaluate(() => document.querySelector('textarea').value)).toBe('a');
|
||||||
|
|
||||||
await page.evaluate(() => window.addEventListener('keydown', e => e.preventDefault(), true));
|
await page.evaluate(() => window.addEventListener('keydown', e => e.preventDefault(), true));
|
||||||
|
|
||||||
await textarea.press('a', {text: 'y'});
|
await textarea.press('b');
|
||||||
expect(await page.evaluate(() => document.querySelector('textarea').value)).toBe('f');
|
expect(await page.evaluate(() => document.querySelector('textarea').value)).toBe('a');
|
||||||
|
});
|
||||||
|
it_fails_ffox('ElementHandle.press should support |text| option', async({page, server}) => {
|
||||||
|
await page.goto(server.PREFIX + '/input/textarea.html');
|
||||||
|
const textarea = await page.$('textarea');
|
||||||
|
await textarea.press('a', {text: 'ё'});
|
||||||
|
expect(await page.evaluate(() => document.querySelector('textarea').value)).toBe('ё');
|
||||||
});
|
});
|
||||||
it('should send a character with sendCharacter', async({page, server}) => {
|
it('should send a character with sendCharacter', async({page, server}) => {
|
||||||
await page.goto(server.PREFIX + '/input/textarea.html');
|
await page.goto(server.PREFIX + '/input/textarea.html');
|
||||||
|
Loading…
Reference in New Issue
Block a user