Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: add missing context-menu event spec for <webview> #31306

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 20 additions & 0 deletions spec/webview-spec.js
Expand Up @@ -996,6 +996,26 @@ describe('<webview> tag', function () {
});
});

describe('context-menu event', () => {
it('emits when right-clicked in page', async () => {
await loadWebView(webview, { src: 'about:blank' });

const promise = waitForEvent(webview, 'context-menu');

// Simulate right-click to create context-menu event.
const opts = { x: 0, y: 0, button: 'right' };
webview.sendInputEvent({ ...opts, type: 'mouseDown' });
webview.sendInputEvent({ ...opts, type: 'mouseUp' });

const { params } = await promise;

expect(params.pageURL).to.equal(webview.getURL());
expect(params.frame).to.be.undefined();
expect(params.x).to.be.a('number');
expect(params.y).to.be.a('number');
});
});

describe('media-started-playing media-paused events', () => {
beforeEach(function () {
if (!document.createElement('audio').canPlayType('audio/wav')) {
Expand Down