mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
Specify repeat property on repeated keypresses (#172)
This patch implements 'autoRepeat' functionality for `keyboard.down`. With this patch, the subsequent calls to `keyboard.down` would generate an event with 'autoRepeat` flag set to true. Closes #157
This commit is contained in:
committed by
Andrey Lushnikov
parent
08799dd839
commit
bfc40b2ee6
@@ -1098,6 +1098,15 @@ describe('Puppeteer', function() {
|
||||
fail(modifiers[modifier] + ' should be false');
|
||||
}
|
||||
}));
|
||||
it('should specify repeat property', SX(async function(){
|
||||
await page.navigate(PREFIX + '/input/textarea.html');
|
||||
await page.focus('textarea');
|
||||
await page.$('textarea', textarea => textarea.addEventListener('keydown', e => window.lastEvent = e, true));
|
||||
await page.keyboard.down('a', {text: 'a'});
|
||||
expect(await page.evaluate(() => window.lastEvent.repeat)).toBe(false);
|
||||
await page.press('a');
|
||||
expect(await page.evaluate(() => window.lastEvent.repeat)).toBe(true);
|
||||
}));
|
||||
function dimensions() {
|
||||
let rect = document.querySelector('textarea').getBoundingClientRect();
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user