Skip to content

Commit 554e04e

Browse files
committed
Fix test on linux/windows
Change Playwright reporter when running in Github action Change default emacs meta key to Alt on non Linux and Windows Always set emacsMetaKey to "alt" if not on Mac, since the option is only available on Mac
1 parent 17091d3 commit 554e04e

File tree

7 files changed

+16
-10
lines changed

7 files changed

+16
-10
lines changed

electron/config.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import Store from "electron-store"
2+
import { isMac } from "./detect-platform"
23

34
const isDev = !!process.env.VITE_DEV_SERVER_URL
45

@@ -50,7 +51,7 @@ const schema = {
5051
const defaults = {
5152
settings: {
5253
keymap: "default",
53-
emacsMetaKey: "meta",
54+
emacsMetaKey: isMac ? "meta" : "alt",
5455
showLineNumberGutter: true,
5556
showFoldGutter: true,
5657
autoUpdate: true,

playwright.config.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export default defineConfig({
2020
/* Opt out of parallel tests on CI. */
2121
workers: process.env.CI ? 1 : undefined,
2222
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
23-
reporter: 'html',
23+
reporter: process.env.CI ? [['github'], ['html']] : 'list',
2424
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
2525
use: {
2626
/* Base URL to use in actions like `await page.goto('/')`. */

src/components/Editor.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
},
1414
emacsMetaKey: {
1515
type: String,
16-
default: "Meta",
16+
default: "alt",
1717
},
1818
showLineNumberGutter: {
1919
type: Boolean,

src/components/settings/Settings.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
showLineNumberGutter: this.showLineNumberGutter,
6161
showFoldGutter: this.showFoldGutter,
6262
keymap: this.keymap,
63-
emacsMetaKey: this.metaKey,
63+
emacsMetaKey: window.heynote.platform.isMac ? this.metaKey : "alt",
6464
allowBetaVersions: this.allowBetaVersions,
6565
enableGlobalHotkey: this.enableGlobalHotkey,
6666
globalHotkey: this.globalHotkey,

src/editor/editor.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export class HeynoteEditor {
4040
theme="light",
4141
saveFunction=null,
4242
keymap="default",
43-
emacsMetaKey="Meta",
43+
emacsMetaKey,
4444
showLineNumberGutter=true,
4545
showFoldGutter=true,
4646
bracketClosing=false,

tests/emacs-clipboard-keys.spec.js

+9-4
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,22 @@ test("test emacs copy/pase/cut key bindings", async ({ page, browserName }) => {
1717
await page.locator("css=.status-block.settings").click()
1818
//await page.locator("css=li.tab-editing").click()
1919
await page.locator("css=select.keymap").selectOption("emacs")
20-
await page.locator("css=select.metaKey").selectOption("alt")
20+
if (heynotePage.isMac) {
21+
await page.locator("css=select.metaKey").selectOption("alt")
22+
}
2123
await page.locator("body").press("Escape")
2224

2325
await page.locator("body").pressSequentially("test")
24-
await page.locator("body").press(heynotePage.isMac ? "Meta+A" : "Control+A")
26+
await page.locator("body").press("Control+Space")
27+
await page.locator("body").press("Control+A")
2528
await page.locator("body").press("Alt+W")
2629
expect(await heynotePage.getBlockContent(0)).toBe("test")
2730
await page.locator("body").press("Control+Y")
2831
expect(await heynotePage.getBlockContent(0)).toBe("testtest")
29-
30-
await page.locator("body").press(heynotePage.isMac ? "Meta+A" : "Control+A")
32+
33+
await page.locator("body").press("Control+E")
34+
await page.locator("body").press("Control+Space")
35+
await page.locator("body").press("Control+A")
3136
await page.locator("body").press("Control+W")
3237
expect(await heynotePage.getBlockContent(0)).toBe("")
3338
await page.locator("body").press("Control+Y")

webapp/bridge.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ const ipcRenderer = new IpcRenderer()
6161
let settingsData = localStorage.getItem("settings")
6262
let initialSettings = {
6363
keymap: "default",
64-
emacsMetaKey: "meta",
64+
emacsMetaKey: "alt",
6565
showLineNumberGutter: true,
6666
showFoldGutter: true,
6767
bracketClosing: false,

0 commit comments

Comments
 (0)