mirror of
https://github.com/Smaug123/KaTeX
synced 2025-10-05 19:28:39 +00:00
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:
@@ -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`);
|
||||
|
@@ -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");
|
||||
|
Reference in New Issue
Block a user