Skip to content

Commit 5ed8bdc

Browse files
committed
chore: Add test to verify that displaying the context menu does not scroll the page.
1 parent 3f4bcce commit 5ed8bdc

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

tests/browser/test/basic_playground_test.mjs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,24 @@ suite('Right Clicking on Blocks', function () {
101101
await contextMenuSelect(this.browser, this.block, 'Remove Comment');
102102
chai.assert.isNull(await getCommentText(this.browser, this.block.id));
103103
});
104+
105+
test.only('does not scroll the page', async function () {
106+
const initialScroll = await this.browser.execute(() => {
107+
return window.scrollY;
108+
});
109+
// This left-right-left sequence was necessary to reproduce unintended
110+
// scrolling; regardless of the number of clicks/context menu activations,
111+
// the page should not scroll.
112+
this.block.click({button: 2});
113+
this.block.click({button: 0});
114+
this.block.click({button: 2});
115+
await this.browser.pause(250);
116+
const finalScroll = await this.browser.execute(() => {
117+
return window.scrollY;
118+
});
119+
120+
chai.assert.equal(initialScroll, finalScroll);
121+
});
104122
});
105123

106124
suite('Disabling', function () {

0 commit comments

Comments
 (0)