Skip to content

Commit

Permalink
Add test for custom default block language
Browse files Browse the repository at this point in the history
  • Loading branch information
heyman committed Jul 14, 2024
1 parent 715294d commit 2fdef8d
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/components/settings/Settings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@
type="checkbox"
v-model="defaultBlockLanguageAutoDetect"
@change="updateSettings"
class="language-auto-detect"
/>
Auto-detection (default: on)
</label>
Expand Down
29 changes: 29 additions & 0 deletions tests/block-creation.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
`)
})

0 comments on commit 2fdef8d

Please sign in to comment.