leqno and fleqn support (#1814)

* leqno support

* Add fleqn support

* Add tests

* Lint fix

* Add leqno and fleqn to website demo
This commit is contained in:
Erik Demaine
2019-01-29 04:40:17 -05:00
committed by ylemkimon
parent 58c36c6fdf
commit 7f778d1543
9 changed files with 82 additions and 12 deletions

View File

@@ -3174,6 +3174,29 @@ describe("\\tag support", function() {
});
});
describe("leqno and fleqn rendering options", () => {
const expr = r`\tag{hi}x+y`;
for (const opt of ["leqno", "fleqn"]) {
it(`should not add ${opt} class by default`, () => {
const settings = new Settings({displayMode: true});
const built = katex.__renderToDomTree(expr, settings);
expect(built.classes).not.toContain(opt);
});
it(`should not add ${opt} class when false`, () => {
const settings = new Settings({displayMode: true});
settings[opt] = false;
const built = katex.__renderToDomTree(expr, settings);
expect(built.classes).not.toContain(opt);
});
it(`should add ${opt} class when true`, () => {
const settings = new Settings({displayMode: true});
settings[opt] = true;
const built = katex.__renderToDomTree(expr, settings);
expect(built.classes).toContain(opt);
});
}
});
describe("\\@binrel automatic bin/rel/ord", () => {
it("should generate proper class", () => {
expect("L\\@binrel+xR").toParseLike("L\\mathbin xR");