@@ -3,6 +3,7 @@ import { fireEvent, render, screen, waitFor } from "@testing-library/react";
33
44import "@testing-library/jest-dom" ;
55
6+ import { ActivityExecutionErrorReportModal } from "../ActivityExecutionErrorReportModal" ;
67import { SilkActivityControl , SilkActivityControlProps } from "../SilkActivityControl" ;
78
89type FailureReportAction = NonNullable < SilkActivityControlProps [ "failureReportAction" ] > ;
@@ -72,6 +73,15 @@ describe("SilkActivityControl error report", () => {
7273 await waitFor ( ( ) => expect ( screen . queryByRole ( "dialog" ) ) . not . toBeInTheDocument ( ) ) ;
7374 } ) ;
7475
76+ it ( "uses the translated `showErrorReport` text as fallback name for a titleless error report dialog" , async ( ) => {
77+ const warnSpy = jest . spyOn ( console , "warn" ) . mockImplementation ( ( ) => undefined ) ;
78+ const { openErrorReport } = renderFailedActivity ( { title : "" } ) ;
79+ openErrorReport ( ) ;
80+ expect ( await screen . findByRole ( "dialog" , { name : "showErrorReport" } ) ) . toHaveAttribute ( "aria-modal" , "true" ) ;
81+ expect ( warnSpy ) . not . toHaveBeenCalled ( ) ;
82+ warnSpy . mockRestore ( ) ;
83+ } ) ;
84+
7585 it ( "forwards `aria-labelledby` to a titleless error report dialog" , async ( ) => {
7686 const { openErrorReport } = renderFailedActivity (
7787 { "aria-labelledby" : "external-report-label" } ,
@@ -82,3 +92,18 @@ describe("SilkActivityControl error report", () => {
8292 expect ( dialog ) . toHaveAttribute ( "aria-labelledby" , "external-report-label" ) ;
8393 } ) ;
8494} ) ;
95+
96+ describe ( "ActivityExecutionErrorReportModal" , ( ) => {
97+ it ( "uses an english fallback name if neither title nor aria attributes are given" , ( ) => {
98+ render (
99+ < ActivityExecutionErrorReportModal
100+ onDiscard = { jest . fn ( ) }
101+ report = { < p > Error details</ p > }
102+ downloadButtonValue = "Download"
103+ closeButtonValue = "Close"
104+ fetchErrorReport = { async ( ) => "Error details" }
105+ /> ,
106+ ) ;
107+ expect ( screen . getByRole ( "dialog" , { name : "Activity execution error report" } ) ) . toBeInTheDocument ( ) ;
108+ } ) ;
109+ } ) ;
0 commit comments