11import React from 'react' ;
2- import { render , screen , initializeMocks } from '@src/testUtils' ;
2+ import {
3+ render , screen , initializeMocks , waitFor ,
4+ } from '@src/testUtils' ;
35import { actions , selectors } from '../../data/redux' ;
46import { RequestKeys } from '../../data/constants/requests' ;
57import { TextEditorInternal as TextEditor , mapStateToProps , mapDispatchToProps } from '.' ;
@@ -67,7 +69,7 @@ describe('TextEditor', () => {
6769 expect ( element ?. getAttribute ( 'editorcontenthtml' ) ) . toBe ( 'eDiTablE Text' ) ;
6870 } ) ;
6971
70- test ( 'renders static images with relative paths' , ( ) => {
72+ test ( 'renders static images with relative paths' , async ( ) => {
7173 const updatedProps = {
7274 ...props ,
7375 validateAssetUrl : false ,
@@ -76,7 +78,11 @@ describe('TextEditor', () => {
7678 const { container } = render ( < TextEditor { ...updatedProps } /> ) ;
7779 const element = container . querySelector ( 'tinymcewidget' ) ;
7880 expect ( element ) . toBeInTheDocument ( ) ;
79- expect ( element ?. getAttribute ( 'editorcontenthtml' ) ) . toBe ( 'eDiTablE Text with <img src="/asset+org+run+type@[email protected] " />' ) ; 81+ await waitFor ( ( ) => {
82+ expect ( element ?. getAttribute ( 'editorcontenthtml' ) ) . toBe (
83+ 'eDiTablE Text with <img src="/asset+org+run+type@[email protected] " />' , 84+ ) ;
85+ } ) ;
8086 } ) ;
8187 test ( 'not yet loaded, Spinner appears' , ( ) => {
8288 const { container } = render ( < TextEditor { ...props } blockFinished = { false } /> ) ;
0 commit comments