2023-06-05 00:33:43 +01:00
|
|
|
import { describe, expect, it } from "vitest";
|
2019-08-20 20:40:40 +01:00
|
|
|
|
2022-06-26 23:26:42 +01:00
|
|
|
import { Formatter } from "@export/formatter";
|
2019-08-20 20:40:40 +01:00
|
|
|
|
2022-07-05 05:06:32 +01:00
|
|
|
import { MathNAryProperties } from "./math-n-ary-properties";
|
2019-08-20 20:40:40 +01:00
|
|
|
|
2022-07-05 05:06:32 +01:00
|
|
|
describe("MathNAryProperties", () => {
|
2019-08-20 20:40:40 +01:00
|
|
|
describe("#constructor()", () => {
|
2022-07-05 05:06:32 +01:00
|
|
|
it("should create a MathNAryProperties with correct root key", () => {
|
|
|
|
const mathNAryProperties = new MathNAryProperties("∑", true, true);
|
2019-08-20 20:40:40 +01:00
|
|
|
|
2022-07-05 05:06:32 +01:00
|
|
|
const tree = new Formatter().format(mathNAryProperties);
|
2019-08-20 20:40:40 +01:00
|
|
|
expect(tree).to.deep.equal({
|
|
|
|
"m:naryPr": [
|
|
|
|
{
|
|
|
|
"m:chr": {
|
|
|
|
_attr: {
|
|
|
|
"m:val": "∑",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"m:limLoc": {
|
|
|
|
_attr: {
|
|
|
|
"m:val": "undOvr",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
});
|
|
|
|
});
|
2020-10-10 13:41:26 +01:00
|
|
|
|
|
|
|
it("should add super-script hide attributes", () => {
|
2022-07-05 05:06:32 +01:00
|
|
|
const mathNAryProperties = new MathNAryProperties("∑", false, true);
|
2020-10-10 13:41:26 +01:00
|
|
|
|
2022-07-05 05:06:32 +01:00
|
|
|
const tree = new Formatter().format(mathNAryProperties);
|
2020-10-10 13:41:26 +01:00
|
|
|
expect(tree).to.deep.equal({
|
|
|
|
"m:naryPr": [
|
|
|
|
{
|
|
|
|
"m:chr": {
|
|
|
|
_attr: {
|
|
|
|
"m:val": "∑",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"m:limLoc": {
|
|
|
|
_attr: {
|
|
|
|
"m:val": "undOvr",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"m:supHide": {
|
|
|
|
_attr: {
|
|
|
|
"m:val": 1,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it("should add sub-script hide attributes", () => {
|
2022-07-05 05:06:32 +01:00
|
|
|
const mathNAryProperties = new MathNAryProperties("∑", true, false);
|
2020-10-10 13:41:26 +01:00
|
|
|
|
2022-07-05 05:06:32 +01:00
|
|
|
const tree = new Formatter().format(mathNAryProperties);
|
2020-10-10 13:41:26 +01:00
|
|
|
expect(tree).to.deep.equal({
|
|
|
|
"m:naryPr": [
|
|
|
|
{
|
|
|
|
"m:chr": {
|
|
|
|
_attr: {
|
|
|
|
"m:val": "∑",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"m:limLoc": {
|
|
|
|
_attr: {
|
|
|
|
"m:val": "undOvr",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"m:subHide": {
|
|
|
|
_attr: {
|
|
|
|
"m:val": 1,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it("should add both super-script and sub-script hide attributes", () => {
|
2022-07-05 05:06:32 +01:00
|
|
|
const mathNAryProperties = new MathNAryProperties("∑", false, false);
|
2020-10-10 13:41:26 +01:00
|
|
|
|
2022-07-05 05:06:32 +01:00
|
|
|
const tree = new Formatter().format(mathNAryProperties);
|
2020-10-10 13:41:26 +01:00
|
|
|
expect(tree).to.deep.equal({
|
|
|
|
"m:naryPr": [
|
|
|
|
{
|
|
|
|
"m:chr": {
|
|
|
|
_attr: {
|
|
|
|
"m:val": "∑",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"m:limLoc": {
|
|
|
|
_attr: {
|
|
|
|
"m:val": "undOvr",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"m:supHide": {
|
|
|
|
_attr: {
|
|
|
|
"m:val": 1,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"m:subHide": {
|
|
|
|
_attr: {
|
|
|
|
"m:val": 1,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
});
|
|
|
|
});
|
2019-08-20 20:40:40 +01:00
|
|
|
});
|
|
|
|
});
|