From 0aaf62925f85bbf915fe0187d604470d8086d294 Mon Sep 17 00:00:00 2001 From: Jonatan Heyman Date: Sun, 14 Jul 2024 12:14:58 +0200 Subject: [PATCH] Add test for custom default block language --- src/components/settings/Settings.vue | 1 + tests/block-creation.spec.js | 29 ++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/src/components/settings/Settings.vue b/src/components/settings/Settings.vue index 3a7a45b2..57d98e95 100644 --- a/src/components/settings/Settings.vue +++ b/src/components/settings/Settings.vue @@ -284,6 +284,7 @@ type="checkbox" v-model="defaultBlockLanguageAutoDetect" @change="updateSettings" + class="language-auto-detect" /> Auto-detection (default: on) diff --git a/tests/block-creation.spec.js b/tests/block-creation.spec.js index f29b2212..2d9e54c4 100644 --- a/tests/block-creation.spec.js +++ b/tests/block-creation.spec.js @@ -114,3 +114,32 @@ const runTest = async (page, key, expectedBlocks) => { await expect(await page.locator("css=.heynote-block-start.first")).toHaveCount(1) } + +test("test custom default block language", async ({ page, browserName }) => { + heynotePage.setContent(` +∞∞∞text +Text block`) + await page.locator("css=.status-block.settings").click() + await page.locator("css=li.tab-editing").click() + await page.locator("css=select.block-language").selectOption("Rust") + await page.locator("body").press("Escape") + await page.locator("body").press((heynotePage.isMac ? "Meta" : "Control") + "+Enter") + expect(await heynotePage.getContent()).toBe(` +∞∞∞text +Text block +∞∞∞rust-a +`) + + await page.locator("css=.status-block.settings").click() + await page.locator("css=li.tab-editing").click() + await page.locator("css=input.language-auto-detect").click() + await page.locator("body").press("Escape") + await page.locator("body").press((heynotePage.isMac ? "Meta" : "Control") + "+Enter") + expect(await heynotePage.getContent()).toBe(` +∞∞∞text +Text block +∞∞∞rust-a + +∞∞∞rust +`) +})