feat: Support \phase (#2406)

* Support \phase

* Update screenshots

* Update documentation

* Add a11y test

* Edit MathML notation to phasorangle

* Move code to enclose.js

Co-authored-by: Kevin Barabash <kevinb@khanacademy.org>
This commit is contained in:
Ron Kok
2020-08-12 21:08:36 -07:00
committed by GitHub
parent 26e0a05221
commit 42cc5e507e
11 changed files with 73 additions and 7 deletions

View File

@@ -534,6 +534,13 @@ const handleObject = (
regionStrings.push("end strikeout");
});
break;
} else if (/phase/.test(tree.label)) {
buildRegion(a11yStrings, function(regionStrings) {
regionStrings.push("start phase angle");
buildA11yStrings(tree.body, regionStrings, atomType);
regionStrings.push("end phase angle");
});
break;
}
throw new Error(
`KaTeX-a11y: enclose node with ${tree.label} not supported yet`);

View File

@@ -151,6 +151,15 @@ describe("renderA11yString", () => {
});
});
describe("phase", () => {
test("\\phase", () => {
const result = renderA11yString("\\phase{a}");
expect(result).toMatchInlineSnapshot(
`"start phase angle, a, end phase angle"`,
);
});
});
describe("exponents", () => {
test("simple exponent", () => {
const result = renderA11yString("e^x");