2017-03-08 19:48:32 +01:00
|
|
|
import { expect } from "chai";
|
2017-09-17 00:00:41 +01:00
|
|
|
|
2018-10-26 01:04:07 +01:00
|
|
|
import { Formatter } from "export/formatter";
|
|
|
|
|
2017-09-17 00:00:41 +01:00
|
|
|
import { RunFonts } from "./run-fonts";
|
2017-03-08 19:48:32 +01:00
|
|
|
|
|
|
|
describe("RunFonts", () => {
|
|
|
|
describe("#constructor()", () => {
|
|
|
|
it("uses the font name for both ascii and hAnsi", () => {
|
|
|
|
const tree = new Formatter().format(new RunFonts("Times"));
|
|
|
|
expect(tree).to.deep.equal({
|
2019-04-09 05:27:18 -04:00
|
|
|
"w:rFonts": { _attr: { "w:ascii": "Times", "w:cs": "Times", "w:eastAsia": "Times", "w:hAnsi": "Times" } },
|
2017-03-08 19:48:32 +01:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it("uses hint if given", () => {
|
|
|
|
const tree = new Formatter().format(new RunFonts("Times", "default"));
|
|
|
|
expect(tree).to.deep.equal({
|
2019-04-09 05:27:18 -04:00
|
|
|
"w:rFonts": {
|
|
|
|
_attr: { "w:ascii": "Times", "w:cs": "Times", "w:eastAsia": "Times", "w:hAnsi": "Times", "w:hint": "default" },
|
|
|
|
},
|
2017-03-08 19:48:32 +01:00
|
|
|
});
|
|
|
|
});
|
2020-06-07 12:38:31 +08:00
|
|
|
|
|
|
|
it("uses the font attrs for ascii and eastAsia", () => {
|
|
|
|
const tree = new Formatter().format(new RunFonts({ ascii: "Times", eastAsia: "KaiTi" }));
|
|
|
|
expect(tree).to.deep.equal({
|
|
|
|
"w:rFonts": { _attr: { "w:ascii": "Times", "w:eastAsia": "KaiTi" } },
|
|
|
|
});
|
|
|
|
});
|
2017-03-08 19:48:32 +01:00
|
|
|
});
|
|
|
|
});
|