Added constant EMPTY_OBJECT (an empty sealed object) that is used to indicate to the xml library that an empty XML element should be generated, and use it in the JSON hardcoded into the tests.

This commit is contained in:
Bruce Duncan
2019-04-10 13:47:38 -04:00
parent bb1604cd8f
commit 77edf8862b
16 changed files with 94 additions and 66 deletions

View File

@ -5,13 +5,15 @@ import { Formatter } from "export/formatter";
import { TableCell } from "../table-cell";
import { TableRow } from "./table-row";
import { EMPTY_OBJECT } from "file/xml-components";
describe("TableRow", () => {
describe("#constructor", () => {
it("should create with no cells", () => {
const tableRow = new TableRow([]);
const tree = new Formatter().format(tableRow);
expect(tree).to.deep.equal({
"w:tr": {},
"w:tr": EMPTY_OBJECT,
});
});
@ -23,7 +25,7 @@ describe("TableRow", () => {
{
"w:tc": [
{
"w:p": {},
"w:p": EMPTY_OBJECT,
},
],
},