diff --git a/test/fixtures/basic_md_table.html b/test/fixtures/basic_md_table.html new file mode 100644 index 0000000..d2a3caf --- /dev/null +++ b/test/fixtures/basic_md_table.html @@ -0,0 +1,60 @@ + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Fruit NameQuantityUnit Cost per ItemSubtotal
Apple1$1.50$1.50
Pear2$2.00$4.00
Orange3$2.50$7.50
Grape60$0.05$3.00
Total$16.00
+ +
+ + diff --git a/test/test.ts b/test/test.ts index 20f61a8..d82c661 100644 --- a/test/test.ts +++ b/test/test.ts @@ -3,7 +3,7 @@ import { assertStringIncludes, } from "https://deno.land/std@0.211.0/assert/mod.ts"; import { DOMParser } from "https://deno.land/x/deno_dom@v0.1.43/deno-dom-wasm.ts"; -import { render, Renderer } from "../mod.ts"; +import { CSS, render, Renderer } from "../mod.ts"; Deno.test("Basic markdown", async () => { const markdown = await Deno.readTextFile("./test/fixtures/basic.md"); @@ -287,3 +287,41 @@ Deno.test("expect console warning from invalid math", () => { console.warn = originalWarn; }); + +Deno.test("basic md table with dollar signs", () => { + const markdown = `| Fruit Name | Quantity | Unit Cost per Item | Subtotal | + |------------|----------|--------------------|----------| + | Apple | 1 | $1.50 | $1.50 | + | Pear | 2 | $2.00 | $4.00 | + | Orange | 3 | $2.50 | $7.50 | + | Grape | 60 | $0.05 | $3.00 | + | Total | | | $16.00 |`; + + const body = render(markdown); + const html = ` + + + + + + + + +
+ ${body} +
+ + +`; + // uncomment to update the fixture when the css changes + // Deno.writeTextFileSync("./test/fixtures/basic_md_table.html", html); + + const expected = Deno.readTextFileSync("./test/fixtures/basic_md_table.html"); + assertEquals(html, expected); +});