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

294 lines
8.6 KiB
TypeScript
Raw Normal View History

2019-06-26 02:11:43 +01:00
import { expect } from "chai";
2018-10-26 01:04:07 +01:00
import { Formatter } from "export/formatter";
import * as u from "./underline";
2016-07-13 00:59:53 +01:00
2016-07-13 18:49:02 +01:00
describe("Underline", () => {
2016-07-13 00:59:53 +01:00
describe("#constructor()", () => {
2016-07-13 18:49:02 +01:00
it("should create a new Underline object with u:u as the rootKey", () => {
const underline = new u.Underline();
2019-06-26 02:11:43 +01:00
const tree = new Formatter().format(underline);
expect(tree).to.deep.equal({
"w:u": {
_attr: {
"w:val": "single",
},
},
});
2016-07-13 00:59:53 +01:00
});
it("should default to 'single' and no color", () => {
const underline = new u.Underline();
const tree = new Formatter().format(underline);
expect(tree).to.deep.equal({
"w:u": { _attr: { "w:val": "single" } },
});
});
it("should use the given style type and color", () => {
const underline = new u.Underline("double", "FF00CC");
const tree = new Formatter().format(underline);
expect(tree).to.deep.equal({
"w:u": { _attr: { "w:val": "double", "w:color": "FF00CC" } },
});
});
2016-07-13 00:59:53 +01:00
});
});
2016-07-15 18:50:54 +01:00
describe("DashDotDotHeavyUnderline", () => {
2016-07-13 00:59:53 +01:00
describe("#constructor()", () => {
2016-07-13 18:49:02 +01:00
it("should put value in attribute", () => {
const underline = new u.DashDotDotHeavyUnderline();
2019-06-26 02:11:43 +01:00
const tree = new Formatter().format(underline);
expect(tree).to.deep.equal({
"w:u": {
_attr: {
"w:val": "dashDotDotHeavy",
},
},
});
2016-07-13 18:49:02 +01:00
});
});
});
2016-07-15 18:50:54 +01:00
describe("DashDotDotHeavyUnderline", () => {
2016-07-13 18:49:02 +01:00
describe("#constructor()", () => {
it("should put value in attribute", () => {
const underline = new u.DashDotHeavyUnderline();
2019-06-26 02:11:43 +01:00
const tree = new Formatter().format(underline);
expect(tree).to.deep.equal({
"w:u": {
_attr: {
"w:val": "dashDotHeavy",
},
},
});
2016-07-13 00:59:53 +01:00
});
});
});
2016-07-13 18:49:02 +01:00
2016-07-15 18:50:54 +01:00
describe("DashDotDotHeavyUnderline", () => {
2016-07-13 18:49:02 +01:00
describe("#constructor()", () => {
it("should put value in attribute", () => {
const underline = new u.DashLongHeavyUnderline();
2019-06-26 02:11:43 +01:00
const tree = new Formatter().format(underline);
expect(tree).to.deep.equal({
"w:u": {
_attr: {
"w:val": "dashLongHeavy",
},
},
});
2016-07-13 18:49:02 +01:00
});
});
});
2016-07-15 18:50:54 +01:00
describe("DashDotDotHeavyUnderline", () => {
2016-07-13 18:49:02 +01:00
describe("#constructor()", () => {
it("should put value in attribute", () => {
const underline = new u.DashLongUnderline();
2019-06-26 02:11:43 +01:00
const tree = new Formatter().format(underline);
expect(tree).to.deep.equal({
"w:u": {
_attr: {
"w:val": "dashLong",
},
},
});
2016-07-13 18:49:02 +01:00
});
});
});
2016-07-15 18:50:54 +01:00
describe("DashDotDotHeavyUnderline", () => {
2016-07-13 18:49:02 +01:00
describe("#constructor()", () => {
it("should put value in attribute", () => {
const underline = new u.DashUnderline();
2019-06-26 02:11:43 +01:00
const tree = new Formatter().format(underline);
expect(tree).to.deep.equal({
"w:u": {
_attr: {
"w:val": "dash",
},
},
});
2016-07-13 18:49:02 +01:00
});
});
});
2016-07-15 18:50:54 +01:00
describe("DashDotDotHeavyUnderline", () => {
2016-07-13 18:49:02 +01:00
describe("#constructor()", () => {
it("should put value in attribute", () => {
const underline = new u.DotDashUnderline();
2019-06-26 02:11:43 +01:00
const tree = new Formatter().format(underline);
expect(tree).to.deep.equal({
"w:u": {
_attr: {
"w:val": "dotDash",
},
},
});
2016-07-13 18:49:02 +01:00
});
});
});
2016-07-15 18:50:54 +01:00
describe("DashDotDotHeavyUnderline", () => {
2016-07-13 18:49:02 +01:00
describe("#constructor()", () => {
it("should put value in attribute", () => {
const underline = new u.DotDotDashUnderline();
2019-06-26 02:11:43 +01:00
const tree = new Formatter().format(underline);
expect(tree).to.deep.equal({
"w:u": {
_attr: {
"w:val": "dotDotDash",
},
},
});
2016-07-13 18:49:02 +01:00
});
});
});
2016-07-15 18:50:54 +01:00
describe("DashDotDotHeavyUnderline", () => {
2016-07-13 18:49:02 +01:00
describe("#constructor()", () => {
it("should put value in attribute", () => {
const underline = new u.DottedHeavyUnderline();
2019-06-26 02:11:43 +01:00
const tree = new Formatter().format(underline);
expect(tree).to.deep.equal({
"w:u": {
_attr: {
"w:val": "dottedHeavy",
},
},
});
2016-07-13 18:49:02 +01:00
});
});
});
2016-07-15 18:50:54 +01:00
describe("DashDotDotHeavyUnderline", () => {
2016-07-13 18:49:02 +01:00
describe("#constructor()", () => {
it("should put value in attribute", () => {
const underline = new u.DottedUnderline();
2019-06-26 02:11:43 +01:00
const tree = new Formatter().format(underline);
expect(tree).to.deep.equal({
"w:u": {
_attr: {
"w:val": "dotted",
},
},
});
2016-07-13 18:49:02 +01:00
});
});
});
2016-07-15 18:50:54 +01:00
describe("DashDotDotHeavyUnderline", () => {
2016-07-13 18:49:02 +01:00
describe("#constructor()", () => {
it("should put value in attribute", () => {
const underline = new u.DoubleUnderline();
2019-06-26 02:11:43 +01:00
const tree = new Formatter().format(underline);
expect(tree).to.deep.equal({
"w:u": {
_attr: {
"w:val": "double",
},
},
});
2016-07-13 18:49:02 +01:00
});
});
});
2016-07-15 18:50:54 +01:00
describe("DashDotDotHeavyUnderline", () => {
2016-07-13 18:49:02 +01:00
describe("#constructor()", () => {
it("should put value in attribute", () => {
const underline = new u.SingleUnderline();
2019-06-26 02:11:43 +01:00
const tree = new Formatter().format(underline);
expect(tree).to.deep.equal({
"w:u": {
_attr: {
"w:val": "single",
},
},
});
2016-07-13 18:49:02 +01:00
});
});
});
2016-07-15 18:50:54 +01:00
describe("DashDotDotHeavyUnderline", () => {
2016-07-13 18:49:02 +01:00
describe("#constructor()", () => {
it("should put value in attribute", () => {
const underline = new u.ThickUnderline();
2019-06-26 02:11:43 +01:00
const tree = new Formatter().format(underline);
expect(tree).to.deep.equal({
"w:u": {
_attr: {
"w:val": "thick",
},
},
});
2016-07-13 18:49:02 +01:00
});
});
});
2016-07-15 18:50:54 +01:00
describe("DashDotDotHeavyUnderline", () => {
2016-07-13 18:49:02 +01:00
describe("#constructor()", () => {
it("should put value in attribute", () => {
const underline = new u.WaveUnderline();
2019-06-26 02:11:43 +01:00
const tree = new Formatter().format(underline);
expect(tree).to.deep.equal({
"w:u": {
_attr: {
"w:val": "wave",
},
},
});
2016-07-13 18:49:02 +01:00
});
});
});
2016-07-15 18:50:54 +01:00
describe("DashDotDotHeavyUnderline", () => {
2016-07-13 18:49:02 +01:00
describe("#constructor()", () => {
it("should put value in attribute", () => {
const underline = new u.WavyDoubleUnderline();
2019-06-26 02:11:43 +01:00
const tree = new Formatter().format(underline);
expect(tree).to.deep.equal({
"w:u": {
_attr: {
"w:val": "wavyDouble",
},
},
});
2016-07-13 18:49:02 +01:00
});
});
});
2016-07-15 18:50:54 +01:00
describe("DashDotDotHeavyUnderline", () => {
2016-07-13 18:49:02 +01:00
describe("#constructor()", () => {
it("should put value in attribute", () => {
const underline = new u.WavyHeavyUnderline();
2019-06-26 02:11:43 +01:00
const tree = new Formatter().format(underline);
expect(tree).to.deep.equal({
"w:u": {
_attr: {
"w:val": "wavyHeavy",
},
},
});
2016-07-13 18:49:02 +01:00
});
});
});
2016-07-15 18:50:54 +01:00
describe("DashDotDotHeavyUnderline", () => {
2016-07-13 18:49:02 +01:00
describe("#constructor()", () => {
it("should put value in attribute", () => {
const underline = new u.WordsUnderline();
2019-06-26 02:11:43 +01:00
const tree = new Formatter().format(underline);
expect(tree).to.deep.equal({
"w:u": {
_attr: {
"w:val": "words",
},
},
});
2016-07-13 18:49:02 +01:00
});
});
});