-
-
Notifications
You must be signed in to change notification settings - Fork 477
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
210 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { describe, expect, it } from "vitest"; | ||
|
||
import { Formatter } from "@export/formatter"; | ||
|
||
import { MathRun } from "../math-run"; | ||
import { MathLimitLower } from "./math-limit-lower"; | ||
|
||
describe("MathLimitLower", () => { | ||
describe("#constructor()", () => { | ||
it("should create a MathLimitLower with correct root key", () => { | ||
const mathLimitLower = new MathLimitLower({ | ||
children: [new MathRun("lim")], | ||
limit: [new MathRun("x→0")], | ||
}); | ||
|
||
const tree = new Formatter().format(mathLimitLower); | ||
expect(tree).to.deep.equal({ | ||
"m:limLow": [ | ||
{ | ||
"m:e": [ | ||
{ | ||
"m:r": [ | ||
{ | ||
"m:t": ["lim"], | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
{ | ||
"m:lim": [ | ||
{ | ||
"m:r": [ | ||
{ | ||
"m:t": ["x→0"], | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
], | ||
}); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// http://www.datypic.com/sc/ooxml/e-m_limLow-1.html | ||
import { XmlComponent } from "@file/xml-components"; | ||
import { MathComponent } from "../math-component"; | ||
import { MathBase } from "./math-base"; | ||
import { MathLimit } from "./math-limit"; | ||
|
||
export interface IMathLimitLowerOptions { | ||
readonly children: readonly MathComponent[]; | ||
readonly limit: readonly MathComponent[]; | ||
} | ||
|
||
export class MathLimitLower extends XmlComponent { | ||
public constructor(options: IMathLimitLowerOptions) { | ||
super("m:limLow"); | ||
|
||
this.root.push(new MathBase(options.children)); | ||
this.root.push(new MathLimit(options.limit)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { describe, expect, it } from "vitest"; | ||
|
||
import { Formatter } from "@export/formatter"; | ||
|
||
import { MathRun } from "../math-run"; | ||
import { MathLimitUpper } from "./math-limit-upper"; | ||
|
||
describe("MathLimitUpper", () => { | ||
describe("#constructor()", () => { | ||
it("should create a MathLimitUpper with correct root key", () => { | ||
const mathLimitUpper = new MathLimitUpper({ | ||
children: [new MathRun("x")], | ||
limit: [new MathRun("-")], | ||
}); | ||
|
||
const tree = new Formatter().format(mathLimitUpper); | ||
expect(tree).to.deep.equal({ | ||
"m:limUpp": [ | ||
{ | ||
"m:e": [ | ||
{ | ||
"m:r": [ | ||
{ | ||
"m:t": ["x"], | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
{ | ||
"m:lim": [ | ||
{ | ||
"m:r": [ | ||
{ | ||
"m:t": ["-"], | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
], | ||
}); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// http://www.datypic.com/sc/ooxml/e-m_limUpp-1.html | ||
import { XmlComponent } from "@file/xml-components"; | ||
import { MathComponent } from "../math-component"; | ||
import { MathBase } from "./math-base"; | ||
import { MathLimit } from "./math-limit"; | ||
|
||
export interface IMathLimitUpperOptions { | ||
readonly children: readonly MathComponent[]; | ||
readonly limit: readonly MathComponent[]; | ||
} | ||
|
||
export class MathLimitUpper extends XmlComponent { | ||
public constructor(options: IMathLimitUpperOptions) { | ||
super("m:limUpp"); | ||
|
||
this.root.push(new MathBase(options.children)); | ||
this.root.push(new MathLimit(options.limit)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { describe, expect, it } from "vitest"; | ||
|
||
import { Formatter } from "@export/formatter"; | ||
|
||
import { MathRun } from "../math-run"; | ||
import { MathLimit } from "./math-limit"; | ||
|
||
describe("MathLimit", () => { | ||
describe("#constructor()", () => { | ||
it("should create a MathLimit with correct root key", () => { | ||
const mathLimit = new MathLimit([new MathRun("x→0")]); | ||
|
||
const tree = new Formatter().format(mathLimit); | ||
expect(tree).to.deep.equal({ | ||
"m:lim": [ | ||
{ | ||
"m:r": [ | ||
{ | ||
"m:t": ["x→0"], | ||
}, | ||
], | ||
}, | ||
], | ||
}); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// http://www.datypic.com/sc/ooxml/e-m_lim-1.html | ||
import { XmlComponent } from "@file/xml-components"; | ||
import { MathComponent } from "../math-component"; | ||
|
||
export class MathLimit extends XmlComponent { | ||
public constructor(children: readonly MathComponent[]) { | ||
super("m:lim"); | ||
|
||
for (const child of children) { | ||
this.root.push(child); | ||
} | ||
} | ||
} |