@@ -371,29 +371,54 @@ describe("TaskActions", () => {
371371 } )
372372
373373 describe ( "Button States" , ( ) => {
374- it ( "disables share button but keeps export button enabled when buttonsDisabled is true" , ( ) => {
374+ it ( "keeps share, export, and copy buttons enabled but disables delete button when buttonsDisabled is true" , ( ) => {
375375 render ( < TaskActions item = { mockItem } buttonsDisabled = { true } /> )
376376
377- // Find button by its icon class
377+ // Find buttons by their labels/icons
378378 const buttons = screen . getAllByRole ( "button" )
379379 const shareButton = buttons . find ( ( btn ) => btn . querySelector ( ".codicon-link" ) )
380380 const exportButton = screen . getByLabelText ( "Export task history" )
381+ const copyButton = buttons . find ( ( btn ) => btn . querySelector ( ".codicon-copy" ) )
382+ const deleteButton = screen . getByLabelText ( "Delete Task (Shift + Click to skip confirmation)" )
381383
382- expect ( shareButton ) . toBeDisabled ( )
383- // Export button should always be enabled regardless of buttonsDisabled
384+ // Share, export, and copy buttons should be enabled regardless of buttonsDisabled
385+ expect ( shareButton ) . not . toBeDisabled ( )
384386 expect ( exportButton ) . not . toBeDisabled ( )
387+ expect ( copyButton ) . not . toBeDisabled ( )
388+ // Delete button should respect buttonsDisabled
389+ expect ( deleteButton ) . toBeDisabled ( )
385390 } )
386391
387- it ( "export button is always enabled regardless of buttonsDisabled state" , ( ) => {
392+ it ( "share, export, and copy buttons are always enabled while delete button respects buttonsDisabled state" , ( ) => {
388393 // Test with buttonsDisabled = false
389394 const { rerender } = render ( < TaskActions item = { mockItem } buttonsDisabled = { false } /> )
395+
396+ let buttons = screen . getAllByRole ( "button" )
397+ let shareButton = buttons . find ( ( btn ) => btn . querySelector ( ".codicon-link" ) )
390398 let exportButton = screen . getByLabelText ( "Export task history" )
399+ let copyButton = buttons . find ( ( btn ) => btn . querySelector ( ".codicon-copy" ) )
400+ let deleteButton = screen . getByLabelText ( "Delete Task (Shift + Click to skip confirmation)" )
401+
402+ expect ( shareButton ) . not . toBeDisabled ( )
391403 expect ( exportButton ) . not . toBeDisabled ( )
404+ expect ( copyButton ) . not . toBeDisabled ( )
405+ expect ( deleteButton ) . not . toBeDisabled ( )
392406
393407 // Test with buttonsDisabled = true
394408 rerender ( < TaskActions item = { mockItem } buttonsDisabled = { true } /> )
409+
410+ buttons = screen . getAllByRole ( "button" )
411+ shareButton = buttons . find ( ( btn ) => btn . querySelector ( ".codicon-link" ) )
395412 exportButton = screen . getByLabelText ( "Export task history" )
413+ copyButton = buttons . find ( ( btn ) => btn . querySelector ( ".codicon-copy" ) )
414+ deleteButton = screen . getByLabelText ( "Delete Task (Shift + Click to skip confirmation)" )
415+
416+ // Share, export, and copy remain enabled
417+ expect ( shareButton ) . not . toBeDisabled ( )
396418 expect ( exportButton ) . not . toBeDisabled ( )
419+ expect ( copyButton ) . not . toBeDisabled ( )
420+ // Delete button is disabled
421+ expect ( deleteButton ) . toBeDisabled ( )
397422 } )
398423 } )
399424} )
0 commit comments