@@ -4,16 +4,20 @@ import { lit, sym } from 'rdflib'
44import { ns } from 'solid-ui'
55import type { ProfileHeadingEditContext } from '../../../src/components/profile-heading/ProfileHeading'
66
7- const { getViewerModeMock, createHeadingEditDialogMock, pod } = vi . hoisted ( ( ) => ( {
7+ const { getViewerModeMock, createHeadingEditDialogMock, getPodContextMock , pod } = vi . hoisted ( ( ) => ( {
88 getViewerModeMock : vi . fn ( ) ,
99 createHeadingEditDialogMock : vi . fn ( ) ,
10+ getPodContextMock : vi . fn ( ) ,
1011 // What the page knows about the pod it is in
1112 pod : { current : { owner : undefined as string | undefined , storagePanes : [ ] as Array < { subject : { value : string } } > , viewerStorages : [ ] as string [ ] } }
1213} ) )
1314
1415vi . mock ( '../../../src/navigation/podContext' , async ( importOriginal ) => ( {
1516 ...await importOriginal < typeof import ( '../../../src/navigation/podContext' ) > ( ) ,
16- getPodContext : async ( ) => pod . current
17+ getPodContext : async ( url : string ) => {
18+ getPodContextMock ( url )
19+ return pod . current
20+ }
1721} ) )
1822
1923vi . mock ( '../../../src/components/profile-heading/editor/sections/heading/HeadingEditDialog' , ( ) => ( {
@@ -220,6 +224,21 @@ describe('page-level profile heading', () => {
220224 checkUser . mockRestore ( )
221225 } )
222226
227+ it ( 'uses the shell resource URL on each refresh and defaults back to the page URL' , async ( ) => {
228+ let resourceUrl = 'https://heading-shell.example/profile/card#me'
229+ await initializeProfileHeading ( ( ) => resourceUrl )
230+ await refreshProfileHeading ( )
231+ expect ( getPodContextMock ) . toHaveBeenLastCalledWith ( resourceUrl )
232+
233+ resourceUrl = 'https://heading-shell.example/public/'
234+ await refreshProfileHeading ( true )
235+ expect ( getPodContextMock ) . toHaveBeenLastCalledWith ( resourceUrl )
236+
237+ await initializeProfileHeading ( )
238+ await refreshProfileHeading ( )
239+ expect ( getPodContextMock ) . toHaveBeenLastCalledWith ( window . location . href )
240+ } )
241+
223242 it ( 'hides extra information and editing in compact mode, then restores the full heading' , async ( ) => {
224243 const heading = document . createElement ( 'solid-panes-profile-heading' ) as HTMLElement & {
225244 profileData : {
0 commit comments