Skip to content

Commit

Permalink
Merge pull request #2093 from oasisprotocol/lw/rename-ledger-popup
Browse files Browse the repository at this point in the history
Rename ledger popup in extension
  • Loading branch information
buberdds authored Nov 12, 2024
2 parents 9558b45 + c37a296 commit 5e30074
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 13 deletions.
1 change: 1 addition & 0 deletions .changelog/2093.trivial.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Rename ledger popup in extension
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import { AlertBox } from 'app/components/AlertBox'
import { WalletErrors } from 'types/errors'
import { importAccountsActions } from 'app/state/importaccounts'
import { requestDevice } from 'app/lib/ledger'
import logotype from '../../../../public/Icon Blue 192.png'
import { WalletType } from '../../state/wallet/types'
import { WalletType } from '../../../src/app/state/wallet/types'
import logotype from '../../../public/Icon Blue 192.png'

type ConnectionStatus = 'connected' | 'disconnected' | 'connecting' | 'error'
type ConnectionStatusIconPros = {
Expand Down Expand Up @@ -44,7 +44,7 @@ function ConnectionStatusIcon({ success = true, label, withMargin = false }: Con
)
}

export function ConnectDevicePage() {
export function ExtLedgerAccessPopup() {
const { t } = useTranslation()
const dispatch = useDispatch()
const [connection, setConnection] = useState<ConnectionStatus>('disconnected')
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`<ConnectDevicePage /> should render component 1`] = `
exports[`<ExtLedgerAccessPopup /> should render component 1`] = `
.c0 {
display: -webkit-box;
display: -webkit-flex;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { render, screen } from '@testing-library/react'
import userEvent from '@testing-library/user-event'
import { requestDevice } from 'app/lib/ledger'
import { importAccountsActions } from 'app/state/importaccounts'
import { ConnectDevicePage } from '..'
import { WalletType } from '../../../state/wallet/types'
import { ExtLedgerAccessPopup } from '../ExtLedgerAccessPopup'
import { WalletType } from '../../../../src/app/state/wallet/types'

jest.mock('app/lib/ledger')

Expand All @@ -14,17 +14,17 @@ jest.mock('react-redux', () => ({
useDispatch: () => mockDispatch,
}))

describe('<ConnectDevicePage />', () => {
describe('<ExtLedgerAccessPopup />', () => {
it('should render component', () => {
const { container } = render(<ConnectDevicePage />)
const { container } = render(<ExtLedgerAccessPopup />)

expect(container).toMatchSnapshot()
})

it('should render success state', async () => {
jest.mocked(requestDevice).mockResolvedValue({} as USBDevice)

render(<ConnectDevicePage />)
render(<ExtLedgerAccessPopup />)

await userEvent.click(screen.getByRole('button'))

Expand All @@ -40,7 +40,7 @@ describe('<ConnectDevicePage />', () => {
it('should render error state', async () => {
jest.mocked(requestDevice).mockRejectedValue(new Error('error'))

render(<ConnectDevicePage />)
render(<ExtLedgerAccessPopup />)

userEvent.click(screen.getByRole('button'))

Expand Down
6 changes: 3 additions & 3 deletions extension/src/popup/routes.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React from 'react'
import { RouteObject } from 'react-router-dom'
import { App } from 'app'
import { ConnectDevicePage } from 'app/pages/ConnectDevicePage'
import { FromLedgerWebExtension } from 'app/pages/OpenWalletPage/webextension'
import { ExtLedgerAccessPopup } from '../ExtLedgerAccessPopup/ExtLedgerAccessPopup'
import { FromLedgerWebExtension } from 'app/pages/OpenWalletPage/FromLedgerWebExtension'
import { commonRoutes } from '../../../src/commonRoutes'
import { SelectOpenMethod } from '../../../src/app/pages/OpenWalletPage'

Expand All @@ -24,6 +24,6 @@ export const routes: RouteObject[] = [
},
{
path: 'open-wallet/connect-device',
element: <ConnectDevicePage />,
element: <ExtLedgerAccessPopup />,
},
]

0 comments on commit 5e30074

Please sign in to comment.