Add test for custom default block language

This commit is contained in:
Jonatan Heyman 2024-07-14 12:14:58 +02:00
parent d82b3920d7
commit 0aaf62925f
2 changed files with 30 additions and 0 deletions

View File

@ -284,6 +284,7 @@
type="checkbox" type="checkbox"
v-model="defaultBlockLanguageAutoDetect" v-model="defaultBlockLanguageAutoDetect"
@change="updateSettings" @change="updateSettings"
class="language-auto-detect"
/> />
Auto-detection (default: on) Auto-detection (default: on)
</label> </label>

View File

@ -114,3 +114,32 @@ const runTest = async (page, key, expectedBlocks) => {
await expect(await page.locator("css=.heynote-block-start.first")).toHaveCount(1) 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
`)
})