diff --git a/src/components/settings/Settings.vue b/src/components/settings/Settings.vue index 3a7a45b..57d98e9 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 f29b221..2d9e54c 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 +`) +})