Files
docx-js/src/file/paragraph/math/script/sub-script/math-sub-script-function.spec.ts

49 lines
1.5 KiB
TypeScript
Raw Normal View History

2023-06-05 00:33:43 +01:00
import { describe, expect, it } from "vitest";
2020-10-10 13:41:26 +01:00
import { Formatter } from "@export/formatter";
2020-10-10 13:41:26 +01:00
import { MathSubScript } from "./math-sub-script-function";
import { MathRun } from "../../math-run";
2020-10-10 13:41:26 +01:00
describe("MathSubScript", () => {
describe("#constructor()", () => {
it("should create a MathSubScript with correct root key", () => {
const mathSubScript = new MathSubScript({
2020-10-13 02:06:27 +01:00
children: [new MathRun("e")],
subScript: [new MathRun("2")],
2020-10-10 13:41:26 +01:00
});
const tree = new Formatter().format(mathSubScript);
expect(tree).to.deep.equal({
"m:sSub": [
{
"m:sSubPr": {},
},
{
"m:e": [
{
"m:r": [
{
"m:t": ["e"],
},
],
},
],
},
{
"m:sub": [
{
"m:r": [
{
"m:t": ["2"],
},
],
},
],
},
],
});
});
});
});