make XmlAttributeComponent into a generic class
This change brings increased type safety to uses of XmlAttributeComponent. Now the compiler is checkign for us that the properties that get passed in to every subclass match the intended interface, and also that the xmlKeys property -> xml attribute mapping has all the right keys
This commit is contained in:
@ -2,21 +2,8 @@ import { assert } from "chai";
|
||||
import { Attributes } from "../../../docx/xml-components";
|
||||
|
||||
describe("Attribute", () => {
|
||||
let attributes: Attributes;
|
||||
|
||||
beforeEach(() => {
|
||||
attributes = new Attributes();
|
||||
});
|
||||
|
||||
describe("#constructor()", () => {
|
||||
|
||||
it("should not add val with empty constructor", () => {
|
||||
const newAttrs = new Attributes();
|
||||
const stringifiedJson = JSON.stringify(newAttrs);
|
||||
const newJson = JSON.parse(stringifiedJson);
|
||||
assert.isUndefined(newJson.root.val);
|
||||
});
|
||||
|
||||
it("should have val as defined with populated constructor", () => {
|
||||
const newAttrs = new Attributes({
|
||||
val: "test",
|
||||
|
Reference in New Issue
Block a user