Skip to content

Commit

Permalink
Add tests for Auto-close bracket setting
Browse files Browse the repository at this point in the history
  • Loading branch information
heyman committed Jan 4, 2024
1 parent c80479e commit 270530d
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
27 changes: 27 additions & 0 deletions tests/auto-closing-brackets.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
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)")
})
1 change: 1 addition & 0 deletions webapp/bridge.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ let initialSettings = {
emacsMetaKey: "meta",
showLineNumberGutter: true,
showFoldGutter: true,
bracketClosing: false,
}
if (settingsData !== null) {
initialSettings = Object.assign(initialSettings, JSON.parse(settingsData))
Expand Down

0 comments on commit 270530d

Please sign in to comment.