@@ -202,6 +202,36 @@ describe('manager', () => {
202202 expect ( window . history . state ) . toMatchObject ( { paneName : 'mock' , paneUri : profile . uri , viaAccountMenu : true } )
203203 } )
204204
205+ it ( 'updates navigation state while preserving the current URL' , ( ) => {
206+ const manager = new OutlineManager ( { dom : document , session : { paneRegistry : mockPaneRegistry } } )
207+ const shellUrl = `${ window . location . origin } /browse.html?uri=${ encodeURIComponent ( `${ window . location . origin } /other/` ) } `
208+ const subject = sym ( `${ window . location . origin } /other/` )
209+ const pane = { ...MockPane , subject }
210+ window . history . replaceState ( { existing : true } , '' , shellUrl )
211+
212+ const seen : NavigatedDetail [ ] = [ ]
213+ const stop = onNavigated ( detail => seen . push ( detail ) )
214+ manager . GotoSubject ( subject , false , pane , true , undefined , undefined , {
215+ folderView : 'explorer' ,
216+ preserveUrl : true
217+ } )
218+ stop ( )
219+
220+ expect ( window . location . href ) . toBe ( shellUrl )
221+ expect ( window . history . state ) . toMatchObject ( {
222+ existing : true ,
223+ paneName : 'mock' ,
224+ paneUri : subject . uri
225+ } )
226+ expect ( seen . at ( - 1 ) ) . toMatchObject ( {
227+ url : shellUrl ,
228+ state : {
229+ view : { kind : 'pane' , pane : 'mock' , subject : subject . uri } ,
230+ viaAccountMenu : false
231+ }
232+ } )
233+ } )
234+
205235 it ( 'displays a navbar pane\'s own subject, and the page subject for panes without one' , ( ) => {
206236 const manager = new OutlineManager ( { dom : document , session : { paneRegistry : mockPaneRegistry } } )
207237 const page = sym ( `${ window . location . origin } /other/container/sub/` )
0 commit comments