Skip to content

Commit f4dfa0e

Browse files
refactor(web): keep pending action labels private
1 parent a98dad7 commit f4dfa0e

2 files changed

Lines changed: 2 additions & 92 deletions

File tree

‎apps/web/src/components/chat/ComposerPrimaryActions.test.tsx‎

Lines changed: 1 addition & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ vi.mock("../SidebarStageBackdrop", () => ({
1515
useSidebarStageBackdropVariant: (enabled = true) => (enabled ? stageArtworkState.variant : null),
1616
}));
1717

18-
import { ComposerPrimaryActions, formatPendingPrimaryActionLabel } from "./ComposerPrimaryActions";
18+
import { ComposerPrimaryActions } from "./ComposerPrimaryActions";
1919

2020
function renderPendingActions(isRunning: boolean) {
2121
return renderToStaticMarkup(
@@ -92,96 +92,6 @@ afterEach(() => {
9292
stageArtworkState.variant = null;
9393
});
9494

95-
describe("formatPendingPrimaryActionLabel", () => {
96-
it("returns 'Submitting...' while responding", () => {
97-
expect(
98-
formatPendingPrimaryActionLabel({
99-
compact: false,
100-
isLastQuestion: false,
101-
isResponding: true,
102-
questionIndex: 0,
103-
}),
104-
).toBe("Submitting...");
105-
});
106-
107-
it("returns 'Submitting...' while responding regardless of other flags", () => {
108-
expect(
109-
formatPendingPrimaryActionLabel({
110-
compact: true,
111-
isLastQuestion: true,
112-
isResponding: true,
113-
questionIndex: 3,
114-
}),
115-
).toBe("Submitting...");
116-
});
117-
118-
it("returns 'Submit' in compact mode on the last question", () => {
119-
expect(
120-
formatPendingPrimaryActionLabel({
121-
compact: true,
122-
isLastQuestion: true,
123-
isResponding: false,
124-
questionIndex: 0,
125-
}),
126-
).toBe("Submit");
127-
});
128-
129-
it("returns 'Next' in compact mode when not the last question", () => {
130-
expect(
131-
formatPendingPrimaryActionLabel({
132-
compact: true,
133-
isLastQuestion: false,
134-
isResponding: false,
135-
questionIndex: 1,
136-
}),
137-
).toBe("Next");
138-
});
139-
140-
it("returns 'Next question' when not the last question", () => {
141-
expect(
142-
formatPendingPrimaryActionLabel({
143-
compact: false,
144-
isLastQuestion: false,
145-
isResponding: false,
146-
questionIndex: 0,
147-
}),
148-
).toBe("Next question");
149-
});
150-
151-
it("returns singular 'Submit answer' on the last question when it is the only question", () => {
152-
expect(
153-
formatPendingPrimaryActionLabel({
154-
compact: false,
155-
isLastQuestion: true,
156-
isResponding: false,
157-
questionIndex: 0,
158-
}),
159-
).toBe("Submit answer");
160-
});
161-
162-
it("returns plural 'Submit answers' on the last question when there are multiple questions", () => {
163-
expect(
164-
formatPendingPrimaryActionLabel({
165-
compact: false,
166-
isLastQuestion: true,
167-
isResponding: false,
168-
questionIndex: 1,
169-
}),
170-
).toBe("Submit answers");
171-
});
172-
173-
it("returns plural 'Submit answers' for higher question indices", () => {
174-
expect(
175-
formatPendingPrimaryActionLabel({
176-
compact: false,
177-
isLastQuestion: true,
178-
isResponding: false,
179-
questionIndex: 5,
180-
}),
181-
).toBe("Submit answers");
182-
});
183-
});
184-
18595
describe("ComposerPrimaryActions", () => {
18696
it("disables and labels the send button while feedback is uploading", () => {
18797
const markup = renderSendButton("Sending feedback");

‎apps/web/src/components/chat/ComposerPrimaryActions.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ interface ComposerPrimaryActionsProps {
3737
onImplementPlanInNewThread: () => void;
3838
}
3939

40-
export const formatPendingPrimaryActionLabel = (input: {
40+
const formatPendingPrimaryActionLabel = (input: {
4141
compact: boolean;
4242
isLastQuestion: boolean;
4343
isResponding: boolean;

0 commit comments

Comments
 (0)