Files
heynote/tests/math.spec.js
Jonatan Heyman a1cad5b335 Don't display string quotes for math results that are strings. (#92)
Fix bug that could cause the cursor to be positioned immediately to the left of the widget (within its margin) making it look like there was a space character in the buffer when there was not.
Add tests for math blocks.

Fixes #21.
2023-12-29 10:47:02 +01:00

27 lines
666 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 math mode", async ({ page }) => {
await heynotePage.setContent(`
∞∞∞math
42*30+77
`)
await expect(page.locator("css=.heynote-math-result")).toHaveText("1337")
})
test("test math string result has no quotes", async ({ page }) => {
await heynotePage.setContent(`
∞∞∞math
format(1/3, 3)
`)
await expect(page.locator("css=.heynote-math-result")).toHaveText("0.333")
})