2017-03-07 22:15:53 +00:00
|
|
|
import { assert } from "chai";
|
2017-09-17 00:00:41 +01:00
|
|
|
|
|
|
|
import { Utility } from "../../tests/utility";
|
|
|
|
import { SubScript, SuperScript } from "./script";
|
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
|
|
|
});
|