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:
@ -5,6 +5,8 @@ import { Formatter } from "export/formatter";
|
||||
import { TableCell } from "./table-cell";
|
||||
import { TableColumn } from "./table-column";
|
||||
|
||||
import { EMPTY_OBJECT } from "file/xml-components";
|
||||
|
||||
describe("TableColumn", () => {
|
||||
let cells: TableCell[];
|
||||
beforeEach(() => {
|
||||
@ -37,15 +39,15 @@ describe("TableColumn", () => {
|
||||
|
||||
const tree = new Formatter().format(cells[0]);
|
||||
expect(tree).to.deep.equal({
|
||||
"w:tc": [{ "w:tcPr": [{ "w:vMerge": { _attr: { "w:val": "restart" } } }] }, { "w:p": {} }],
|
||||
"w:tc": [{ "w:tcPr": [{ "w:vMerge": { _attr: { "w:val": "restart" } } }] }, { "w:p": EMPTY_OBJECT }],
|
||||
});
|
||||
|
||||
const tree2 = new Formatter().format(cells[1]);
|
||||
expect(tree2).to.deep.equal({ "w:tc": [{ "w:p": {} }] });
|
||||
expect(tree2).to.deep.equal({ "w:tc": [{ "w:p": EMPTY_OBJECT }] });
|
||||
|
||||
const tree3 = new Formatter().format(cells[2]);
|
||||
expect(tree3).to.deep.equal({
|
||||
"w:tc": [{ "w:tcPr": [{ "w:vMerge": { _attr: { "w:val": "continue" } } }] }, { "w:p": {} }],
|
||||
"w:tc": [{ "w:tcPr": [{ "w:vMerge": { _attr: { "w:val": "continue" } } }] }, { "w:p": EMPTY_OBJECT }],
|
||||
});
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user