File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed
Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -97,4 +97,26 @@ describe('API', () => {
9797
9898 expect ( eventPayload ) . toMatchObject ( expect . objectContaining ( { status : 'idle' , externalUrl : url } ) ) ;
9999 } ) ;
100+
101+ it ( 'should set cloud-image-edit activity with params' , async ( ) => {
102+ const uploadCtxProvider = page . getByTestId ( 'uc-upload-ctx-provider' ) . query ( ) ! as UploadCtxProvider ;
103+ const api = uploadCtxProvider . getAPI ( ) ;
104+
105+ const url =
106+ 'https://images.unsplash.com/photo-1699102241946-45c5e1937d69?ixlib=rb-4.0.3&q=85&fm=jpg&crop=entropy&cs=srgb&dl=prithiviraj-a-fa7Stge3YXs-unsplash.jpg&w=640' ;
107+ api . addFileFromUrl ( url ) ;
108+
109+ const eventHandler = ( event : CustomEvent < EventPayload [ 'file-upload-success' ] > ) => {
110+ const detail = event . detail as EventPayload [ 'file-upload-success' ] ;
111+ api . setCurrentActivity ( 'cloud-image-edit' , { internalId : detail . internalId } ) ;
112+ api . setModalState ( true ) ;
113+ } ;
114+
115+ uploadCtxProvider . addEventListener ( 'file-upload-success' , eventHandler ) ;
116+
117+ const startFrom = page . getByTestId ( 'uc-start-from' ) ;
118+ const cloudImageEdit = page . getByTestId ( 'uc-cloud-image-editor-activity' ) ;
119+ await expect . element ( startFrom ) . not . toBeVisible ( ) ;
120+ await expect . element ( cloudImageEdit ) . toBeVisible ( ) ;
121+ } ) ;
100122} ) ;
You can’t perform that action at this time.
0 commit comments