mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
test: add a test for ctrlKey on wheel (#12547)
This commit is contained in:
parent
ee1074559d
commit
1c4b96816a
@ -2183,6 +2183,13 @@
|
||||
"expectations": ["FAIL"],
|
||||
"comment": "TODO: add a comment explaining why this expectation is required (include links to issues)"
|
||||
},
|
||||
{
|
||||
"testIdPattern": "[mouse.spec] Mouse should set ctrlKey on the wheel event",
|
||||
"platforms": ["darwin", "linux", "win32"],
|
||||
"parameters": ["cdp", "firefox"],
|
||||
"expectations": ["SKIP"],
|
||||
"comment": "Wheel event is not supported"
|
||||
},
|
||||
{
|
||||
"testIdPattern": "[mouse.spec] Mouse should trigger hover state with removed window.Node",
|
||||
"platforms": ["darwin", "linux", "win32"],
|
||||
|
@ -222,6 +222,30 @@ describe('Mouse', function () {
|
||||
height: 230,
|
||||
});
|
||||
});
|
||||
it('should set ctrlKey on the wheel event', async () => {
|
||||
const {page, server} = await getTestState();
|
||||
await page.goto(server.EMPTY_PAGE);
|
||||
const ctrlKey = page.evaluate(() => {
|
||||
return new Promise(resolve => {
|
||||
window.addEventListener(
|
||||
'wheel',
|
||||
event => {
|
||||
resolve(event.ctrlKey);
|
||||
},
|
||||
{
|
||||
once: true,
|
||||
}
|
||||
);
|
||||
});
|
||||
});
|
||||
await page.keyboard.down('Control');
|
||||
await page.mouse.wheel({deltaY: -100});
|
||||
// Scroll back to work around
|
||||
// https://bugzilla.mozilla.org/show_bug.cgi?id=1901211.
|
||||
await page.mouse.wheel({deltaY: 100});
|
||||
await page.keyboard.up('Control');
|
||||
expect(await ctrlKey).toBeTruthy();
|
||||
});
|
||||
it('should tween mouse movement', async () => {
|
||||
const {page} = await getTestState();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user