2018-05-04 15:56:28 +02:00
|
|
|
import { expect } from "chai";
|
|
|
|
|
2018-10-26 01:04:07 +01:00
|
|
|
import { Formatter } from "export/formatter";
|
2021-05-23 08:00:49 +03:00
|
|
|
import { BorderStyle } from "file/border";
|
2021-05-23 04:25:07 +03:00
|
|
|
import { ShadingType } from "file/shading";
|
2021-05-24 21:06:34 +03:00
|
|
|
import { VerticalAlign } from "file/vertical-align";
|
|
|
|
|
2021-05-23 21:17:20 +03:00
|
|
|
import { WidthType } from "../table-width";
|
2019-09-29 04:17:21 +01:00
|
|
|
import { TableCell } from "./table-cell";
|
2021-05-24 21:06:34 +03:00
|
|
|
import { TableCellBorders, TextDirection, VerticalMergeType } from "./table-cell-components";
|
2018-05-04 15:56:28 +02:00
|
|
|
|
|
|
|
describe("TableCellBorders", () => {
|
|
|
|
describe("#prepForXml", () => {
|
|
|
|
it("should not add empty borders element if there are no borders defined", () => {
|
2021-05-22 04:03:40 +03:00
|
|
|
const tb = new TableCellBorders({});
|
2018-09-20 00:41:57 +01:00
|
|
|
expect(() => new Formatter().format(tb)).to.throw();
|
2018-05-04 15:56:28 +02:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe("#addingBorders", () => {
|
|
|
|
it("should add top border", () => {
|
2021-05-22 04:03:40 +03:00
|
|
|
const tb = new TableCellBorders({
|
|
|
|
top: {
|
|
|
|
style: BorderStyle.DOTTED,
|
|
|
|
size: 1,
|
|
|
|
color: "FF00FF",
|
|
|
|
},
|
|
|
|
});
|
2018-05-04 15:56:28 +02:00
|
|
|
|
|
|
|
const tree = new Formatter().format(tb);
|
|
|
|
expect(tree).to.deep.equal({
|
|
|
|
"w:tcBorders": [
|
|
|
|
{
|
2019-04-09 05:27:18 -04:00
|
|
|
"w:top": {
|
|
|
|
_attr: {
|
|
|
|
"w:color": "FF00FF",
|
|
|
|
"w:sz": 1,
|
|
|
|
"w:val": "dotted",
|
2018-05-04 15:56:28 +02:00
|
|
|
},
|
2019-04-09 05:27:18 -04:00
|
|
|
},
|
2018-05-04 15:56:28 +02:00
|
|
|
},
|
|
|
|
],
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it("should add start(left) border", () => {
|
2021-05-22 04:03:40 +03:00
|
|
|
const tb = new TableCellBorders({
|
|
|
|
start: {
|
|
|
|
style: BorderStyle.SINGLE,
|
|
|
|
size: 2,
|
|
|
|
color: "FF00FF",
|
|
|
|
},
|
|
|
|
});
|
2018-05-04 15:56:28 +02:00
|
|
|
|
|
|
|
const tree = new Formatter().format(tb);
|
|
|
|
expect(tree).to.deep.equal({
|
|
|
|
"w:tcBorders": [
|
|
|
|
{
|
2019-04-09 05:27:18 -04:00
|
|
|
"w:start": {
|
|
|
|
_attr: {
|
|
|
|
"w:color": "FF00FF",
|
|
|
|
"w:sz": 2,
|
|
|
|
"w:val": "single",
|
2018-05-04 15:56:28 +02:00
|
|
|
},
|
2019-04-09 05:27:18 -04:00
|
|
|
},
|
2018-05-04 15:56:28 +02:00
|
|
|
},
|
|
|
|
],
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it("should add bottom border", () => {
|
2021-05-22 04:03:40 +03:00
|
|
|
const tb = new TableCellBorders({
|
|
|
|
bottom: {
|
|
|
|
style: BorderStyle.DOUBLE,
|
|
|
|
size: 1,
|
|
|
|
color: "FF00FF",
|
|
|
|
},
|
|
|
|
});
|
2018-05-04 15:56:28 +02:00
|
|
|
|
|
|
|
const tree = new Formatter().format(tb);
|
|
|
|
expect(tree).to.deep.equal({
|
|
|
|
"w:tcBorders": [
|
|
|
|
{
|
2019-04-09 05:27:18 -04:00
|
|
|
"w:bottom": {
|
|
|
|
_attr: {
|
|
|
|
"w:color": "FF00FF",
|
|
|
|
"w:sz": 1,
|
|
|
|
"w:val": "double",
|
2018-05-04 15:56:28 +02:00
|
|
|
},
|
2019-04-09 05:27:18 -04:00
|
|
|
},
|
2018-05-04 15:56:28 +02:00
|
|
|
},
|
|
|
|
],
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it("should add end(right) border", () => {
|
2021-05-22 04:03:40 +03:00
|
|
|
const tb = new TableCellBorders({
|
|
|
|
end: {
|
|
|
|
style: BorderStyle.THICK,
|
|
|
|
size: 3,
|
|
|
|
color: "FF0000",
|
|
|
|
},
|
|
|
|
});
|
2018-05-04 15:56:28 +02:00
|
|
|
|
|
|
|
const tree = new Formatter().format(tb);
|
|
|
|
expect(tree).to.deep.equal({
|
|
|
|
"w:tcBorders": [
|
|
|
|
{
|
2019-04-09 05:27:18 -04:00
|
|
|
"w:end": {
|
|
|
|
_attr: {
|
2021-05-22 04:03:40 +03:00
|
|
|
"w:color": "FF0000",
|
2019-04-09 05:27:18 -04:00
|
|
|
"w:sz": 3,
|
|
|
|
"w:val": "thick",
|
2018-05-04 15:56:28 +02:00
|
|
|
},
|
2019-04-09 05:27:18 -04:00
|
|
|
},
|
2018-05-04 15:56:28 +02:00
|
|
|
},
|
|
|
|
],
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2019-03-05 11:34:43 +01:00
|
|
|
it("should add left border", () => {
|
2021-05-22 04:03:40 +03:00
|
|
|
const tb = new TableCellBorders({
|
|
|
|
left: {
|
|
|
|
style: BorderStyle.THICK,
|
|
|
|
size: 3,
|
|
|
|
color: "FF00FF",
|
|
|
|
},
|
|
|
|
});
|
2019-03-05 11:34:43 +01:00
|
|
|
|
|
|
|
const tree = new Formatter().format(tb);
|
|
|
|
expect(tree).to.deep.equal({
|
|
|
|
"w:tcBorders": [
|
|
|
|
{
|
2019-04-09 05:27:18 -04:00
|
|
|
"w:left": {
|
|
|
|
_attr: {
|
|
|
|
"w:color": "FF00FF",
|
|
|
|
"w:sz": 3,
|
|
|
|
"w:val": "thick",
|
2019-03-05 11:34:43 +01:00
|
|
|
},
|
2019-04-09 05:27:18 -04:00
|
|
|
},
|
2019-03-05 11:34:43 +01:00
|
|
|
},
|
|
|
|
],
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it("should add right border", () => {
|
2021-05-22 04:03:40 +03:00
|
|
|
const tb = new TableCellBorders({
|
|
|
|
right: {
|
|
|
|
style: BorderStyle.THICK,
|
|
|
|
size: 3,
|
|
|
|
color: "FF00FF",
|
|
|
|
},
|
|
|
|
});
|
2019-03-05 11:34:43 +01:00
|
|
|
|
|
|
|
const tree = new Formatter().format(tb);
|
|
|
|
expect(tree).to.deep.equal({
|
|
|
|
"w:tcBorders": [
|
|
|
|
{
|
2019-04-09 05:27:18 -04:00
|
|
|
"w:right": {
|
|
|
|
_attr: {
|
|
|
|
"w:color": "FF00FF",
|
|
|
|
"w:sz": 3,
|
|
|
|
"w:val": "thick",
|
2019-03-05 11:34:43 +01:00
|
|
|
},
|
2019-04-09 05:27:18 -04:00
|
|
|
},
|
2019-03-05 11:34:43 +01:00
|
|
|
},
|
|
|
|
],
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2018-05-04 15:56:28 +02:00
|
|
|
it("should add multiple borders", () => {
|
2021-05-22 04:03:40 +03:00
|
|
|
const tb = new TableCellBorders({
|
|
|
|
top: {
|
|
|
|
style: BorderStyle.DOTTED,
|
|
|
|
size: 1,
|
|
|
|
color: "FF00FF",
|
|
|
|
},
|
|
|
|
end: {
|
|
|
|
style: BorderStyle.THICK,
|
|
|
|
size: 3,
|
|
|
|
color: "FF00FF",
|
|
|
|
},
|
|
|
|
bottom: {
|
|
|
|
style: BorderStyle.DOUBLE,
|
|
|
|
size: 1,
|
|
|
|
color: "FF00FF",
|
|
|
|
},
|
|
|
|
start: {
|
|
|
|
style: BorderStyle.SINGLE,
|
|
|
|
size: 2,
|
|
|
|
color: "FF00FF",
|
|
|
|
},
|
|
|
|
left: {
|
|
|
|
style: BorderStyle.SINGLE,
|
|
|
|
size: 2,
|
|
|
|
color: "FF00FF",
|
|
|
|
},
|
|
|
|
right: {
|
|
|
|
style: BorderStyle.SINGLE,
|
|
|
|
size: 2,
|
|
|
|
color: "FF00FF",
|
|
|
|
},
|
|
|
|
});
|
2018-05-04 15:56:28 +02:00
|
|
|
|
|
|
|
const tree = new Formatter().format(tb);
|
|
|
|
expect(tree).to.deep.equal({
|
|
|
|
"w:tcBorders": [
|
|
|
|
{
|
2019-04-09 05:27:18 -04:00
|
|
|
"w:top": {
|
|
|
|
_attr: {
|
|
|
|
"w:color": "FF00FF",
|
|
|
|
"w:sz": 1,
|
|
|
|
"w:val": "dotted",
|
2018-05-04 15:56:28 +02:00
|
|
|
},
|
2019-04-09 05:27:18 -04:00
|
|
|
},
|
2018-05-04 15:56:28 +02:00
|
|
|
},
|
|
|
|
{
|
2021-05-22 04:03:40 +03:00
|
|
|
"w:start": {
|
2019-04-09 05:27:18 -04:00
|
|
|
_attr: {
|
|
|
|
"w:color": "FF00FF",
|
2021-05-22 04:03:40 +03:00
|
|
|
"w:sz": 2,
|
|
|
|
"w:val": "single",
|
2018-05-04 15:56:28 +02:00
|
|
|
},
|
2019-04-09 05:27:18 -04:00
|
|
|
},
|
2018-05-04 15:56:28 +02:00
|
|
|
},
|
|
|
|
{
|
2021-05-22 04:03:40 +03:00
|
|
|
"w:left": {
|
2019-04-09 05:27:18 -04:00
|
|
|
_attr: {
|
|
|
|
"w:color": "FF00FF",
|
2021-05-22 04:03:40 +03:00
|
|
|
"w:sz": 2,
|
|
|
|
"w:val": "single",
|
2018-05-04 15:56:28 +02:00
|
|
|
},
|
2019-04-09 05:27:18 -04:00
|
|
|
},
|
2018-05-04 15:56:28 +02:00
|
|
|
},
|
|
|
|
{
|
2021-05-22 04:03:40 +03:00
|
|
|
"w:bottom": {
|
2019-04-09 05:27:18 -04:00
|
|
|
_attr: {
|
|
|
|
"w:color": "FF00FF",
|
2021-05-22 04:03:40 +03:00
|
|
|
"w:sz": 1,
|
|
|
|
"w:val": "double",
|
2018-05-04 15:56:28 +02:00
|
|
|
},
|
2019-04-09 05:27:18 -04:00
|
|
|
},
|
2018-05-04 15:56:28 +02:00
|
|
|
},
|
2019-03-05 11:34:43 +01:00
|
|
|
{
|
2021-05-22 04:03:40 +03:00
|
|
|
"w:end": {
|
2019-04-09 05:27:18 -04:00
|
|
|
_attr: {
|
|
|
|
"w:color": "FF00FF",
|
2021-05-22 04:03:40 +03:00
|
|
|
"w:sz": 3,
|
|
|
|
"w:val": "thick",
|
2019-03-05 11:34:43 +01:00
|
|
|
},
|
2019-04-09 05:27:18 -04:00
|
|
|
},
|
2019-03-05 11:34:43 +01:00
|
|
|
},
|
|
|
|
{
|
2019-04-09 05:27:18 -04:00
|
|
|
"w:right": {
|
|
|
|
_attr: {
|
|
|
|
"w:color": "FF00FF",
|
|
|
|
"w:sz": 2,
|
|
|
|
"w:val": "single",
|
2019-03-05 11:34:43 +01:00
|
|
|
},
|
2019-04-09 05:27:18 -04:00
|
|
|
},
|
2019-03-05 11:34:43 +01:00
|
|
|
},
|
2018-05-04 15:56:28 +02:00
|
|
|
],
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2019-09-29 04:17:21 +01:00
|
|
|
describe("TableCell", () => {
|
|
|
|
describe("#constructor", () => {
|
|
|
|
it("should create", () => {
|
|
|
|
const cell = new TableCell({
|
|
|
|
children: [],
|
|
|
|
});
|
|
|
|
|
|
|
|
const tree = new Formatter().format(cell);
|
|
|
|
|
|
|
|
expect(tree).to.deep.equal({
|
|
|
|
"w:tc": [
|
|
|
|
{
|
|
|
|
"w:p": {},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it("should create with vertical align", () => {
|
|
|
|
const cell = new TableCell({
|
|
|
|
children: [],
|
|
|
|
verticalAlign: VerticalAlign.CENTER,
|
|
|
|
});
|
|
|
|
|
|
|
|
const tree = new Formatter().format(cell);
|
|
|
|
|
|
|
|
expect(tree).to.deep.equal({
|
|
|
|
"w:tc": [
|
|
|
|
{
|
|
|
|
"w:tcPr": [
|
|
|
|
{
|
|
|
|
"w:vAlign": {
|
|
|
|
_attr: {
|
|
|
|
"w:val": "center",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
2020-05-10 10:36:25 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"w:p": {},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it("should create with text direction", () => {
|
|
|
|
const cell = new TableCell({
|
|
|
|
children: [],
|
2020-05-13 02:51:47 +01:00
|
|
|
textDirection: TextDirection.BOTTOM_TO_TOP_LEFT_TO_RIGHT,
|
2020-05-10 10:36:25 -07:00
|
|
|
});
|
|
|
|
|
|
|
|
const tree = new Formatter().format(cell);
|
|
|
|
|
|
|
|
expect(tree).to.deep.equal({
|
|
|
|
"w:tc": [
|
|
|
|
{
|
|
|
|
"w:tcPr": [
|
|
|
|
{
|
|
|
|
"w:textDirection": {
|
|
|
|
_attr: {
|
|
|
|
"w:val": "btLr",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
2019-09-29 04:17:21 +01:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"w:p": {},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it("should create with vertical merge", () => {
|
|
|
|
const cell = new TableCell({
|
|
|
|
children: [],
|
|
|
|
verticalMerge: VerticalMergeType.RESTART,
|
|
|
|
});
|
|
|
|
|
|
|
|
const tree = new Formatter().format(cell);
|
|
|
|
|
|
|
|
expect(tree).to.deep.equal({
|
|
|
|
"w:tc": [
|
|
|
|
{
|
|
|
|
"w:tcPr": [
|
|
|
|
{
|
|
|
|
"w:vMerge": {
|
|
|
|
_attr: {
|
|
|
|
"w:val": "restart",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"w:p": {},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it("should create with margins", () => {
|
|
|
|
const cell = new TableCell({
|
|
|
|
children: [],
|
|
|
|
margins: {
|
|
|
|
top: 1,
|
|
|
|
left: 1,
|
|
|
|
bottom: 1,
|
|
|
|
right: 1,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
const tree = new Formatter().format(cell);
|
|
|
|
|
|
|
|
expect(tree).to.deep.equal({
|
|
|
|
"w:tc": [
|
|
|
|
{
|
|
|
|
"w:tcPr": [
|
|
|
|
{
|
|
|
|
"w:tcMar": [
|
|
|
|
{
|
|
|
|
"w:top": {
|
|
|
|
_attr: {
|
|
|
|
"w:type": "dxa",
|
|
|
|
"w:w": 1,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2021-05-23 21:17:20 +03:00
|
|
|
"w:left": {
|
2019-09-29 04:17:21 +01:00
|
|
|
_attr: {
|
|
|
|
"w:type": "dxa",
|
|
|
|
"w:w": 1,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2021-05-20 01:03:09 +03:00
|
|
|
"w:bottom": {
|
2019-09-29 04:17:21 +01:00
|
|
|
_attr: {
|
|
|
|
"w:type": "dxa",
|
|
|
|
"w:w": 1,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2021-05-23 21:17:20 +03:00
|
|
|
"w:right": {
|
2019-09-29 04:17:21 +01:00
|
|
|
_attr: {
|
|
|
|
"w:type": "dxa",
|
|
|
|
"w:w": 1,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"w:p": {},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it("should create with shading", () => {
|
|
|
|
const cell = new TableCell({
|
|
|
|
children: [],
|
|
|
|
shading: {
|
2021-05-24 08:20:08 +03:00
|
|
|
fill: "FF0000",
|
|
|
|
color: "0000ff",
|
2019-09-29 04:17:21 +01:00
|
|
|
val: ShadingType.PERCENT_10,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
const tree = new Formatter().format(cell);
|
|
|
|
|
|
|
|
expect(tree).to.deep.equal({
|
|
|
|
"w:tc": [
|
|
|
|
{
|
|
|
|
"w:tcPr": [
|
|
|
|
{
|
|
|
|
"w:shd": {
|
|
|
|
_attr: {
|
2021-05-24 08:20:08 +03:00
|
|
|
"w:color": "0000ff",
|
|
|
|
"w:fill": "FF0000",
|
2019-09-29 04:17:21 +01:00
|
|
|
"w:val": "pct10",
|
|
|
|
},
|
|
|
|
},
|
2019-10-12 03:14:25 +03:00
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"w:p": {},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it("should create with width", () => {
|
|
|
|
const cell = new TableCell({
|
|
|
|
children: [],
|
|
|
|
width: { size: 100, type: WidthType.DXA },
|
|
|
|
});
|
|
|
|
const tree = new Formatter().format(cell);
|
|
|
|
expect(tree).to.deep.equal({
|
|
|
|
"w:tc": [
|
|
|
|
{
|
|
|
|
"w:tcPr": [
|
|
|
|
{
|
|
|
|
"w:tcW": {
|
|
|
|
_attr: {
|
|
|
|
"w:type": "dxa",
|
|
|
|
"w:w": 100,
|
|
|
|
},
|
|
|
|
},
|
2019-09-29 04:17:21 +01:00
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"w:p": {},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it("should create with column span", () => {
|
|
|
|
const cell = new TableCell({
|
|
|
|
children: [],
|
|
|
|
columnSpan: 2,
|
|
|
|
});
|
|
|
|
|
|
|
|
const tree = new Formatter().format(cell);
|
|
|
|
|
|
|
|
expect(tree).to.deep.equal({
|
|
|
|
"w:tc": [
|
|
|
|
{
|
|
|
|
"w:tcPr": [
|
|
|
|
{
|
|
|
|
"w:gridSpan": {
|
|
|
|
_attr: {
|
|
|
|
"w:val": 2,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"w:p": {},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe("rowSpan", () => {
|
|
|
|
it("should not create with row span if its less than 1", () => {
|
|
|
|
const cell = new TableCell({
|
|
|
|
children: [],
|
|
|
|
rowSpan: 0,
|
|
|
|
});
|
|
|
|
|
|
|
|
const tree = new Formatter().format(cell);
|
|
|
|
|
|
|
|
expect(tree).to.deep.equal({
|
|
|
|
"w:tc": [
|
|
|
|
{
|
|
|
|
"w:p": {},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it("should create with row span if its greater than 1", () => {
|
|
|
|
const cell = new TableCell({
|
|
|
|
children: [],
|
|
|
|
rowSpan: 2,
|
|
|
|
});
|
|
|
|
|
|
|
|
const tree = new Formatter().format(cell);
|
|
|
|
|
|
|
|
expect(tree).to.deep.equal({
|
|
|
|
"w:tc": [
|
|
|
|
{
|
|
|
|
"w:tcPr": [
|
|
|
|
{
|
|
|
|
"w:vMerge": {
|
|
|
|
_attr: {
|
|
|
|
"w:val": "restart",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"w:p": {},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it("should create with borders", () => {
|
|
|
|
const cell = new TableCell({
|
|
|
|
children: [],
|
|
|
|
borders: {
|
|
|
|
top: {
|
|
|
|
style: BorderStyle.DASH_DOT_STROKED,
|
|
|
|
size: 3,
|
2021-05-24 08:42:34 +03:00
|
|
|
color: "FF0000",
|
2019-09-29 04:17:21 +01:00
|
|
|
},
|
|
|
|
bottom: {
|
|
|
|
style: BorderStyle.DOUBLE,
|
|
|
|
size: 3,
|
2021-05-24 08:42:34 +03:00
|
|
|
color: "0000ff",
|
2019-09-29 04:17:21 +01:00
|
|
|
},
|
|
|
|
left: {
|
|
|
|
style: BorderStyle.DASH_DOT_STROKED,
|
|
|
|
size: 3,
|
2021-05-24 08:42:34 +03:00
|
|
|
color: "00ff00",
|
2019-09-29 04:17:21 +01:00
|
|
|
},
|
|
|
|
right: {
|
|
|
|
style: BorderStyle.DASH_DOT_STROKED,
|
|
|
|
size: 3,
|
|
|
|
color: "#ff8000",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
const tree = new Formatter().format(cell);
|
|
|
|
|
|
|
|
expect(tree).to.deep.equal({
|
|
|
|
"w:tc": [
|
|
|
|
{
|
|
|
|
"w:tcPr": [
|
|
|
|
{
|
|
|
|
"w:tcBorders": [
|
|
|
|
{
|
|
|
|
"w:top": {
|
|
|
|
_attr: {
|
2021-05-24 08:42:34 +03:00
|
|
|
"w:color": "FF0000",
|
2019-09-29 04:17:21 +01:00
|
|
|
"w:sz": 3,
|
|
|
|
"w:val": "dashDotStroked",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2021-05-20 02:18:17 +03:00
|
|
|
"w:left": {
|
2019-09-29 04:17:21 +01:00
|
|
|
_attr: {
|
2021-05-24 08:42:34 +03:00
|
|
|
"w:color": "00ff00",
|
2019-09-29 04:17:21 +01:00
|
|
|
"w:sz": 3,
|
2021-05-20 02:18:17 +03:00
|
|
|
"w:val": "dashDotStroked",
|
2019-09-29 04:17:21 +01:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2021-05-20 02:18:17 +03:00
|
|
|
"w:bottom": {
|
2019-09-29 04:17:21 +01:00
|
|
|
_attr: {
|
2021-05-24 08:42:34 +03:00
|
|
|
"w:color": "0000ff",
|
2019-09-29 04:17:21 +01:00
|
|
|
"w:sz": 3,
|
2021-05-20 02:18:17 +03:00
|
|
|
"w:val": "double",
|
2019-09-29 04:17:21 +01:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"w:right": {
|
|
|
|
_attr: {
|
2021-05-24 08:42:34 +03:00
|
|
|
"w:color": "ff8000",
|
2019-09-29 04:17:21 +01:00
|
|
|
"w:sz": 3,
|
|
|
|
"w:val": "dashDotStroked",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"w:p": {},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|