-
Notifications
You must be signed in to change notification settings - Fork 401
upcoming: [UIE-10251] - Empty message for SwitchAccountDrawer child accounts table
#13412
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
32d583d
fix + test
abailly-akamai 9848986
Merge branch 'develop' into UIE-10251
abailly-akamai 7b7a7f0
Added changeset: Empty message for `SwitchAccountDrawer` child accounβ¦
abailly-akamai 4cdaa3a
Merge branch 'develop' into UIE-10251
abailly-akamai 7b3240f
feedback @bnussman-akamai
abailly-akamai File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
5 changes: 5 additions & 0 deletions
5
packages/manager/.changeset/pr-13412-upcoming-features-1771427444510.md
This file contains hidden or 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,5 @@ | ||
| --- | ||
| "@linode/manager": Upcoming Features | ||
| --- | ||
|
|
||
| Empty message for `SwitchAccountDrawer` child accounts table ([#13412](https://github.com/linode/manager/pull/13412)) |
This file contains hidden or 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 hidden or 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
80 changes: 80 additions & 0 deletions
80
packages/manager/src/features/Account/SwitchAccounts/ChildAccountsTable.test.tsx
This file contains hidden or 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,80 @@ | ||
| import React from 'react'; | ||
|
|
||
| import { accountFactory } from 'src/factories'; | ||
| import { renderWithTheme } from 'src/utilities/testHelpers'; | ||
|
|
||
| import { ChildAccountsTable } from './ChildAccountsTable'; | ||
|
|
||
| import type { ChildAccountsTableProps } from './ChildAccountsTable'; | ||
|
|
||
| const childAccounts = accountFactory.buildList(5).map((account, i) => ({ | ||
| ...account, | ||
| company: `Child Account ${i}`, | ||
| })); | ||
|
|
||
| const childAccountsWithMoreThan25 = accountFactory | ||
| .buildList(30) | ||
| .map((account, i) => ({ | ||
| ...account, | ||
| company: `Child Account ${i}`, | ||
| })); | ||
|
|
||
| const props: ChildAccountsTableProps = { | ||
| childAccounts, | ||
| currentTokenWithBearer: 'Bearer 123', | ||
| onSwitchAccount: vi.fn(), | ||
| page: 1, | ||
| pageSize: 25, | ||
| setIsSwitchingChildAccounts: vi.fn(), | ||
| totalResults: 0, | ||
| userType: undefined, | ||
|
Check warning on line 30 in packages/manager/src/features/Account/SwitchAccounts/ChildAccountsTable.test.tsx
|
||
| filter: {}, | ||
| isLoading: false, | ||
| isSwitchingChildAccounts: false, | ||
| onClose: vi.fn(), | ||
| onPageChange: vi.fn(), | ||
| onPageSizeChange: vi.fn(), | ||
| }; | ||
|
|
||
| describe('ChildAccountsTable', () => { | ||
| it('should display a list of child accounts', async () => { | ||
| const { getByTestId, getAllByText } = renderWithTheme( | ||
| <ChildAccountsTable {...props} /> | ||
| ); | ||
|
|
||
| expect(getByTestId('child-accounts-table')).toHaveAttribute( | ||
| 'aria-label', | ||
| 'List of Child Accounts' | ||
| ); | ||
|
|
||
| childAccounts.forEach((account) => { | ||
| expect(getAllByText(account.company)).toHaveLength(1); | ||
| }); | ||
| }); | ||
|
|
||
| it('should display pagination when there are more than 25 child accounts', async () => { | ||
| const firstPageAccounts = childAccountsWithMoreThan25.slice(0, 25); | ||
|
|
||
| const { getByTestId } = renderWithTheme( | ||
| <ChildAccountsTable | ||
| {...props} | ||
| childAccounts={firstPageAccounts} | ||
| totalResults={childAccountsWithMoreThan25.length} | ||
| /> | ||
| ); | ||
|
|
||
| expect(getByTestId('child-accounts-table-pagination')).toBeVisible(); | ||
| }); | ||
|
|
||
| it('should display an empty state when no child accounts are found', async () => { | ||
| const { getByText } = renderWithTheme( | ||
| <ChildAccountsTable {...props} childAccounts={[]} /> | ||
| ); | ||
|
|
||
| expect( | ||
| getByText( | ||
|
Check warning on line 75 in packages/manager/src/features/Account/SwitchAccounts/ChildAccountsTable.test.tsx
|
||
| /You don't have access to other accounts. You must be added to a delegation by an account administrator to have access to other accounts./ | ||
| ) | ||
| ).toBeInTheDocument(); | ||
| }); | ||
| }); | ||
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does not belong in there since this component is only rendered if
isIAMDelegationEnabledis false