@@ -89,19 +89,15 @@ describe("TaskActions", () => {
8989 it ( "renders share button when item has id" , ( ) => {
9090 render ( < TaskActions item = { mockItem } buttonsDisabled = { false } /> )
9191
92- // Find button by its icon class
93- const buttons = screen . getAllByRole ( "button" )
94- const shareButton = buttons . find ( ( btn ) => btn . querySelector ( ".codicon-link" ) )
95- expect ( shareButton ) . toBeInTheDocument ( )
92+ // ShareButton now uses lucide Share icon and shows label text
93+ expect ( screen . getByText ( "Share task" ) ) . toBeInTheDocument ( )
9694 } )
9795
9896 it ( "does not render share button when item has no id" , ( ) => {
9997 render ( < TaskActions item = { undefined } buttonsDisabled = { false } /> )
10098
101- // Find button by its icon class
102- const buttons = screen . queryAllByRole ( "button" )
103- const shareButton = buttons . find ( ( btn ) => btn . querySelector ( ".codicon-link" ) )
104- expect ( shareButton ) . not . toBeDefined ( )
99+ // ShareButton returns null when no item ID
100+ expect ( screen . queryByText ( "Share task" ) ) . not . toBeInTheDocument ( )
105101 } )
106102
107103 it ( "renders share button even when not authenticated" , ( ) => {
@@ -112,22 +108,18 @@ describe("TaskActions", () => {
112108
113109 render ( < TaskActions item = { mockItem } buttonsDisabled = { false } /> )
114110
115- // Find button by its icon class
116- const buttons = screen . getAllByRole ( "button" )
117- const shareButton = buttons . find ( ( btn ) => btn . querySelector ( ".codicon-link" ) )
118- expect ( shareButton ) . toBeInTheDocument ( )
111+ // ShareButton should still render when not authenticated
112+ expect ( screen . getByText ( "Share task" ) ) . toBeInTheDocument ( )
119113 } )
120114 } )
121115
122116 describe ( "Authenticated User Share Flow" , ( ) => {
123117 it ( "shows organization and public share options when authenticated and sharing enabled" , ( ) => {
124118 render ( < TaskActions item = { mockItem } buttonsDisabled = { false } /> )
125119
126- // Find button by its icon class
127- const buttons = screen . getAllByRole ( "button" )
128- const shareButton = buttons . find ( ( btn ) => btn . querySelector ( ".codicon-link" ) )
129- expect ( shareButton ) . toBeDefined ( )
130- fireEvent . click ( shareButton ! )
120+ // Find share button by text and click it
121+ const shareButton = screen . getByText ( "Share task" )
122+ fireEvent . click ( shareButton )
131123
132124 expect ( screen . getByText ( "Share with Organization" ) ) . toBeInTheDocument ( )
133125 expect ( screen . getByText ( "Share Publicly" ) ) . toBeInTheDocument ( )
@@ -136,11 +128,9 @@ describe("TaskActions", () => {
136128 it ( "sends shareCurrentTask message when organization option is selected" , ( ) => {
137129 render ( < TaskActions item = { mockItem } buttonsDisabled = { false } /> )
138130
139- // Find button by its icon class
140- const buttons = screen . getAllByRole ( "button" )
141- const shareButton = buttons . find ( ( btn ) => btn . querySelector ( ".codicon-link" ) )
142- expect ( shareButton ) . toBeDefined ( )
143- fireEvent . click ( shareButton ! )
131+ // Find share button by text and click it
132+ const shareButton = screen . getByText ( "Share task" )
133+ fireEvent . click ( shareButton )
144134
145135 const orgOption = screen . getByText ( "Share with Organization" )
146136 fireEvent . click ( orgOption )
@@ -154,11 +144,9 @@ describe("TaskActions", () => {
154144 it ( "sends shareCurrentTask message when public option is selected" , ( ) => {
155145 render ( < TaskActions item = { mockItem } buttonsDisabled = { false } /> )
156146
157- // Find button by its icon class
158- const buttons = screen . getAllByRole ( "button" )
159- const shareButton = buttons . find ( ( btn ) => btn . querySelector ( ".codicon-link" ) )
160- expect ( shareButton ) . toBeDefined ( )
161- fireEvent . click ( shareButton ! )
147+ // Find share button by text and click it
148+ const shareButton = screen . getByText ( "Share task" )
149+ fireEvent . click ( shareButton )
162150
163151 const publicOption = screen . getByText ( "Share Publicly" )
164152 fireEvent . click ( publicOption )
@@ -180,11 +168,9 @@ describe("TaskActions", () => {
180168
181169 render ( < TaskActions item = { mockItem } buttonsDisabled = { false } /> )
182170
183- // Find button by its icon class
184- const buttons = screen . getAllByRole ( "button" )
185- const shareButton = buttons . find ( ( btn ) => btn . querySelector ( ".codicon-link" ) )
186- expect ( shareButton ) . toBeDefined ( )
187- fireEvent . click ( shareButton ! )
171+ // Find share button by text and click it
172+ const shareButton = screen . getByText ( "Share task" )
173+ fireEvent . click ( shareButton )
188174
189175 expect ( screen . queryByText ( "Share with Organization" ) ) . not . toBeInTheDocument ( )
190176 expect ( screen . getByText ( "Share Publicly" ) ) . toBeInTheDocument ( )
@@ -202,11 +188,9 @@ describe("TaskActions", () => {
202188 it ( "shows connect to cloud option when not authenticated" , ( ) => {
203189 render ( < TaskActions item = { mockItem } buttonsDisabled = { false } /> )
204190
205- // Find button by its icon class
206- const buttons = screen . getAllByRole ( "button" )
207- const shareButton = buttons . find ( ( btn ) => btn . querySelector ( ".codicon-link" ) )
208- expect ( shareButton ) . toBeDefined ( )
209- fireEvent . click ( shareButton ! )
191+ // Find share button by text and click it
192+ const shareButton = screen . getByText ( "Share task" )
193+ fireEvent . click ( shareButton )
210194
211195 expect ( screen . getByText ( "Connect to Roo Code Cloud" ) ) . toBeInTheDocument ( )
212196 expect ( screen . getByText ( "Sign in to Roo Code Cloud to share tasks" ) ) . toBeInTheDocument ( )
@@ -216,11 +200,9 @@ describe("TaskActions", () => {
216200 it ( "does not show organization and public options when not authenticated" , ( ) => {
217201 render ( < TaskActions item = { mockItem } buttonsDisabled = { false } /> )
218202
219- // Find button by its icon class
220- const buttons = screen . getAllByRole ( "button" )
221- const shareButton = buttons . find ( ( btn ) => btn . querySelector ( ".codicon-link" ) )
222- expect ( shareButton ) . toBeDefined ( )
223- fireEvent . click ( shareButton ! )
203+ // Find share button by text and click it
204+ const shareButton = screen . getByText ( "Share task" )
205+ fireEvent . click ( shareButton )
224206
225207 expect ( screen . queryByText ( "Share with Organization" ) ) . not . toBeInTheDocument ( )
226208 expect ( screen . queryByText ( "Share Publicly" ) ) . not . toBeInTheDocument ( )
@@ -229,11 +211,9 @@ describe("TaskActions", () => {
229211 it ( "sends rooCloudSignIn message when connect to cloud is selected" , ( ) => {
230212 render ( < TaskActions item = { mockItem } buttonsDisabled = { false } /> )
231213
232- // Find button by its icon class
233- const buttons = screen . getAllByRole ( "button" )
234- const shareButton = buttons . find ( ( btn ) => btn . querySelector ( ".codicon-link" ) )
235- expect ( shareButton ) . toBeDefined ( )
236- fireEvent . click ( shareButton ! )
214+ // Find share button by text and click it
215+ const shareButton = screen . getByText ( "Share task" )
216+ fireEvent . click ( shareButton )
237217
238218 const connectOption = screen . getByText ( "Connect" )
239219 fireEvent . click ( connectOption )
@@ -253,9 +233,8 @@ describe("TaskActions", () => {
253233
254234 render ( < TaskActions item = { mockItem } buttonsDisabled = { false } /> )
255235
256- // Find button by its icon class
257- const buttons = screen . getAllByRole ( "button" )
258- const shareButton = buttons . find ( ( btn ) => btn . querySelector ( ".codicon-link" ) )
236+ // Find share button by text
237+ const shareButton = screen . getByText ( "Share task" ) . closest ( "button" )
259238 expect ( shareButton ) . toBeInTheDocument ( )
260239 expect ( shareButton ) . toBeDisabled ( )
261240
@@ -303,10 +282,8 @@ describe("TaskActions", () => {
303282 const { rerender } = render ( < TaskActions item = { mockItem } buttonsDisabled = { false } /> )
304283
305284 // Click share button to open connect modal
306- const buttons = screen . getAllByRole ( "button" )
307- const shareButton = buttons . find ( ( btn ) => btn . querySelector ( ".codicon-link" ) )
308- expect ( shareButton ) . toBeDefined ( )
309- fireEvent . click ( shareButton ! )
285+ const shareButton = screen . getByText ( "Share task" )
286+ fireEvent . click ( shareButton )
310287
311288 // Click connect button to initiate authentication
312289 const connectButton = screen . getByText ( "Connect" )
@@ -353,12 +330,11 @@ describe("TaskActions", () => {
353330 } )
354331 } )
355332
356- it ( "renders delete button and file size when item has size" , ( ) => {
333+ it ( "renders delete button when item has size" , ( ) => {
357334 render ( < TaskActions item = { mockItem } buttonsDisabled = { false } /> )
358335
359336 const deleteButton = screen . getByLabelText ( "Delete Task (Shift + Click to skip confirmation)" )
360337 expect ( deleteButton ) . toBeInTheDocument ( )
361- expect ( screen . getByText ( "1024 B" ) ) . toBeInTheDocument ( )
362338 } )
363339
364340 it ( "does not render delete button when item has no size" , ( ) => {
@@ -375,10 +351,9 @@ describe("TaskActions", () => {
375351 render ( < TaskActions item = { mockItem } buttonsDisabled = { true } /> )
376352
377353 // Find buttons by their labels/icons
378- const buttons = screen . getAllByRole ( "button" )
379- const shareButton = buttons . find ( ( btn ) => btn . querySelector ( ".codicon-link" ) )
354+ const shareButton = screen . getByText ( "Share task" ) . closest ( "button" )
380355 const exportButton = screen . getByLabelText ( "Export task history" )
381- const copyButton = buttons . find ( ( btn ) => btn . querySelector ( ".codicon-copy" ) )
356+ const copyButton = screen . getByLabelText ( "history:copyPrompt" )
382357 const deleteButton = screen . getByLabelText ( "Delete Task (Shift + Click to skip confirmation)" )
383358
384359 // Share, export, and copy buttons should be enabled regardless of buttonsDisabled
@@ -393,10 +368,9 @@ describe("TaskActions", () => {
393368 // Test with buttonsDisabled = false
394369 const { rerender } = render ( < TaskActions item = { mockItem } buttonsDisabled = { false } /> )
395370
396- let buttons = screen . getAllByRole ( "button" )
397- let shareButton = buttons . find ( ( btn ) => btn . querySelector ( ".codicon-link" ) )
371+ let shareButton = screen . getByText ( "Share task" ) . closest ( "button" )
398372 let exportButton = screen . getByLabelText ( "Export task history" )
399- let copyButton = buttons . find ( ( btn ) => btn . querySelector ( ".codicon-copy" ) )
373+ let copyButton = screen . getByLabelText ( "history:copyPrompt" )
400374 let deleteButton = screen . getByLabelText ( "Delete Task (Shift + Click to skip confirmation)" )
401375
402376 expect ( shareButton ) . not . toBeDisabled ( )
@@ -407,10 +381,9 @@ describe("TaskActions", () => {
407381 // Test with buttonsDisabled = true
408382 rerender ( < TaskActions item = { mockItem } buttonsDisabled = { true } /> )
409383
410- buttons = screen . getAllByRole ( "button" )
411- shareButton = buttons . find ( ( btn ) => btn . querySelector ( ".codicon-link" ) )
384+ shareButton = screen . getByText ( "Share task" ) . closest ( "button" )
412385 exportButton = screen . getByLabelText ( "Export task history" )
413- copyButton = buttons . find ( ( btn ) => btn . querySelector ( ".codicon-copy" ) )
386+ copyButton = screen . getByLabelText ( "history:copyPrompt" )
414387 deleteButton = screen . getByLabelText ( "Delete Task (Shift + Click to skip confirmation)" )
415388
416389 // Share, export, and copy remain enabled
0 commit comments