feat: Support LaTeX and AsciiMath via MathJax on stem.excalidraw.com

This commit is contained in:
Daniel J. Geiger 2022-12-27 15:11:52 -06:00
parent c8370b394c
commit 86f5c2ebcf
84 changed files with 8331 additions and 289 deletions

View file

@ -1,5 +1,6 @@
import {
Spreadsheet,
sortSpreadsheet,
tryParseCells,
tryParseNumber,
VALID_SPREADSHEET,
@ -118,4 +119,29 @@ describe("charts", () => {
expect(values).toEqual([61, -60, 85, -67, 54, 95]);
});
});
describe("sortSpreadsheet", () => {
it("sorts strictly numerical labels columns in ascending order", () => {
const spreadsheet = [
["x", "y"],
["1°", "1"],
["9°", "2"],
["3°", "3"],
["6°", "4"],
];
const result = tryParseCells(spreadsheet);
expect(result.type).toBe(VALID_SPREADSHEET);
const { title, labels, values } = sortSpreadsheet(
(result as { type: typeof VALID_SPREADSHEET; spreadsheet: Spreadsheet })
.spreadsheet,
);
expect(title).toEqual("y");
expect(labels).toEqual(["1°", "3°", "6°", "9°"]);
expect(values).toEqual([1, 3, 4, 2]);
});
});
});