heynote/tests/markdown.spec.js
Jonatan Heyman bb511b868b
Add support for more languages (#69)
* Contain language selection dialog in an element that can be scrolled, and automatically scroll it if needed when navigating the list with arrow keys

* Add support for more languages:

Clojure, Erlang, Golang, Lezer, Ruby, Shell, YAML

* Move prettier auto format settings for languages into Language() class

* Remove invalid import

* Fix bug that could cause auto formatting to fail for the last block.
Add tests for language auto detection and formatting.

* Fix broken tests

* Fix language auto detection on Safari Webkit which was broken

* Remove unnecessary wait time
2023-12-26 00:27:43 +01:00

37 lines
1014 B
JavaScript

import { test, expect } from "@playwright/test";
import { HeynotePage } from "./test-utils.js";
let heynotePage
test.beforeEach(async ({ page }) => {
console.log("beforeEach")
heynotePage = new HeynotePage(page)
await heynotePage.goto()
});
test("test markdown mode", async ({ page }) => {
await heynotePage.setContent(`
∞∞∞markdown
# Markdown!
- [ ] todo
- [x] done
`)
await page.waitForTimeout(200)
//await page.locator("body").pressSequentially("test")
await expect(page.locator("css=.status .status-block.lang")).toHaveText("Markdown")
})
test("checkbox toggle", async ({ page }) => {
await heynotePage.setContent(`
∞∞∞markdown
- [ ] todo
`)
const checkbox = await page.locator("css=.cm-content input[type=checkbox]")
await expect(checkbox).toHaveCount(1)
await checkbox.click()
expect(await heynotePage.getBlockContent(0)).toBe("- [x] todo\n")
await checkbox.click()
expect(await heynotePage.getBlockContent(0)).toBe("- [ ] todo\n")
})