-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into salim/default-rpc-feature
- Loading branch information
Showing
13 changed files
with
584 additions
and
7 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
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
2 changes: 1 addition & 1 deletion
2
...ponents/Views/confirmations/components/Confirm/Info/PersonalSign/Message/Message.test.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
32 changes: 32 additions & 0 deletions
32
...s/Views/confirmations/components/Confirm/Info/PersonalSign/Simulation/Simulation.test.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import React from 'react'; | ||
|
||
import renderWithProvider from '../../../../../../../../util/test/renderWithProvider'; | ||
import { personalSignatureConfirmationState } from '../../../../../../../../util/test/confirm-data-helpers'; | ||
import Simulation from './index'; | ||
|
||
describe('Simulation', () => { | ||
it('should match snapshot', async () => { | ||
const container = renderWithProvider(<Simulation />, { | ||
state: personalSignatureConfirmationState, | ||
}); | ||
expect(container).toMatchSnapshot(); | ||
}); | ||
|
||
it('should return null if preference useTransactionSimulations is not enabled', async () => { | ||
const container = renderWithProvider(<Simulation />, { | ||
state: { | ||
engine: { | ||
backgroundState: { | ||
...personalSignatureConfirmationState, | ||
PreferencesController: { | ||
...personalSignatureConfirmationState.engine.backgroundState | ||
.PreferencesController, | ||
useTransactionSimulations: false, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}); | ||
expect(container).toMatchSnapshot(); | ||
}); | ||
}); |
30 changes: 30 additions & 0 deletions
30
...onents/Views/confirmations/components/Confirm/Info/PersonalSign/Simulation/Simulation.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import React from 'react'; | ||
import { useSelector } from 'react-redux'; | ||
|
||
import { strings } from '../../../../../../../../../locales/i18n'; | ||
import { selectUseTransactionSimulations } from '../../../../../../../../selectors/preferencesController'; | ||
import InfoSection from '../../../../UI/InfoRow/InfoSection'; | ||
import InfoRow from '../../../../UI/InfoRow'; | ||
|
||
const Simulation = () => { | ||
const useTransactionSimulations = useSelector( | ||
selectUseTransactionSimulations, | ||
); | ||
|
||
if (useTransactionSimulations !== true) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<InfoSection> | ||
<InfoRow | ||
label={strings('confirm.simulation.title')} | ||
tooltip={strings('confirm.simulation.tooltip')} | ||
> | ||
{strings('confirm.simulation.personal_sign_info')} | ||
</InfoRow> | ||
</InfoSection> | ||
); | ||
}; | ||
|
||
export default Simulation; |
131 changes: 131 additions & 0 deletions
131
...ns/components/Confirm/Info/PersonalSign/Simulation/__snapshots__/Simulation.test.tsx.snap
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,131 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`Simulation should match snapshot 1`] = ` | ||
<View | ||
style={ | ||
{ | ||
"backgroundColor": "#ffffff", | ||
"borderColor": "#bbc0c566", | ||
"borderRadius": 8, | ||
"borderWidth": 1, | ||
"marginBottom": 8, | ||
"padding": 8, | ||
} | ||
} | ||
> | ||
<View | ||
style={ | ||
{ | ||
"display": "flex", | ||
"flexDirection": "row", | ||
"flexWrap": "wrap", | ||
"justifyContent": "space-between", | ||
"paddingBottom": 8, | ||
"paddingHorizontal": 8, | ||
} | ||
} | ||
> | ||
<View | ||
style={ | ||
{ | ||
"alignItems": "center", | ||
"display": "flex", | ||
"flexDirection": "row", | ||
"marginTop": 8, | ||
} | ||
} | ||
> | ||
<Text | ||
style={ | ||
{ | ||
"color": "#141618", | ||
"fontFamily": "EuclidCircularB-Bold", | ||
"fontSize": 14, | ||
"fontWeight": "500", | ||
} | ||
} | ||
> | ||
Estimated changes | ||
</Text> | ||
<View> | ||
<TouchableOpacity | ||
accessible={true} | ||
activeOpacity={1} | ||
disabled={false} | ||
onPress={[Function]} | ||
onPressIn={[Function]} | ||
onPressOut={[Function]} | ||
style={ | ||
{ | ||
"alignItems": "center", | ||
"borderRadius": 8, | ||
"height": 24, | ||
"justifyContent": "center", | ||
"opacity": 1, | ||
"width": 24, | ||
} | ||
} | ||
testID="tooltipTestId" | ||
> | ||
<SvgMock | ||
color="#9fa6ae" | ||
height={16} | ||
name="Info" | ||
style={ | ||
{ | ||
"height": 16, | ||
"width": 16, | ||
} | ||
} | ||
width={16} | ||
/> | ||
</TouchableOpacity> | ||
<Modal | ||
animationType="none" | ||
deviceHeight={null} | ||
deviceWidth={null} | ||
hardwareAccelerated={false} | ||
hideModalContentWhileAnimating={false} | ||
onBackdropPress={[Function]} | ||
onModalHide={[Function]} | ||
onModalWillHide={[Function]} | ||
onModalWillShow={[Function]} | ||
onRequestClose={[Function]} | ||
onSwipeComplete={[Function]} | ||
panResponderThreshold={4} | ||
scrollHorizontal={false} | ||
scrollOffset={0} | ||
scrollOffsetMax={0} | ||
scrollTo={null} | ||
statusBarTranslucent={false} | ||
supportedOrientations={ | ||
[ | ||
"portrait", | ||
"landscape", | ||
] | ||
} | ||
swipeDirection="down" | ||
swipeThreshold={100} | ||
transparent={true} | ||
visible={false} | ||
/> | ||
</View> | ||
</View> | ||
<Text | ||
style={ | ||
{ | ||
"color": "#141618", | ||
"fontFamily": "EuclidCircularB-Regular", | ||
"fontSize": 14, | ||
"fontWeight": "400", | ||
"marginTop": 8, | ||
} | ||
} | ||
> | ||
You’re signing into a site and there are no predicted changes to your account. | ||
</Text> | ||
</View> | ||
</View> | ||
`; | ||
|
||
exports[`Simulation should return null if preference useTransactionSimulations is not enabled 1`] = `null`; |
1 change: 1 addition & 0 deletions
1
app/components/Views/confirmations/components/Confirm/Info/PersonalSign/Simulation/index.ts
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 @@ | ||
export { default } from './Simulation'; |
Oops, something went wrong.