Files
docx-js/ts/tests/docx/run/scriptTests.ts

50 lines
1.5 KiB
TypeScript
Raw Normal View History

import { assert } from "chai";
2017-03-09 22:56:08 +00:00
import { SubScript, SuperScript } from "../../../docx/run/script";
import { Utility } from "../../utility";
2016-07-18 19:17:19 +01:00
describe("SubScript", () => {
let subScript: SubScript;
beforeEach(() => {
subScript = new SubScript();
});
describe("#constructor()", () => {
it("should create a Sub Script with correct attributes", () => {
2017-03-09 22:56:08 +00:00
const newJson = Utility.jsonify(subScript);
const attributes = {
val: "subscript",
2016-07-18 19:17:19 +01:00
};
assert.equal(JSON.stringify(newJson.root[0].root), JSON.stringify(attributes));
});
it("should create a Sub Script with correct root key", () => {
2017-03-09 22:56:08 +00:00
const newJson = Utility.jsonify(subScript);
2016-07-18 19:17:19 +01:00
assert.equal(newJson.rootKey, "w:vertAlign");
});
});
});
describe("SuperScript", () => {
let superScript: SuperScript;
beforeEach(() => {
superScript = new SuperScript();
});
describe("#constructor()", () => {
it("should create a Super Script with correct attributes", () => {
2017-03-09 22:56:08 +00:00
const newJson = Utility.jsonify(superScript);
const attributes = {
val: "superscript",
2016-07-18 19:17:19 +01:00
};
assert.equal(JSON.stringify(newJson.root[0].root), JSON.stringify(attributes));
});
it("should create a Super Script with correct root key", () => {
2017-03-09 22:56:08 +00:00
const newJson = Utility.jsonify(superScript);
2016-07-18 19:17:19 +01:00
assert.equal(newJson.rootKey, "w:vertAlign");
});
});
2017-03-09 22:56:08 +00:00
});