2017-04-14 11:01:47 +02:00
|
|
|
import { expect } from "chai";
|
2017-09-17 00:00:41 +01:00
|
|
|
|
|
|
|
import { Formatter } from "../../../export/formatter";
|
|
|
|
import { Text } from "./text";
|
2017-04-14 11:01:47 +02:00
|
|
|
|
|
|
|
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);
|
|
|
|
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);
|
|
|
|
expect(f).to.deep.equal({"w:t": [
|
|
|
|
{_attr: {"xml:space": "preserve"}},
|
|
|
|
" this is\n text",
|
|
|
|
]});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|