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 Figure Labels] Add color select to locked figure labels settings #1693

Merged
merged 17 commits into from
Sep 30, 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
6 changes: 6 additions & 0 deletions .changeset/purple-numbers-cover.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@khanacademy/perseus": patch
"@khanacademy/perseus-editor": patch
---

[Locked Figure Labels] Add color select to locked figure labels settings
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ describe("LockedEllipseSettings", () => {
);

// Act
const colorSelect = screen.getByLabelText("color");
const colorSelect = screen.getAllByLabelText("color")[0];
await userEvent.click(colorSelect);
const colorOption = screen.getByText("pink");
await userEvent.click(colorOption);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ describe("Locked Function Settings", () => {
);

// Act
const colorSelect = screen.getByLabelText("color");
const colorSelect = screen.getAllByLabelText("color")[0];
await userEvent.click(colorSelect);
const colorOption = screen.getByText("pink");
await userEvent.click(colorOption);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,6 @@ describe("Locked Label Settings", () => {
expect(titleText).toBeInTheDocument();
});

test("does not show color select when rendered within a locked figure (no onMove)", () => {
// Arrange
render(<LockedLabelSettings {...defaultProps} onMove={undefined} />, {
wrapper: RenderStateRoot,
});

// Act
const colorSwitch = screen.queryByLabelText("color");

// Assert
expect(colorSwitch).not.toBeInTheDocument();
});

describe("Header interactions", () => {
test("should show the correct coords in the header", () => {
// Arrange
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,19 +130,14 @@ export default function LockedLabelSettings(props: Props) {
</LabelMedium>

<View style={styles.row}>
{/* Color settings */}
{onMove && (
<>
<ColorSelect
selectedValue={color}
onChange={(newColor: LockedFigureColor) => {
onChangeProps({color: newColor});
}}
style={styles.spaceUnder}
/>
<Strut size={spacing.medium_16} />
</>
)}
<ColorSelect
selectedValue={color}
onChange={(newColor: LockedFigureColor) => {
onChangeProps({color: newColor});
}}
style={styles.spaceUnder}
/>
<Strut size={spacing.medium_16} />

{/* Size settings */}
<LabelMedium tag="label" style={styles.row}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ describe("LockedLineSettings", () => {
);

// Act
const colorSelect = screen.getByLabelText("color");
const colorSelect = screen.getAllByLabelText("color")[0];
await userEvent.click(colorSelect);
const colorOption = screen.getByText("pink");
await userEvent.click(colorOption);
Expand Down Expand Up @@ -424,7 +424,7 @@ describe("LockedLineSettings", () => {
);

// Act
const colorSelect = screen.getByLabelText("color");
const colorSelect = screen.getAllByLabelText("color")[0];
await userEvent.click(colorSelect);
const colorOption = screen.getByText("pink");
await userEvent.click(colorOption);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ describe("LockedPointSettings", () => {
);

// Act
const colorSelect = screen.getByLabelText("color");
const colorSelect = screen.getAllByLabelText("color")[0];
await userEvent.click(colorSelect);
await userEvent.click(screen.getByText("blue"));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ describe("LockedPolygonSettings", () => {
);

// Act
const colorSelect = screen.getByLabelText("color");
const colorSelect = screen.getAllByLabelText("color")[0];
await userEvent.click(colorSelect);
const colorOption = screen.getByText("pink");
await userEvent.click(colorOption);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ describe("Locked Vector Settings", () => {
);

// Act
const colorSelect = screen.getByLabelText("color");
const colorSelect = screen.getAllByLabelText("color")[0];
await userEvent.click(colorSelect);
const colorOption = screen.getByText("pink");
await userEvent.click(colorOption);
Expand Down