| ... | @@ -15,7 +15,7 @@ vi.mock("../SidebarStageBackdrop", () => ({ | ... | @@ -15,7 +15,7 @@ vi.mock("../SidebarStageBackdrop", () => ({ |
| 15 | useSidebarStageBackdropVariant: (enabled = true) => (enabled ? stageArtworkState.variant : null), | 15 | useSidebarStageBackdropVariant: (enabled = true) => (enabled ? stageArtworkState.variant : null), |
| 16 | })); | 16 | })); |
| 17 | | 17 | |
| 18 | import { ComposerPrimaryActions, formatPendingPrimaryActionLabel } from "./ComposerPrimaryActions"; | 18 | import { ComposerPrimaryActions } from "./ComposerPrimaryActions"; |
| 19 | | 19 | |
| 20 | function renderPendingActions(isRunning: boolean) { | 20 | function renderPendingActions(isRunning: boolean) { |
| 21 | return renderToStaticMarkup( | 21 | return renderToStaticMarkup( |
| ... | @@ -92,96 +92,6 @@ afterEach(() => { | ... | @@ -92,96 +92,6 @@ afterEach(() => { |
| 92 | stageArtworkState.variant = null; | 92 | stageArtworkState.variant = null; |
| 93 | }); | 93 | }); |
| 94 | | 94 | |
| 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 | | | |
| 185 | describe("ComposerPrimaryActions", () => { | 95 | describe("ComposerPrimaryActions", () => { |
| 186 | it("disables and labels the send button while feedback is uploading", () => { | 96 | it("disables and labels the send button while feedback is uploading", () => { |
| 187 | const markup = renderSendButton("Sending feedback"); | 97 | const markup = renderSendButton("Sending feedback"); |