Remove invalid 'w:shdCs' element
This commit is contained in:
@ -625,7 +625,6 @@ describe("AbstractNumbering", () => {
|
||||
},
|
||||
expected: [
|
||||
{ "w:shd": { _attr: { "w:val": "pct10", "w:fill": "00FFFF", "w:color": "FF0000" } } },
|
||||
{ "w:shdCs": { _attr: { "w:val": "pct10", "w:fill": "00FFFF", "w:color": "FF0000" } } },
|
||||
],
|
||||
},
|
||||
{
|
||||
@ -636,7 +635,6 @@ describe("AbstractNumbering", () => {
|
||||
},
|
||||
expected: [
|
||||
{ "w:shd": { _attr: { "w:val": "pct10", "w:fill": "00FFFF", "w:color": "FF0000" } } },
|
||||
{ "w:shdCs": { _attr: { "w:val": "pct10", "w:fill": "00FFFF", "w:color": "FF0000" } } },
|
||||
],
|
||||
},
|
||||
{
|
||||
@ -645,10 +643,8 @@ describe("AbstractNumbering", () => {
|
||||
fill: "00FFFF",
|
||||
color: "FF0000",
|
||||
},
|
||||
shadingComplexScript: true,
|
||||
expected: [
|
||||
{ "w:shd": { _attr: { "w:val": "pct10", "w:fill": "00FFFF", "w:color": "FF0000" } } },
|
||||
{ "w:shdCs": { _attr: { "w:val": "pct10", "w:fill": "00FFFF", "w:color": "FF0000" } } },
|
||||
],
|
||||
},
|
||||
{
|
||||
@ -657,7 +653,6 @@ describe("AbstractNumbering", () => {
|
||||
fill: "00FFFF",
|
||||
color: "FF0000",
|
||||
},
|
||||
shadingComplexScript: false,
|
||||
expected: [{ "w:shd": { _attr: { "w:val": "pct10", "w:fill": "00FFFF", "w:color": "FF0000" } } }],
|
||||
},
|
||||
{
|
||||
@ -666,18 +661,12 @@ describe("AbstractNumbering", () => {
|
||||
fill: "00FFFF",
|
||||
color: "FF0000",
|
||||
},
|
||||
shadingComplexScript: {
|
||||
type: ShadingType.PERCENT_10,
|
||||
fill: "00FFFF",
|
||||
color: "00FF00",
|
||||
},
|
||||
expected: [
|
||||
{ "w:shd": { _attr: { "w:val": "pct10", "w:fill": "00FFFF", "w:color": "FF0000" } } },
|
||||
{ "w:shdCs": { _attr: { "w:val": "pct10", "w:fill": "00FFFF", "w:color": "00FF00" } } },
|
||||
],
|
||||
},
|
||||
];
|
||||
shadingTests.forEach(({ shadow, shading, shadingComplexScript, expected }) => {
|
||||
shadingTests.forEach(({ shadow, shading, expected }) => {
|
||||
it("#shadow correctly", () => {
|
||||
const abstractNumbering = new AbstractNumbering(1, [
|
||||
{
|
||||
@ -685,7 +674,7 @@ describe("AbstractNumbering", () => {
|
||||
format: LevelFormat.LOWER_ROMAN,
|
||||
text: "%0.",
|
||||
style: {
|
||||
run: { shadow, shading, shadingComplexScript },
|
||||
run: { shadow, shading },
|
||||
},
|
||||
},
|
||||
]);
|
||||
|
@ -200,15 +200,3 @@ export class Shading extends XmlComponent {
|
||||
}
|
||||
}
|
||||
|
||||
export class ShadowComplexScript extends XmlComponent {
|
||||
constructor(value: string, fill: string, color: string) {
|
||||
super("w:shdCs");
|
||||
this.root.push(
|
||||
new Attributes({
|
||||
val: value,
|
||||
fill: fill,
|
||||
color: color,
|
||||
}),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -16,7 +16,6 @@ import {
|
||||
ItalicsComplexScript,
|
||||
RightToLeft,
|
||||
Shading,
|
||||
ShadowComplexScript,
|
||||
Size,
|
||||
SizeComplexScript,
|
||||
SmallCaps,
|
||||
@ -63,7 +62,6 @@ export interface IRunStylePropertiesOptions {
|
||||
readonly fill: string;
|
||||
readonly color: string;
|
||||
};
|
||||
readonly shadingComplexScript?: boolean | IRunStylePropertiesOptions["shading"];
|
||||
readonly shadow?: IRunStylePropertiesOptions["shading"];
|
||||
readonly emboss?: boolean;
|
||||
readonly imprint?: boolean;
|
||||
@ -185,11 +183,6 @@ export class RunProperties extends IgnoreIfEmptyXmlComponent {
|
||||
if (shading) {
|
||||
this.push(new Shading(shading.type, shading.fill, shading.color));
|
||||
}
|
||||
const shdCs =
|
||||
options.shadingComplexScript === undefined || options.shadingComplexScript === true ? shading : options.shadingComplexScript;
|
||||
if (shdCs) {
|
||||
this.push(new ShadowComplexScript(shdCs.type, shdCs.fill, shdCs.color));
|
||||
}
|
||||
}
|
||||
|
||||
public push(item: XmlComponent): void {
|
||||
|
@ -245,15 +245,6 @@ describe("Run", () => {
|
||||
{
|
||||
"w:rPr": [
|
||||
{ "w:shd": { _attr: { "w:val": "pct10", "w:fill": "00FFFF", "w:color": "FF0000" } } },
|
||||
{
|
||||
"w:shdCs": {
|
||||
_attr: {
|
||||
"w:val": "pct10",
|
||||
"w:fill": "00FFFF",
|
||||
"w:color": "FF0000",
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
|
@ -784,7 +784,6 @@ describe("CharacterStyle", () => {
|
||||
},
|
||||
expected: [
|
||||
{ "w:shd": { _attr: { "w:val": "pct10", "w:fill": "00FFFF", "w:color": "FF0000" } } },
|
||||
{ "w:shdCs": { _attr: { "w:val": "pct10", "w:fill": "00FFFF", "w:color": "FF0000" } } },
|
||||
],
|
||||
},
|
||||
{
|
||||
@ -795,7 +794,6 @@ describe("CharacterStyle", () => {
|
||||
},
|
||||
expected: [
|
||||
{ "w:shd": { _attr: { "w:val": "pct10", "w:fill": "00FFFF", "w:color": "FF0000" } } },
|
||||
{ "w:shdCs": { _attr: { "w:val": "pct10", "w:fill": "00FFFF", "w:color": "FF0000" } } },
|
||||
],
|
||||
},
|
||||
{
|
||||
@ -804,10 +802,8 @@ describe("CharacterStyle", () => {
|
||||
fill: "00FFFF",
|
||||
color: "FF0000",
|
||||
},
|
||||
shadingComplexScript: true,
|
||||
expected: [
|
||||
{ "w:shd": { _attr: { "w:val": "pct10", "w:fill": "00FFFF", "w:color": "FF0000" } } },
|
||||
{ "w:shdCs": { _attr: { "w:val": "pct10", "w:fill": "00FFFF", "w:color": "FF0000" } } },
|
||||
],
|
||||
},
|
||||
{
|
||||
@ -816,7 +812,6 @@ describe("CharacterStyle", () => {
|
||||
fill: "00FFFF",
|
||||
color: "FF0000",
|
||||
},
|
||||
shadingComplexScript: false,
|
||||
expected: [{ "w:shd": { _attr: { "w:val": "pct10", "w:fill": "00FFFF", "w:color": "FF0000" } } }],
|
||||
},
|
||||
{
|
||||
@ -825,22 +820,16 @@ describe("CharacterStyle", () => {
|
||||
fill: "00FFFF",
|
||||
color: "FF0000",
|
||||
},
|
||||
shadingComplexScript: {
|
||||
type: ShadingType.PERCENT_10,
|
||||
fill: "00FFFF",
|
||||
color: "00FF00",
|
||||
},
|
||||
expected: [
|
||||
{ "w:shd": { _attr: { "w:val": "pct10", "w:fill": "00FFFF", "w:color": "FF0000" } } },
|
||||
{ "w:shdCs": { _attr: { "w:val": "pct10", "w:fill": "00FFFF", "w:color": "00FF00" } } },
|
||||
],
|
||||
},
|
||||
];
|
||||
shadingTests.forEach(({ shadow, shading, shadingComplexScript, expected }) => {
|
||||
shadingTests.forEach(({ shadow, shading, expected }) => {
|
||||
it("#shadow correctly", () => {
|
||||
const style = new StyleForCharacter({
|
||||
id: "myStyleId",
|
||||
run: { shadow, shading, shadingComplexScript },
|
||||
run: { shadow, shading },
|
||||
});
|
||||
const tree = new Formatter().format(style);
|
||||
expect(tree).to.deep.equal({
|
||||
|
@ -660,7 +660,6 @@ describe("ParagraphStyle", () => {
|
||||
},
|
||||
expected: [
|
||||
{ "w:shd": { _attr: { "w:val": "pct10", "w:fill": "00FFFF", "w:color": "FF0000" } } },
|
||||
{ "w:shdCs": { _attr: { "w:val": "pct10", "w:fill": "00FFFF", "w:color": "FF0000" } } },
|
||||
],
|
||||
},
|
||||
{
|
||||
@ -671,7 +670,6 @@ describe("ParagraphStyle", () => {
|
||||
},
|
||||
expected: [
|
||||
{ "w:shd": { _attr: { "w:val": "pct10", "w:fill": "00FFFF", "w:color": "FF0000" } } },
|
||||
{ "w:shdCs": { _attr: { "w:val": "pct10", "w:fill": "00FFFF", "w:color": "FF0000" } } },
|
||||
],
|
||||
},
|
||||
{
|
||||
@ -680,10 +678,8 @@ describe("ParagraphStyle", () => {
|
||||
fill: "00FFFF",
|
||||
color: "FF0000",
|
||||
},
|
||||
shadingComplexScript: true,
|
||||
expected: [
|
||||
{ "w:shd": { _attr: { "w:val": "pct10", "w:fill": "00FFFF", "w:color": "FF0000" } } },
|
||||
{ "w:shdCs": { _attr: { "w:val": "pct10", "w:fill": "00FFFF", "w:color": "FF0000" } } },
|
||||
],
|
||||
},
|
||||
{
|
||||
@ -692,7 +688,6 @@ describe("ParagraphStyle", () => {
|
||||
fill: "00FFFF",
|
||||
color: "FF0000",
|
||||
},
|
||||
shadingComplexScript: false,
|
||||
expected: [{ "w:shd": { _attr: { "w:val": "pct10", "w:fill": "00FFFF", "w:color": "FF0000" } } }],
|
||||
},
|
||||
{
|
||||
@ -701,22 +696,16 @@ describe("ParagraphStyle", () => {
|
||||
fill: "00FFFF",
|
||||
color: "FF0000",
|
||||
},
|
||||
shadingComplexScript: {
|
||||
type: ShadingType.PERCENT_10,
|
||||
fill: "00FFFF",
|
||||
color: "00FF00",
|
||||
},
|
||||
expected: [
|
||||
{ "w:shd": { _attr: { "w:val": "pct10", "w:fill": "00FFFF", "w:color": "FF0000" } } },
|
||||
{ "w:shdCs": { _attr: { "w:val": "pct10", "w:fill": "00FFFF", "w:color": "00FF00" } } },
|
||||
],
|
||||
},
|
||||
];
|
||||
shadingTests.forEach(({ shadow, shading, shadingComplexScript, expected }) => {
|
||||
shadingTests.forEach(({ shadow, shading, expected }) => {
|
||||
it("#shadow correctly", () => {
|
||||
const style = new StyleForParagraph({
|
||||
id: "myStyleId",
|
||||
run: { shadow, shading, shadingComplexScript },
|
||||
run: { shadow, shading },
|
||||
});
|
||||
const tree = new Formatter().format(style);
|
||||
expect(tree).to.deep.equal({
|
||||
|
Reference in New Issue
Block a user