2023-06-05 00:33:43 +01:00
|
|
|
import { describe, expect, it } from "vitest";
|
2019-08-20 20:40:40 +01:00
|
|
|
|
2022-06-26 23:26:42 +01:00
|
|
|
import { Formatter } from "@export/formatter";
|
2019-08-20 20:40:40 +01:00
|
|
|
|
|
|
|
import { MathRun } from "../math-run";
|
2025-04-14 16:43:15 +05:30
|
|
|
import { createMathSuperScriptElement } from "./math-super-script";
|
2019-08-20 20:40:40 +01:00
|
|
|
|
2025-04-14 16:43:15 +05:30
|
|
|
describe("createMathSuperScriptElement", () => {
|
2019-08-20 20:40:40 +01:00
|
|
|
describe("#constructor()", () => {
|
2020-10-10 13:41:26 +01:00
|
|
|
it("should create a MathSuperScriptElement with correct root key", () => {
|
2025-04-14 16:43:15 +05:30
|
|
|
const mathSuperScriptElement = createMathSuperScriptElement({ children: [new MathRun("2+2")] });
|
2019-08-20 20:40:40 +01:00
|
|
|
|
2020-10-10 13:41:26 +01:00
|
|
|
const tree = new Formatter().format(mathSuperScriptElement);
|
2019-08-20 20:40:40 +01:00
|
|
|
expect(tree).to.deep.equal({
|
|
|
|
"m:sup": [
|
|
|
|
{
|
|
|
|
"m:r": [
|
|
|
|
{
|
|
|
|
"m:t": ["2+2"],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|