Files
docx-js/src/file/paragraph/math/fraction/math-fraction.spec.ts

45 lines
1.4 KiB
TypeScript
Raw Normal View History

2019-08-15 00:47:55 +01:00
import { expect } from "chai";
import { Formatter } from "export/formatter";
2020-10-12 22:13:03 +01:00
import { MathRun } from "../math-run";
2019-08-15 00:47:55 +01:00
import { MathFraction } from "./math-fraction";
describe("MathFraction", () => {
describe("#constructor()", () => {
it("should create a MathFraction with correct root key", () => {
const mathFraction = new MathFraction({
2020-10-13 02:06:27 +01:00
numerator: [new MathRun("2")],
denominator: [new MathRun("2")],
2019-08-15 00:47:55 +01:00
});
const tree = new Formatter().format(mathFraction);
expect(tree).to.deep.equal({
"m:f": [
{
"m:num": [
{
"m:r": [
{
"m:t": ["2"],
},
],
},
],
},
{
"m:den": [
{
"m:r": [
{
"m:t": ["2"],
},
],
},
],
},
],
});
});
});
});