authorgravatar for julius0216@outlook.comJulius Marminge <julius0216@outlook.com> 2026-09-05 01:57:00-07:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2026-09-05 01:57:00-07:00
log688e5948046e14be7f2bfd48d1c91b7e94d79267
treec297435481507ea5775dcf5360e52c0137f873c9
parent19ea3c5beb4cd93dd19f51f3e7c6d760357b41df
signature Signed by PGP key B5690EEEBB952194

refactor(web): keep pending action labels private (#10075)


2 files changed, 2 insertions(+), 92 deletions(-)

apps/web/src/components/chat/ComposerPrimaryActions.test.tsx+1-91
......@@ -15,7 +15,7 @@ vi.mock("../SidebarStageBackdrop", () => ({
1515 useSidebarStageBackdropVariant: (enabled = true) => (enabled ? stageArtworkState.variant : null),
1616}));
1717
18import { ComposerPrimaryActions, formatPendingPrimaryActionLabel } from "./ComposerPrimaryActions";
18import { ComposerPrimaryActions } from "./ComposerPrimaryActions";
1919
2020function renderPendingActions(isRunning: boolean) {
2121 return renderToStaticMarkup(
......@@ -92,96 +92,6 @@ afterEach(() => {
9292 stageArtworkState.variant = null;
9393});
9494
95describe("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
18595describe("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+1-1
......@@ -37,7 +37,7 @@ interface ComposerPrimaryActionsProps {
3737 onImplementPlanInNewThread: () => void;
3838}
3939
40export const formatPendingPrimaryActionLabel = (input: {
40const formatPendingPrimaryActionLabel = (input: {
4141 compact: boolean;
4242 isLastQuestion: boolean;
4343 isResponding: boolean;