@@ -103,13 +103,14 @@ describe('UserButton with experimental.newProfiles', () => {
103103
104104 const profileTabs = ( ) => screen . getAllByRole ( 'tab' ) . map ( tab => tab . textContent ) ;
105105
106- it ( 'opens the combined UserProfile when managing the account , and closes' , async ( ) => {
106+ it ( 'opens the combined UserProfile straight from Settings, without a menu , and closes' , async ( ) => {
107107 const { clerk, navigate } = await renderWithNewProfiles ( ) ;
108108 const openUserProfile = vi . spyOn ( clerk , 'openUserProfile' ) ;
109109 const user = await open ( ) ;
110110
111- await openSettings ( user , 'Manage profile' ) ;
111+ await user . click ( screen . getByRole ( 'button' , { name : 'Settings' } ) ) ;
112112
113+ expect ( screen . queryByRole ( 'menu' ) ) . toBeNull ( ) ;
113114 expect ( await screen . findByRole ( 'tab' , { name : 'Account' } ) ) . toHaveAttribute ( 'aria-selected' , 'true' ) ;
114115 expect ( profileTabs ( ) ) . toEqual ( [ 'Account' , 'Security' , 'General' , 'Members' ] ) ;
115116 expect ( openUserProfile ) . not . toHaveBeenCalled ( ) ;
@@ -149,7 +150,7 @@ describe('UserButton with experimental.newProfiles', () => {
149150 ) ;
150151 const user = await open ( ) ;
151152
152- await openSettings ( user , 'Manage profile' ) ;
153+ await user . click ( screen . getByRole ( 'button' , { name : 'Settings' } ) ) ;
153154
154155 expect ( within ( container ) . getByRole ( 'tab' , { name : 'Account' } ) ) . toBeInTheDocument ( ) ;
155156 } ) ;
@@ -163,23 +164,32 @@ describe('UserButton with experimental.newProfiles', () => {
163164 } ) ;
164165 const user = await open ( ) ;
165166
166- await openSettings ( user , 'Manage profile' ) ;
167+ await user . click ( screen . getByRole ( 'button' , { name : 'Settings' } ) ) ;
167168
168169 expect ( await screen . findByRole ( 'tab' , { name : 'Terms' } ) ) . toHaveAttribute ( 'aria-selected' , 'true' ) ;
169170 expect ( screen . getByText ( 'Terms body' ) ) . toBeVisible ( ) ;
170171 expect ( profileTabs ( ) ) . toEqual ( [ 'Terms' , 'Account' , 'Security' , 'General' , 'Members' ] ) ;
171172 } ) ;
172173
173- it ( "opens the combined profile on the organization's General page, with its own pages in order" , async ( ) => {
174+ it ( "lists the organization's own pages in order in the combined profile " , async ( ) => {
174175 await renderWithNewProfiles ( { organizationProfileProps : { customPages : [ terms ] , pageOrder : [ 'terms' ] } } ) ;
175176 const user = await open ( ) ;
176177
177- await openSettings ( user , 'Manage organization' ) ;
178+ await user . click ( screen . getByRole ( 'button' , { name : 'Settings' } ) ) ;
178179
179- expect ( await screen . findByRole ( 'tab' , { name : 'General ' } ) ) . toHaveAttribute ( 'aria-selected' , 'true' ) ;
180+ expect ( await screen . findByRole ( 'tab' , { name : 'Account ' } ) ) . toHaveAttribute ( 'aria-selected' , 'true' ) ;
180181 expect ( profileTabs ( ) ) . toEqual ( [ 'Account' , 'Security' , 'Terms' , 'General' , 'Members' ] ) ;
181182 } ) ;
182183
184+ it ( 'still asks which to manage when the organization profile routes to a page' , async ( ) => {
185+ const { navigate } = await renderWithNewProfiles ( { organizationProfileUrl : '/org' } ) ;
186+ const user = await open ( ) ;
187+
188+ await openSettings ( user , 'Manage organization' ) ;
189+
190+ expect ( navigate ) . toHaveBeenCalledWith ( '/org' ) ;
191+ } ) ;
192+
183193 it ( "leaves the organization's pages out in user mode" , async ( ) => {
184194 await renderWithNewProfiles ( { mode : 'user' } ) ;
185195 const user = await open ( ) ;
0 commit comments