Files
docx-js/src/file/paragraph/run/run-components/text.spec.ts

23 lines
765 B
TypeScript
Raw Normal View History

import { expect } from "chai";
2017-12-19 23:13:11 +00:00
import { Formatter } from "../../../../export/formatter";
import { Text } from "./text";
describe("Text", () => {
describe("#constructor", () => {
it("creates an empty text run if no text is given", () => {
const t = new Text("");
const f = new Formatter().format(t);
2018-01-23 01:33:12 +00:00
expect(f).to.deep.equal({ "w:t": [{ _attr: { "xml:space": "preserve" } }] });
});
it("adds the passed in text to the component", () => {
const t = new Text(" this is\n text");
const f = new Formatter().format(t);
2018-01-23 01:33:12 +00:00
expect(f).to.deep.equal({
"w:t": [{ _attr: { "xml:space": "preserve" } }, " this is\n text"],
});
});
});
});