Skip to content

Commit

Permalink
add tests for enable/disable mobile menu
Browse files Browse the repository at this point in the history
  • Loading branch information
mkslanc committed Jun 5, 2024
1 parent bacfac0 commit 4597b27
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/mouse/mouse_handler_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ module.exports = {
value = value.repeat(10);
editor.setValue(value, -1);
editor.setOption("maxLines", 10);
editor.setOption("enableMobileMenu", false);
editor.renderer.$loop._flush();
window.editor = editor;
window.sendTouchEvent = sendTouchEvent;
Expand Down Expand Up @@ -212,8 +213,17 @@ module.exports = {
editor.renderer.$loop._flush();
assert.equal(editor.getSelectedText(), "abc");

// mobile menu works
// there shouldn't be any mobile menu at that point
var menu = editor.container.querySelector(".ace_mobile-menu");
assert.ok(menu == undefined);
editor.setOption("enableMobileMenu", true);
sendTouchEvent("end", {touches: [touchPos(3, 3)]}, editor);
editor.renderer.$loop._flush();

menu = editor.container.querySelector(".ace_mobile-menu");
assert.ok(menu != undefined);

// mobile menu works
sendTouchEvent("start", {touches: [touchPos(3, 3)]}, {container: menu});
sendTouchEvent("end", {touches: [touchPos(3, 3)]}, {container: menu});
var button = editor.container.querySelectorAll(".ace_mobile-button")[1];
Expand Down

0 comments on commit 4597b27

Please sign in to comment.