@@ -300,6 +300,45 @@ describe("Markra workspace", () => {
300300 expect ( mockedConsumeWelcomeDocumentState ) . not . toHaveBeenCalled ( ) ;
301301 } ) ;
302302
303+ it ( "switches visual editor content after restoring multiple document tabs" , async ( ) => {
304+ const guidePath = "/mock-files/vault/guide.md" ;
305+ const notesPath = "/mock-files/vault/notes.md" ;
306+ mockedGetStoredWorkspaceState . mockResolvedValue ( {
307+ aiAgentSessionId : "session-restored-tabs" ,
308+ filePath : notesPath ,
309+ fileTreeOpen : false ,
310+ folderName : null ,
311+ folderPath : null ,
312+ openFilePaths : [ guidePath , notesPath ]
313+ } ) ;
314+ mockedReadNativeMarkdownFile . mockImplementation ( async ( path ) => {
315+ if ( path === guidePath ) {
316+ return {
317+ content : "# Guide" ,
318+ name : "guide.md" ,
319+ path
320+ } ;
321+ }
322+
323+ return {
324+ content : "# Notes" ,
325+ name : "notes.md" ,
326+ path
327+ } ;
328+ } ) ;
329+
330+ renderApp ( ) ;
331+
332+ expect ( await screen . findByRole ( "heading" , { name : "Notes" } ) ) . toBeInTheDocument ( ) ;
333+ expect ( screen . getByRole ( "tab" , { name : / n o t e s \. m d / } ) ) . toHaveAttribute ( "aria-selected" , "true" ) ;
334+
335+ fireEvent . click ( screen . getByRole ( "tab" , { name : / g u i d e \. m d / } ) ) ;
336+
337+ expect ( await screen . findByRole ( "heading" , { name : "Guide" } ) ) . toBeInTheDocument ( ) ;
338+ expect ( screen . queryByRole ( "heading" , { name : "Notes" } ) ) . not . toBeInTheDocument ( ) ;
339+ expect ( screen . getByRole ( "tab" , { name : / g u i d e \. m d / } ) ) . toHaveAttribute ( "aria-selected" , "true" ) ;
340+ } ) ;
341+
303342 it ( "restores a saved side-by-side tab group on app launch" , async ( ) => {
304343 const firstPath = "/mock-files/vault/docs/1.md" ;
305344 const secondPath = "/mock-files/vault/docs/2.md" ;
0 commit comments