mirror of
https://github.com/heyman/heynote.git
synced 2024-12-22 23:00:38 +01:00
0f3c714d56
* Add a setting to toggle the auto bracket-closing of CodeMirror * Move Auto-close brackets setting into new settings tab Editing * Add tests for Auto-close bracket setting --------- Co-authored-by: Jonatan Heyman <jonatan@heyman.info>
28 lines
1.0 KiB
JavaScript
28 lines
1.0 KiB
JavaScript
import { test, expect } from "@playwright/test";
|
|
import { HeynotePage } from "./test-utils.js";
|
|
|
|
let heynotePage
|
|
|
|
test.beforeEach(async ({ page }) => {
|
|
heynotePage = new HeynotePage(page)
|
|
await heynotePage.goto()
|
|
});
|
|
|
|
test("test bracket closing default off", async ({ page }) => {
|
|
await page.locator("body").pressSequentially("{")
|
|
expect(await heynotePage.getBlockContent(0)).toBe("{")
|
|
})
|
|
|
|
test("test bracket closing", async ({ page }) => {
|
|
await page.locator("css=.status-block.settings").click()
|
|
await page.locator("css=li.tab-editing").click()
|
|
await page.getByLabel("Auto-close brackets and quotation marks").click()
|
|
await page.locator("body").press("Escape")
|
|
await page.locator("body").pressSequentially("{")
|
|
expect(await heynotePage.getBlockContent(0)).toBe("{}")
|
|
await page.locator("body").press("Backspace")
|
|
expect(await heynotePage.getBlockContent(0)).toBe("")
|
|
await page.locator("body").pressSequentially("(hej")
|
|
await page.locator("body").pressSequentially("(hej)")
|
|
})
|