-
Notifications
You must be signed in to change notification settings - Fork 5k
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
Fixed hardware wallet info popup on token allowance screen #17881
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -2,6 +2,7 @@ import React from 'react'; | |||||||||
import configureMockStore from 'redux-mock-store'; | ||||||||||
import { fireEvent } from '@testing-library/react'; | ||||||||||
import { renderWithProvider } from '../../../test/lib/render-helpers'; | ||||||||||
import { HardwareKeyringTypes } from '../../../shared/constants/hardware-wallets'; | ||||||||||
import TokenAllowance from './token-allowance'; | ||||||||||
|
||||||||||
const testTokenAddress = '0xC011a73ee8576Fb46F5E1c5751cA3B9Fe0af2a6F'; | ||||||||||
|
@@ -11,17 +12,17 @@ const state = { | |||||||||
}, | ||||||||||
metamask: { | ||||||||||
accounts: { | ||||||||||
'0xAddress': { | ||||||||||
address: '0xAddress', | ||||||||||
balance: '0x1F4', | ||||||||||
'0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc': { | ||||||||||
address: '0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc', | ||||||||||
balance: '0x0', | ||||||||||
}, | ||||||||||
}, | ||||||||||
gasEstimateType: 'none', | ||||||||||
selectedAddress: '0xAddress', | ||||||||||
selectedAddress: '0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc', | ||||||||||
identities: { | ||||||||||
'0xAddress': { | ||||||||||
'0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc': { | ||||||||||
address: '0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc', | ||||||||||
name: 'Account 1', | ||||||||||
address: '0xAddress', | ||||||||||
}, | ||||||||||
}, | ||||||||||
frequentRpcListDetail: [], | ||||||||||
|
@@ -65,6 +66,13 @@ const state = { | |||||||||
}, | ||||||||||
], | ||||||||||
unapprovedTxs: {}, | ||||||||||
keyringTypes: [HardwareKeyringTypes.ledger], | ||||||||||
keyrings: [ | ||||||||||
{ | ||||||||||
type: HardwareKeyringTypes.ledger, | ||||||||||
accounts: ['0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc'], | ||||||||||
}, | ||||||||||
], | ||||||||||
}, | ||||||||||
history: { | ||||||||||
mostRecentOverviewPage: '/', | ||||||||||
|
@@ -245,4 +253,30 @@ describe('TokenAllowancePage', () => { | |||||||||
fireEvent.click(gotIt); | ||||||||||
expect(gotIt).not.toBeInTheDocument(); | ||||||||||
}); | ||||||||||
|
||||||||||
it('should show hardware wallet info text', () => { | ||||||||||
const { queryByText, getByText, getByTestId } = renderWithProvider( | ||||||||||
<TokenAllowance {...props} />, | ||||||||||
store, | ||||||||||
); | ||||||||||
|
||||||||||
const textField = getByTestId('custom-spending-cap-input'); | ||||||||||
fireEvent.change(textField, { target: { value: '1' } }); | ||||||||||
|
||||||||||
expect(queryByText('Prior to clicking confirm:')).toBeNull(); | ||||||||||
|
||||||||||
const nextButton = getByText('Next'); | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nice! tests look good. could be handy to add an additional null check to check the text is not showing on the first page
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good suggestion! Thanks! |
||||||||||
fireEvent.click(nextButton); | ||||||||||
|
||||||||||
expect(queryByText('Prior to clicking confirm:')).toBeInTheDocument(); | ||||||||||
}); | ||||||||||
|
||||||||||
it('should not show hardware wallet info text', () => { | ||||||||||
const { queryByText } = renderWithProvider( | ||||||||||
<TokenAllowance {...props} />, | ||||||||||
store, | ||||||||||
); | ||||||||||
|
||||||||||
expect(queryByText('Prior to clicking confirm:')).toBeNull(); | ||||||||||
}); | ||||||||||
}); |
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.
Hey will be nice to have test coverage for above.
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.
Seconded.Thirded.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.
Added here: ce80c0e