2016-03-29 04:10:33 +01:00
|
|
|
/// <reference path="../typings/mocha/mocha.d.ts" />
|
|
|
|
/// <reference path="../typings/chai/chai.d.ts" />
|
2016-03-29 04:50:23 +01:00
|
|
|
import {Attributes} from "../docx/xml-components";
|
2016-03-29 04:10:33 +01:00
|
|
|
import {assert} from "chai";
|
|
|
|
|
|
|
|
describe('Attribute', () => {
|
|
|
|
var attributes: Attributes;
|
|
|
|
|
|
|
|
beforeEach(() => {
|
|
|
|
attributes = new Attributes();
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('#constructor()', () => {
|
|
|
|
|
|
|
|
it("should not add val with empty constructor", () => {
|
|
|
|
var newAttrs = new Attributes();
|
|
|
|
var stringifiedJson = JSON.stringify(newAttrs);
|
|
|
|
var newJson = JSON.parse(stringifiedJson);
|
|
|
|
assert.isUndefined(newJson._attrs.val);
|
|
|
|
});
|
|
|
|
|
|
|
|
it("should have val as defined with populated constructor", () => {
|
2016-03-29 04:50:23 +01:00
|
|
|
var newAttrs = new Attributes({
|
|
|
|
val: "test"
|
|
|
|
});
|
2016-03-29 04:10:33 +01:00
|
|
|
var stringifiedJson = JSON.stringify(newAttrs);
|
|
|
|
var newJson = JSON.parse(stringifiedJson);
|
|
|
|
assert(newJson._attrs.val === "test");
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|