fix: context-menu emitted twice (#44978)
* fix: context-menu emitted twice * refactor: simplify disabling draggable regions * cleanup
This commit is contained in:
parent
cf5a4640f5
commit
2c698d3f75
6 changed files with 51 additions and 65 deletions
|
@ -2731,6 +2731,26 @@ describe('webContents module', () => {
|
|||
expect(params.y).to.be.a('number');
|
||||
});
|
||||
|
||||
// Skipping due to lack of native click support.
|
||||
it.skip('emits the correct number of times when right-clicked in page', async () => {
|
||||
const w = new BrowserWindow({ show: true });
|
||||
await w.loadFile(path.join(fixturesPath, 'pages', 'base-page.html'));
|
||||
|
||||
let contextMenuEmitCount = 0;
|
||||
|
||||
w.webContents.on('context-menu', () => {
|
||||
contextMenuEmitCount++;
|
||||
});
|
||||
|
||||
// TODO(samuelmaddock): Perform native right-click. We've tried then
|
||||
// dropped robotjs and nutjs so for now this is a manual test.
|
||||
|
||||
await once(w.webContents, 'context-menu');
|
||||
await setTimeout(100);
|
||||
|
||||
expect(contextMenuEmitCount).to.equal(1);
|
||||
});
|
||||
|
||||
it('emits when right-clicked in page in a draggable region', async () => {
|
||||
const w = new BrowserWindow({ show: false });
|
||||
await w.loadFile(path.join(fixturesPath, 'pages', 'draggable-page.html'));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue