Files
docx-js/src/file/paragraph/math/script/super-script/math-super-script-function.spec.ts
2023-06-05 00:33:43 +01:00

49 lines
1.5 KiB
TypeScript

import { describe, expect, it } from "vitest";
import { Formatter } from "@export/formatter";
import { MathRun } from "../../math-run";
import { MathSuperScript } from "./math-super-script-function";
describe("MathSuperScript", () => {
describe("#constructor()", () => {
it("should create a MathSuperScript with correct root key", () => {
const mathSuperScript = new MathSuperScript({
children: [new MathRun("e")],
superScript: [new MathRun("2")],
});
const tree = new Formatter().format(mathSuperScript);
expect(tree).to.deep.equal({
"m:sSup": [
{
"m:sSupPr": {},
},
{
"m:e": [
{
"m:r": [
{
"m:t": ["e"],
},
],
},
],
},
{
"m:sup": [
{
"m:r": [
{
"m:t": ["2"],
},
],
},
],
},
],
});
});
});
});