-
Notifications
You must be signed in to change notification settings - Fork 279
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(clerk-js,clerk-react,types): Introduce Custom Pages in UserProfile
- Loading branch information
Showing
20 changed files
with
976 additions
and
124 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
'@clerk/clerk-js': minor | ||
'@clerk/clerk-react': minor | ||
'@clerk/types': minor | ||
--- | ||
|
||
Introduce Custom Pages in UserProfile |
34 changes: 4 additions & 30 deletions
34
packages/clerk-js/src/ui/components/UserProfile/UserProfileNavbar.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,9 +2,10 @@ import { describe, it } from '@jest/globals'; | |
import React from 'react'; | ||
|
||
import { bindCreateFixtures, render, screen } from '../../../../testUtils'; | ||
import type { CustomPage } from '../../../utils'; | ||
import { UserProfile } from '../UserProfile'; | ||
|
||
const { createFixtures } = bindCreateFixtures('SignIn'); | ||
const { createFixtures } = bindCreateFixtures('UserProfile'); | ||
|
||
describe('UserProfile', () => { | ||
describe('Navigation', () => { | ||
|
@@ -19,5 +20,39 @@ describe('UserProfile', () => { | |
const securityElements = screen.getAllByText(/Security/i); | ||
expect(securityElements.some(el => el.tagName.toUpperCase() === 'BUTTON')).toBe(true); | ||
}); | ||
|
||
it('includes custom nav items', async () => { | ||
const { wrapper, props } = await createFixtures(f => { | ||
f.withUser({ email_addresses: ['[email protected]'] }); | ||
}); | ||
|
||
const customPages: CustomPage[] = [ | ||
{ | ||
label: 'Custom1', | ||
url: 'custom1', | ||
mount: () => undefined, | ||
unmount: () => undefined, | ||
mountIcon: () => undefined, | ||
unmountIcon: () => undefined, | ||
}, | ||
{ | ||
label: 'ExternalLink', | ||
url: '/link', | ||
mountIcon: () => undefined, | ||
unmountIcon: () => undefined, | ||
}, | ||
]; | ||
|
||
props.setProps({ customPages }); | ||
render(<UserProfile />, { wrapper }); | ||
const accountElements = screen.getAllByText(/Account/i); | ||
expect(accountElements.some(el => el.tagName.toUpperCase() === 'BUTTON')).toBe(true); | ||
const securityElements = screen.getAllByText(/Security/i); | ||
expect(securityElements.some(el => el.tagName.toUpperCase() === 'BUTTON')).toBe(true); | ||
const customElements = screen.getAllByText(/Custom1/i); | ||
expect(customElements.some(el => el.tagName.toUpperCase() === 'BUTTON')).toBe(true); | ||
const externalElements = screen.getAllByText(/ExternalLink/i); | ||
expect(externalElements.some(el => el.tagName.toUpperCase() === 'BUTTON')).toBe(true); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.