2025-03-15 10:04:01 +07:00
|
|
|
import { describe, expect, it } from "vitest";
|
|
|
|
|
|
|
|
import { Formatter } from "@export/formatter";
|
|
|
|
|
|
|
|
import { MathRun } from "../math-run";
|
2025-04-14 16:43:15 +05:30
|
|
|
import { createMathBar } from "./math-bar";
|
2025-03-15 10:04:01 +07:00
|
|
|
|
|
|
|
describe("MathBar", () => {
|
|
|
|
describe("#constructor()", () => {
|
|
|
|
it("should create a MathBar with correct root key", () => {
|
2025-04-14 16:43:15 +05:30
|
|
|
const mathBar = createMathBar({ type: "top", children: [new MathRun("text")] });
|
2025-03-15 10:04:01 +07:00
|
|
|
const tree = new Formatter().format(mathBar);
|
|
|
|
|
|
|
|
expect(tree).to.deep.equal({
|
|
|
|
"m:bar": [
|
|
|
|
{
|
|
|
|
"m:barPr": [
|
|
|
|
{
|
|
|
|
"m:pos": {
|
|
|
|
_attr: {
|
|
|
|
"w:val": "top",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"m:e": [
|
|
|
|
{
|
|
|
|
"m:r": [{ "m:t": ["text"] }],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|