change shading val -> type

This commit is contained in:
Tom Hunkapiller
2021-05-29 05:51:06 +03:00
parent 730e33b164
commit 034cd187ab
14 changed files with 24 additions and 24 deletions

View File

@ -619,7 +619,7 @@ describe("AbstractNumbering", () => {
const shadingTests = [
{
shading: {
val: ShadingType.DIAGONAL_STRIPE,
type: ShadingType.DIAGONAL_STRIPE,
fill: "006622",
color: "0000FF",
},
@ -627,7 +627,7 @@ describe("AbstractNumbering", () => {
},
{
shading: {
val: ShadingType.PERCENT_10,
type: ShadingType.PERCENT_10,
fill: "00FFFF",
color: "FF0000",
},

View File

@ -850,7 +850,7 @@ describe("Paragraph", () => {
it("should set shading to the given value", () => {
const paragraph = new Paragraph({
shading: {
val: ShadingType.REVERSE_DIAGONAL_STRIPE,
type: ShadingType.REVERSE_DIAGONAL_STRIPE,
color: "00FFFF",
fill: "FF0000",
},

View File

@ -226,7 +226,7 @@ describe("Run", () => {
it("it should add shadow to the properties", () => {
const run = new Run({
shading: {
val: ShadingType.PERCENT_10,
type: ShadingType.PERCENT_10,
fill: "00FFFF",
color: "FF0000",
},

View File

@ -17,7 +17,7 @@ describe("Shading", () => {
});
it("should create with params", () => {
const shading = new Shading({ val: ShadingType.PERCENT_40, color: "FF0000", fill: "555555" });
const shading = new Shading({ type: ShadingType.PERCENT_40, color: "FF0000", fill: "555555" });
const tree = new Formatter().format(shading);
expect(tree).to.deep.equal({
"w:shd": {

View File

@ -23,25 +23,25 @@ import { hexColorValue } from "../values";
export interface IShadingAttributesProperties {
readonly fill?: string;
readonly color?: string;
readonly val?: ShadingType;
readonly type?: ShadingType;
}
class ShadingAttributes extends XmlAttributeComponent<IShadingAttributesProperties> {
protected readonly xmlKeys = {
fill: "w:fill",
color: "w:color",
val: "w:val",
type: "w:val",
};
}
export class Shading extends XmlComponent {
constructor({ fill, color, val }: IShadingAttributesProperties) {
constructor({ fill, color, type }: IShadingAttributesProperties) {
super("w:shd");
this.root.push(
new ShadingAttributes({
fill: fill === undefined ? undefined : hexColorValue(fill),
color: color === undefined ? undefined : hexColorValue(color),
val,
type,
}),
);
}

View File

@ -778,7 +778,7 @@ describe("CharacterStyle", () => {
const shadingTests = [
{
shading: {
val: ShadingType.PERCENT_10,
type: ShadingType.PERCENT_10,
fill: "00FFFF",
color: "FF0000",
},
@ -786,7 +786,7 @@ describe("CharacterStyle", () => {
},
{
shading: {
val: ShadingType.SOLID,
type: ShadingType.SOLID,
fill: "AA0000",
color: "DD0000",
},

View File

@ -650,7 +650,7 @@ describe("ParagraphStyle", () => {
const shadingTests = [
{
shading: {
val: ShadingType.PERCENT_10,
type: ShadingType.PERCENT_10,
fill: "00FFFF",
color: "FF0000",
},
@ -658,7 +658,7 @@ describe("ParagraphStyle", () => {
},
{
shading: {
val: ShadingType.DIAGONAL_CROSS,
type: ShadingType.DIAGONAL_CROSS,
fill: "0066FF",
color: "0000FF",
},

View File

@ -435,7 +435,7 @@ describe("TableCell", () => {
shading: {
fill: "FF0000",
color: "0000ff",
val: ShadingType.PERCENT_10,
type: ShadingType.PERCENT_10,
},
});

View File

@ -129,7 +129,7 @@ describe("TableProperties", () => {
const tp = new TableProperties({
shading: {
fill: "b79c2f",
val: ShadingType.REVERSE_DIAGONAL_STRIPE,
type: ShadingType.REVERSE_DIAGONAL_STRIPE,
color: "auto",
},
});