Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Locked Figures Aria] Update the auto-generated text to spell out commas #1976

Merged
merged 1 commit into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/seven-planets-matter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@khanacademy/perseus-editor": patch
---

[Locked Figures Aria] Update the auto-generated text to spell out commas
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ describe("LockedEllipseSettings", () => {
// Assert
expect(onChangeProps).toHaveBeenCalledWith({
ariaLabel:
"Circle with radius 2, centered at (0, 0). Appearance solid gray border, with no fill.",
"Circle with radius 2, centered at 0 comma 0. Appearance solid gray border, with no fill.",
});
});

Expand Down Expand Up @@ -421,7 +421,7 @@ describe("LockedEllipseSettings", () => {
// Assert
expect(onChangeProps).toHaveBeenCalledWith({
ariaLabel:
"Circle with radius 2, centered at (0, 0). Appearance solid gray border, with no fill.",
"Circle with radius 2, centered at 0 comma 0. Appearance solid gray border, with no fill.",
});
});

Expand All @@ -448,7 +448,7 @@ describe("LockedEllipseSettings", () => {
// Assert
expect(onChangeProps).toHaveBeenCalledWith({
ariaLabel:
"Ellipse with x radius 2 and y radius 3, centered at (0, 0). Appearance solid gray border, with no fill.",
"Ellipse with x radius 2 and y radius 3, centered at 0 comma 0. Appearance solid gray border, with no fill.",
});
});

Expand Down Expand Up @@ -476,7 +476,7 @@ describe("LockedEllipseSettings", () => {
// Assert
expect(onChangeProps).toHaveBeenCalledWith({
ariaLabel:
"Ellipse with x radius 2 and y radius 3, centered at (0, 0), rotated by 90 degrees. Appearance solid gray border, with no fill.",
"Ellipse with x radius 2 and y radius 3, centered at 0 comma 0, rotated by 90 degrees. Appearance solid gray border, with no fill.",
});
});

Expand Down Expand Up @@ -508,7 +508,7 @@ describe("LockedEllipseSettings", () => {
// Assert
expect(onChangeProps).toHaveBeenCalledWith({
ariaLabel:
"Circle spoken A with radius 2, centered at (0, 0). Appearance solid gray border, with no fill.",
"Circle spoken A with radius 2, centered at 0 comma 0. Appearance solid gray border, with no fill.",
});
});

Expand Down Expand Up @@ -544,7 +544,7 @@ describe("LockedEllipseSettings", () => {
// Assert
expect(onChangeProps).toHaveBeenCalledWith({
ariaLabel:
"Circle spoken A, spoken B with radius 2, centered at (0, 0). Appearance solid gray border, with no fill.",
"Circle spoken A, spoken B with radius 2, centered at 0 comma 0. Appearance solid gray border, with no fill.",
});
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ const LockedEllipseSettings = (props: Props) => {
str += `Ellipse${visiblelabel} with x radius ${radius[0]} and y radius ${radius[1]}`;
}

str += `, centered at (${center[0]}, ${center[1]})`;
str += `, centered at ${center[0]} comma ${center[1]}`;

if (!isCircle && angle !== 0) {
str += `, rotated by ${radianToDegree(angle)} degrees`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -625,7 +625,7 @@ describe("LockedLineSettings", () => {
// Assert
expect(onChangeProps).toHaveBeenCalledWith({
ariaLabel:
"Segment from point at (0, 0) to point at (2, 2). Appearance solid gray.",
"Segment from point at 0 comma 0 to point at 2 comma 2. Appearance solid gray.",
});
});

Expand All @@ -651,7 +651,7 @@ describe("LockedLineSettings", () => {
// Assert
expect(onChangeProps).toHaveBeenCalledWith({
ariaLabel:
"Line from point at (0, 0) to point at (2, 2). Appearance solid gray.",
"Line from point at 0 comma 0 to point at 2 comma 2. Appearance solid gray.",
});
});

Expand Down Expand Up @@ -682,7 +682,7 @@ describe("LockedLineSettings", () => {
// Assert
expect(onChangeProps).toHaveBeenCalledWith({
ariaLabel:
"Line spoken A from point at (0, 0) to point at (2, 2). Appearance solid gray.",
"Line spoken A from point at 0 comma 0 to point at 2 comma 2. Appearance solid gray.",
});
});

Expand Down Expand Up @@ -717,7 +717,7 @@ describe("LockedLineSettings", () => {
// Assert
expect(onChangeProps).toHaveBeenCalledWith({
ariaLabel:
"Line spoken A, spoken B from point at (0, 0) to point at (2, 2). Appearance solid gray.",
"Line spoken A, spoken B from point at 0 comma 0 to point at 2 comma 2. Appearance solid gray.",
});
});

Expand Down Expand Up @@ -758,7 +758,7 @@ describe("LockedLineSettings", () => {
// Assert
expect(onChangeProps).toHaveBeenCalledWith({
ariaLabel:
"Line spoken A from point spoken C at (0, 0) to point spoken D at (2, 2). Appearance solid gray.",
"Line spoken A from point spoken C at 0 comma 0 to point spoken D at 2 comma 2. Appearance solid gray.",
});
});

Expand Down Expand Up @@ -809,7 +809,7 @@ describe("LockedLineSettings", () => {
// Assert
expect(onChangeProps).toHaveBeenCalledWith({
ariaLabel:
"Line spoken A, spoken B from point spoken C, spoken C2 at (0, 0) to point spoken D, spoken D2 at (2, 2). Appearance solid gray.",
"Line spoken A, spoken B from point spoken C, spoken C2 at 0 comma 0 to point spoken D, spoken D2 at 2 comma 2. Appearance solid gray.",
});
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ const LockedLineSettings = (props: Props) => {
const point1VisibleLabel = await joinLabelsAsSpokenMath(point1.labels);
const point2VisibleLabel = await joinLabelsAsSpokenMath(point2.labels);

let str = `${capitalizeKind}${visiblelabel} from point${point1VisibleLabel} at (${point1.coord[0]}, ${point1.coord[1]}) to point${point2VisibleLabel} at (${point2.coord[0]}, ${point2.coord[1]})`;
let str = `${capitalizeKind}${visiblelabel} from point${point1VisibleLabel} at ${point1.coord[0]} comma ${point1.coord[1]} to point${point2VisibleLabel} at ${point2.coord[0]} comma ${point2.coord[1]}`;

const lineAppearance = generateLockedFigureAppearanceDescription(
lineColor,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ describe("LockedPointSettings", () => {
// generateSpokenMathDetails is mocked to return the input string
// with "Spoken math details for " prepended.
expect(onChangeProps).toHaveBeenCalledWith({
ariaLabel: "Point at (0, 0). Appearance solid gray.",
ariaLabel: "Point at 0 comma 0. Appearance solid gray.",
});
});

Expand Down Expand Up @@ -454,7 +454,7 @@ describe("LockedPointSettings", () => {
// generateSpokenMathDetails is mocked to return the input string
// with "Spoken math details for " prepended.
expect(onChangeProps).toHaveBeenCalledWith({
ariaLabel: "Point spoken A at (0, 0). Appearance solid gray.",
ariaLabel: "Point spoken A at 0 comma 0. Appearance solid gray.",
});
});

Expand Down Expand Up @@ -491,7 +491,7 @@ describe("LockedPointSettings", () => {
// with "Spoken math details for " prepended.
expect(onChangeProps).toHaveBeenCalledWith({
ariaLabel:
"Point spoken A, spoken B at (0, 0). Appearance solid gray.",
"Point spoken A, spoken B at 0 comma 0. Appearance solid gray.",
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ const LockedPointSettings = (props: Props) => {
async function getPrepopulatedAriaLabel() {
const visiblelabel = await joinLabelsAsSpokenMath(labels);

let str = `Point${visiblelabel} at (${coord[0]}, ${coord[1]})`;
let str = `Point${visiblelabel} at ${coord[0]} comma ${coord[1]}`;

const pointAppearance =
generateLockedFigureAppearanceDescription(pointColor);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,7 @@ describe("LockedPolygonSettings", () => {
// Assert
expect(onChangeProps).toHaveBeenCalledWith({
ariaLabel:
"Polygon with 3 sides, vertices at (0, 0), (0, 1), (1, 1). Appearance solid gray border, with no fill.",
"Polygon with 3 sides, vertices at 0 comma 0, 0 comma 1, 1 comma 1. Appearance solid gray border, with no fill.",
});
});

Expand Down Expand Up @@ -644,7 +644,7 @@ describe("LockedPolygonSettings", () => {
// Assert
expect(onChangeProps).toHaveBeenCalledWith({
ariaLabel:
"Polygon spoken A with 3 sides, vertices at (0, 0), (0, 1), (1, 1). Appearance solid gray border, with no fill.",
"Polygon spoken A with 3 sides, vertices at 0 comma 0, 0 comma 1, 1 comma 1. Appearance solid gray border, with no fill.",
});
});

Expand Down Expand Up @@ -684,7 +684,7 @@ describe("LockedPolygonSettings", () => {
// Assert
expect(onChangeProps).toHaveBeenCalledWith({
ariaLabel:
"Polygon spoken A, spoken B with 3 sides, vertices at (0, 0), (0, 1), (1, 1). Appearance solid gray border, with no fill.",
"Polygon spoken A, spoken B with 3 sides, vertices at 0 comma 0, 0 comma 1, 1 comma 1. Appearance solid gray border, with no fill.",
});
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ const LockedPolygonSettings = (props: Props) => {
let str = `Polygon${visiblelabel} with ${points.length} sides, vertices at `;

// Add the coordinates of each point to the aria label
str += points.map(([x, y]) => `(${x}, ${y})`).join(", ");
str += points.map(([x, y]) => `${x} comma ${y}`).join(", ");

const polygonAppearance = generateLockedFigureAppearanceDescription(
color,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ describe("Locked Vector Settings", () => {
// Assert
expect(onChangeProps).toHaveBeenCalledWith({
ariaLabel:
"Vector from (0, 0) to (2, 2). Appearance solid gray.",
"Vector from 0 comma 0 to 2 comma 2. Appearance solid gray.",
});
});

Expand Down Expand Up @@ -472,7 +472,7 @@ describe("Locked Vector Settings", () => {
// Assert
expect(onChangeProps).toHaveBeenCalledWith({
ariaLabel:
"Vector spoken A from (0, 0) to (2, 2). Appearance solid gray.",
"Vector spoken A from 0 comma 0 to 2 comma 2. Appearance solid gray.",
});
});

Expand Down Expand Up @@ -507,7 +507,7 @@ describe("Locked Vector Settings", () => {
// Assert
expect(onChangeProps).toHaveBeenCalledWith({
ariaLabel:
"Vector spoken A, spoken B from (0, 0) to (2, 2). Appearance solid gray.",
"Vector spoken A, spoken B from 0 comma 0 to 2 comma 2. Appearance solid gray.",
});
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ const LockedVectorSettings = (props: Props) => {
async function getPrepopulatedAriaLabel() {
const visiblelabel = await joinLabelsAsSpokenMath(labels);

let str = `Vector${visiblelabel} from (${tail[0]}, ${tail[1]}) to (${tip[0]}, ${tip[1]})`;
let str = `Vector${visiblelabel} from ${tail[0]} comma ${tail[1]} to ${tip[0]} comma ${tip[1]}`;

const vectorAppearance =
generateLockedFigureAppearanceDescription(lineColor);
Expand Down
Loading