@@ -77,7 +77,7 @@ describe('ContentIFrame Component', () => {
7777 describe ( 'if shouldShowContent' , ( ) => {
7878 describe ( 'if not hasLoaded' , ( ) => {
7979 it ( 'displays errorPage if showError' , ( ) => {
80- hooks . useIFrameBehavior . mockReturnValueOnce ( { ...iframeBehavior , showError : true , shouldShowContent : true } ) ;
80+ hooks . useIFrameBehavior . mockReturnValueOnce ( { ...iframeBehavior , showError : true } ) ;
8181 render ( < ContentIFrame { ...props } /> ) ;
8282 const errorPage = screen . getByText ( 'ErrorPage' ) ;
8383 expect ( errorPage ) . toBeInTheDocument ( ) ;
@@ -124,6 +124,13 @@ describe('ContentIFrame Component', () => {
124124 expect ( modal ) . toBeNull ( ) ;
125125 } ) ;
126126 describe ( 'if modalOptions.isOpen' , ( ) => {
127+ const testModalOpenAndHandleClose = ( ) => {
128+ it ( 'closes modal on close button click' , ( ) => {
129+ const closeButton = screen . getByTestId ( 'modal-backdrop' ) ;
130+ closeButton . click ( ) ;
131+ expect ( modalIFrameData . handleModalClose ) . toHaveBeenCalled ( ) ;
132+ } ) ;
133+ } ;
127134 describe ( 'fullscreen modal' , ( ) => {
128135 describe ( 'body modal' , ( ) => {
129136 beforeEach ( ( ) => {
@@ -139,6 +146,7 @@ describe('ContentIFrame Component', () => {
139146 const modalBody = screen . getByText ( modalOptions . withBody . body ) ;
140147 expect ( modalBody ) . toBeInTheDocument ( ) ;
141148 } ) ;
149+ testModalOpenAndHandleClose ( ) ;
142150 } ) ;
143151 describe ( 'url modal' , ( ) => {
144152 beforeEach ( ( ) => {
@@ -180,6 +188,7 @@ describe('ContentIFrame Component', () => {
180188 expect ( iframe ) . toHaveAttribute ( 'allow' , IFRAME_FEATURE_POLICY ) ;
181189 expect ( iframe ) . toHaveAttribute ( 'src' , modalOptions . withUrl . url ) ;
182190 } ) ;
191+ testModalOpenAndHandleClose ( ) ;
183192 } ) ;
184193 } ) ;
185194 } ) ;
0 commit comments