-
Notifications
You must be signed in to change notification settings - Fork 5.4k
feat: MCv1 Permissions: Site Connections Tooltip #23189
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
11 commits
Select commit
Hold shift + click to select a range
a7d9969
feat: add avatarType to AvatarGroupProps
vthomas13 87b692c
moving avatarType up into component level
vthomas13 9e7d813
fix: hiding avatargroup on snaps, adding key to avatar group
vthomas13 4d6b28b
wip tooltip
vthomas13 c4a0df9
Add connectedAccounts message and update ConnectionListItem component
vthomas13 4e02ff0
Add delay and duration to tooltip trigger; fix storybook
vthomas13 a71f918
Fix connection list item rendering issue
vthomas13 9581b81
Update text colors in ConnectionListItem component
vthomas13 28a77e9
Add new components for connection list tooltip and connection list it…
vthomas13 04a20a0
Remove console.log statement in ConnectionListItem test
vthomas13 06ec366
Refactor connection list tooltip rendering logic
vthomas13 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
71 changes: 71 additions & 0 deletions
71
ui/components/multichain/pages/permissions-page/connection-list-item.test.js
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,71 @@ | ||
| import React from 'react'; | ||
| import { fireEvent } from '@testing-library/react'; | ||
| import configureStore from '../../../../store/store'; | ||
| import mockState from '../../../../../test/data/mock-state.json'; | ||
| import { getURLHost } from '../../../../helpers/utils/util'; | ||
| import { renderWithProvider } from '../../../../../test/lib/render-helpers'; | ||
| import { ConnectionListItem } from './connection-list-item'; | ||
|
|
||
| describe('ConnectionListItem', () => { | ||
| const store = configureStore(mockState); | ||
|
|
||
| it('renders correctly for Snap connection', () => { | ||
| const mockConnection = { | ||
| id: 'npm:@metamask/testSnap1', | ||
| origin: 'npm:@metamask/testSnap1', | ||
| packageName: 'Test Snap 1', | ||
| subjectType: 'snap', | ||
| iconUrl: null, | ||
| }; | ||
| const { getByText, getByTestId } = renderWithProvider( | ||
| <ConnectionListItem connection={mockConnection} onClick={jest.fn()} />, | ||
| store, | ||
| ); | ||
|
|
||
| expect(getByTestId('connection-list-item')).toBeInTheDocument(); | ||
| expect(getByText('Test Snap 1')).toBeInTheDocument(); | ||
| expect( | ||
| document.querySelector('.connection-list-item__snap-avatar'), | ||
| ).toBeInTheDocument(); | ||
| }); | ||
|
|
||
| it('renders correctly for non-Snap connection', () => { | ||
| const mockConnection = { | ||
| id: 'https://metamask.github.io', | ||
| origin: 'https://metamask.github.io', | ||
| subjectType: 'website', | ||
| iconUrl: 'https://metamask.github.io/test-dapp/metamask-fox.svg', | ||
| }; | ||
|
|
||
| const { getByText, getByTestId } = renderWithProvider( | ||
| <ConnectionListItem connection={mockConnection} onClick={jest.fn()} />, | ||
| store, | ||
| ); | ||
|
|
||
| expect(getByTestId('connection-list-item')).toBeInTheDocument(); | ||
| expect( | ||
| getByText(getURLHost('https://metamask.github.io')), | ||
| ).toBeInTheDocument(); | ||
| expect( | ||
| getByTestId('connection-list-item__avatar-favicon'), | ||
| ).toBeInTheDocument(); | ||
| }); | ||
|
|
||
| it('calls onClick when clicked', () => { | ||
| const onClickMock = jest.fn(); | ||
| const mockConnection = { | ||
| id: 'npm:@metamask/testSnap1', | ||
| origin: 'npm:@metamask/testSnap1', | ||
| packageName: 'Test Snap 1', | ||
| subjectType: 'snap', | ||
| iconUrl: null, | ||
| }; | ||
| const { getByTestId } = renderWithProvider( | ||
| <ConnectionListItem connection={mockConnection} onClick={onClickMock} />, | ||
| store, | ||
| ); | ||
|
|
||
| fireEvent.click(getByTestId('connection-list-item')); | ||
| expect(onClickMock).toHaveBeenCalledTimes(1); | ||
| }); | ||
| }); |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.