replace internal react types

This commit is contained in:
mmv 2019-06-03 17:17:10 +04:00
parent 6523a25c9b
commit 95dcce1684
46 changed files with 104 additions and 83 deletions

View File

@ -19,8 +19,8 @@ const logo = require('../assets/gnosis-safe-logo.svg')
type Props = Open & { type Props = Open & {
classes: Object, classes: Object,
providerDetails: React$Node, providerDetails: React.Node,
providerInfo: React$Node, providerInfo: React.Node,
} }
const styles = () => ({ const styles = () => ({

View File

@ -10,8 +10,8 @@ import { sm, md } from '~/theme/variables'
type Props = Open & { type Props = Open & {
classes: Object, classes: Object,
popupDetails: React$Node, popupDetails: React.Node,
info: React$Node, info: React.Node,
children: Function, children: Function,
} }

View File

@ -9,7 +9,7 @@ type Props = {
description: string, description: string,
open: boolean, open: boolean,
handleClose: Function, handleClose: Function,
children: React$Node, children: React.Node,
classes: Object, classes: Object,
modalClassName: ?string, modalClassName: ?string,
paperClassName: ?string, paperClassName: ?string,

View File

@ -31,7 +31,15 @@ export const SharedSnackbar = () => (
</SharedSnackbarConsumer> </SharedSnackbarConsumer>
) )
const SharedSnackbarContext = React.createContext({ type SnackbarContext = {
openSnackbar: Function,
closeSnackbar: Function,
snackbarIsOpen: boolean,
message: string,
variant: string,
}
const SharedSnackbarContext = React.createContext<SnackbarContext>({
openSnackbar: undefined, openSnackbar: undefined,
closeSnackbar: undefined, closeSnackbar: undefined,
snackbarIsOpen: false, snackbarIsOpen: false,
@ -40,7 +48,7 @@ const SharedSnackbarContext = React.createContext({
}) })
type Props = { type Props = {
children: React$Node, children: React.Node,
} }
export type Variant = 'success' | 'error' | 'warning' | 'info' export type Variant = 'success' | 'error' | 'warning' | 'info'

View File

@ -21,8 +21,8 @@ const styles = () => ({
type Props = { type Props = {
classes: Object, classes: Object,
children: React$Node, children: React.Node,
controls: React$Node, controls: React.Node,
container?: number, container?: number,
padding?: boolean, padding?: boolean,
} }

View File

@ -2,7 +2,7 @@
import * as React from 'react' import * as React from 'react'
type Props = { type Props = {
children: React$Node, children: React.Node,
} }
const Step = ({ children }: Props) => ( const Step = ({ children }: Props) => (

View File

@ -16,7 +16,7 @@ export { default as Step } from './Step'
type Props = { type Props = {
steps: string[], steps: string[],
onSubmit: (values: Object) => Promise<void>, onSubmit: (values: Object) => Promise<void>,
children: React$Node, children: React.Node,
classes: Object, classes: Object,
onReset?: () => void, onReset?: () => void,
initialValues?: Object, initialValues?: Object,
@ -73,13 +73,13 @@ class GnoStepper extends React.PureComponent<Props, State> {
})) }))
} }
getPageProps = (pages: React$Node): PageProps => { getPageProps = (pages: React.Node): PageProps => {
const { page } = this.state const { page } = this.state
return React.Children.toArray(pages)[page].props return React.Children.toArray(pages)[page].props
} }
getActivePageFrom = (pages: React$Node) => { getActivePageFrom = (pages: React.Node) => {
const activePageProps = this.getPageProps(pages) const activePageProps = this.getPageProps(pages)
const { children, ...props } = activePageProps const { children, ...props } = activePageProps

View File

@ -11,7 +11,7 @@ type Props = {
margin?: Size, margin?: Size,
padding?: Size, padding?: Size,
align?: 'center' | 'right' | 'left', align?: 'center' | 'right' | 'left',
children: React$Node, children: React.Node,
className?: string, className?: string,
} }

View File

@ -2,7 +2,7 @@
import * as React from 'react' import * as React from 'react'
type Props = { type Props = {
children: React$Node, children: React.Node,
} }
class Bold extends React.PureComponent<Props> { class Bold extends React.PureComponent<Props> {

View File

@ -27,7 +27,7 @@ type Props = {
mdOffset?: number, mdOffset?: number,
lgOffset?: number, lgOffset?: number,
className?: string, className?: string,
children: React$Node, children: React.Node,
} }
const Col = ({ const Col = ({

View File

@ -14,7 +14,7 @@ type Props = {
color?: 'soft' | 'medium' | 'dark' | 'white' | 'fancy' | 'primary' | 'secondary' | 'warning' | 'disabled', color?: 'soft' | 'medium' | 'dark' | 'white' | 'fancy' | 'primary' | 'secondary' | 'warning' | 'disabled',
tag: HeadingTag, tag: HeadingTag,
truncate?: boolean, truncate?: boolean,
children: React$Node, children: React.Node,
} }
class Heading extends React.PureComponent<Props> { class Heading extends React.PureComponent<Props> {

View File

@ -10,7 +10,7 @@ type Props = {
fullwidth?: boolean, fullwidth?: boolean,
bordered?: boolean, bordered?: boolean,
className?: string, className?: string,
style?: React$Node, style?: React.Node,
} }
const Img = ({ const Img = ({

View File

@ -10,7 +10,7 @@ const cx = classNames.bind(styles)
type Props = { type Props = {
padding?: 'xs' | 'sm' | 'md', padding?: 'xs' | 'sm' | 'md',
to: string, to: string,
children: React$Node, children: React.Node,
color?: 'regular' | 'white', color?: 'regular' | 'white',
className?: string, className?: string,
innerRef: React.ElementRef<any>, innerRef: React.ElementRef<any>,

View File

@ -6,7 +6,7 @@ import styles from './index.scss'
const cx = classNames.bind(styles) const cx = classNames.bind(styles)
type Props = { type Props = {
children: React$Node, children: React.Node,
align?: 'center', align?: 'center',
overflow?: boolean overflow?: boolean
} }

View File

@ -6,7 +6,7 @@ import { SharedSnackbarProvider } from '~/components/SharedSnackBar'
import styles from './index.scss' import styles from './index.scss'
type Props = { type Props = {
children: React$Node, children: React.Node,
} }
const PageFrame = ({ children }: Props) => ( const PageFrame = ({ children }: Props) => (

View File

@ -13,7 +13,7 @@ type Props = {
size?: 'sm' | 'md' | 'lg' | 'xl' | 'xxl', size?: 'sm' | 'md' | 'lg' | 'xl' | 'xxl',
color?: 'soft' | 'medium' | 'dark' | 'white' | 'fancy' | 'primary' | 'secondary' | 'warning' | 'disabled', color?: 'soft' | 'medium' | 'dark' | 'white' | 'fancy' | 'primary' | 'secondary' | 'warning' | 'disabled',
transform?: 'capitalize' | 'lowercase' | 'uppercase', transform?: 'capitalize' | 'lowercase' | 'uppercase',
children: React$Node, children: React.Node,
dot?: boolean, dot?: boolean,
className?: string, className?: string,
} }

View File

@ -6,7 +6,7 @@ import styles from './index.scss'
const cx = classNames.bind(styles) const cx = classNames.bind(styles)
type Props = { type Props = {
children: React$Node, children: React.Node,
} }
const Pre = ({ children, ...props }: Props) => ( const Pre = ({ children, ...props }: Props) => (

View File

@ -8,7 +8,7 @@ const cx = classNames.bind(styles)
type Props = { type Props = {
className?: string, className?: string,
children: React$Node, children: React.Node,
margin?: 'xs' | 'sm' | 'md' | 'lg' | 'xl', margin?: 'xs' | 'sm' | 'md' | 'lg' | 'xl',
align?: 'center' | 'end' | 'start', align?: 'center' | 'end' | 'start',
grow?: boolean, grow?: boolean,

View File

@ -2,7 +2,7 @@
import React, { PureComponent } from 'react' import React, { PureComponent } from 'react'
type Props = { type Props = {
children: React$Node children: React.Node
} }
class Span extends PureComponent<Props> { class Span extends PureComponent<Props> {

View File

@ -6,10 +6,12 @@ import TableCell from '@material-ui/core/TableCell'
import TableHead from '@material-ui/core/TableHead' import TableHead from '@material-ui/core/TableHead'
import TableRow from '@material-ui/core/TableRow' import TableRow from '@material-ui/core/TableRow'
export { TableBody, TableCell, TableHead, TableRow } export {
TableBody, TableCell, TableHead, TableRow,
}
type Props = { type Props = {
children: React$Node, children: React.Node,
size?: number size?: number
} }
@ -35,4 +37,3 @@ const GnoTable = ({ size, children }: Props) => {
} }
export default GnoTable export default GnoTable

View File

@ -116,7 +116,7 @@ const Details = ({ classes, errors }: Props) => (
const DetailsForm = withStyles(styles)(Details) const DetailsForm = withStyles(styles)(Details)
const DetailsPage = () => (controls: React$Node, { errors }: Object) => ( const DetailsPage = () => (controls: React.Node, { errors }: Object) => (
<React.Fragment> <React.Fragment>
<OpenPaper controls={controls} container={605}> <OpenPaper controls={controls} container={605}>
<DetailsForm errors={errors} /> <DetailsForm errors={errors} />

View File

@ -138,7 +138,7 @@ class ReviewComponent extends React.PureComponent<Props, State> {
const ReviewPage = withStyles(styles)(ReviewComponent) const ReviewPage = withStyles(styles)(ReviewComponent)
const Review = ({ network, userAddress }: LayoutProps) => (controls: React$Node, { values }: Object) => ( const Review = ({ network, userAddress }: LayoutProps) => (controls: React.Node, { values }: Object) => (
<React.Fragment> <React.Fragment>
<OpenPaper controls={controls} padding={false}> <OpenPaper controls={controls} padding={false}>
<ReviewPage network={network} values={values} userAddress={userAddress} /> <ReviewPage network={network} values={values} userAddress={userAddress} />

View File

@ -155,7 +155,7 @@ const ReviewComponent = ({ values, classes, network }: Props) => {
const ReviewPage = withStyles(styles)(ReviewComponent) const ReviewPage = withStyles(styles)(ReviewComponent)
const Review = ({ network }: LayoutProps) => (controls: React$Node, { values }: Object) => ( const Review = ({ network }: LayoutProps) => (controls: React.Node, { values }: Object) => (
<React.Fragment> <React.Fragment>
<OpenPaper controls={controls} padding={false}> <OpenPaper controls={controls} padding={false}>
<ReviewPage network={network} values={values} /> <ReviewPage network={network} values={values} />

View File

@ -83,7 +83,7 @@ const SafeName = ({ classes }: Props) => (
const SafeNameForm = withStyles(styles)(SafeName) const SafeNameForm = withStyles(styles)(SafeName)
const SafeNamePage = () => (controls: React$Node) => ( const SafeNamePage = () => (controls: React.Node) => (
<OpenPaper controls={controls} container={600}> <OpenPaper controls={controls} container={600}>
<SafeNameForm /> <SafeNameForm />
</OpenPaper> </OpenPaper>

View File

@ -194,7 +194,7 @@ class SafeOwners extends React.Component<Props, State> {
const SafeOwnersForm = withStyles(styles)(SafeOwners) const SafeOwnersForm = withStyles(styles)(SafeOwners)
const SafeOwnersPage = ({ updateInitialProps }: Object) => (controls: React$Node, { values, errors }: Object) => ( const SafeOwnersPage = ({ updateInitialProps }: Object) => (controls: React.Node, { values, errors }: Object) => (
<React.Fragment> <React.Fragment>
<OpenPaper controls={controls} padding={false}> <OpenPaper controls={controls} padding={false}>
<SafeOwnersForm <SafeOwnersForm

View File

@ -80,7 +80,7 @@ const SafeThreshold = ({ classes, values }: Props) => {
const SafeThresholdForm = withStyles(styles)(SafeThreshold) const SafeThresholdForm = withStyles(styles)(SafeThreshold)
const SafeOwnersPage = () => (controls: React$Node, { values }: Object) => ( const SafeOwnersPage = () => (controls: React.Node, { values }: Object) => (
<React.Fragment> <React.Fragment>
<OpenPaper controls={controls} container={450}> <OpenPaper controls={controls} container={450}>
<SafeThresholdForm values={values} /> <SafeThresholdForm values={values} />

View File

@ -32,7 +32,7 @@ type Props = {
addresses: string[], addresses: string[],
} }
const AddOwnerForm = ({ addresses, numOwners, threshold }: Props) => (controls: React$Node) => ( const AddOwnerForm = ({ addresses, numOwners, threshold }: Props) => (controls: React.Node) => (
<OpenPaper controls={controls}> <OpenPaper controls={controls}>
<Heading tag="h2" margin="lg"> <Heading tag="h2" margin="lg">
Add Owner Add Owner

View File

@ -17,7 +17,7 @@ const spinnerStyle = {
minHeight: '50px', minHeight: '50px',
} }
const Review = () => (controls: React$Node, { values, submitting }: FormProps) => { const Review = () => (controls: React.Node, { values, submitting }: FormProps) => {
const text = values[INCREASE_PARAM] const text = values[INCREASE_PARAM]
? 'This operation will increase the threshold of the safe' ? 'This operation will increase the threshold of the safe'
: 'This operation will not modify the threshold of the safe' : 'This operation will not modify the threshold of the safe'
@ -26,10 +26,14 @@ const Review = () => (controls: React$Node, { values, submitting }: FormProps) =
<OpenPaper controls={controls}> <OpenPaper controls={controls}>
<Heading tag="h2">Review the Add Owner operation</Heading> <Heading tag="h2">Review the Add Owner operation</Heading>
<Paragraph align="left"> <Paragraph align="left">
<Bold>Owner Name: </Bold> {values[NAME_PARAM]} <Bold>Owner Name: </Bold>
{' '}
{values[NAME_PARAM]}
</Paragraph> </Paragraph>
<Paragraph align="left"> <Paragraph align="left">
<Bold>Owner Address: </Bold> {values[OWNER_ADDRESS_PARAM]} <Bold>Owner Address: </Bold>
{' '}
{values[OWNER_ADDRESS_PARAM]}
</Paragraph> </Paragraph>
<Paragraph align="left"> <Paragraph align="left">
<Bold>{text}</Bold> <Bold>{text}</Bold>

View File

@ -20,7 +20,7 @@ type Props = {
const RemoveOwnerForm = ({ const RemoveOwnerForm = ({
numOwners, threshold, name, disabled, pendingTransactions, numOwners, threshold, name, disabled, pendingTransactions,
}: Props) => ( }: Props) => (
controls: React$Node, controls: React.Node,
) => ( ) => (
<OpenPaper controls={controls}> <OpenPaper controls={controls}>
<Heading tag="h2" margin="lg"> <Heading tag="h2" margin="lg">

View File

@ -21,7 +21,7 @@ const spinnerStyle = {
minHeight: '50px', minHeight: '50px',
} }
const Review = ({ name }: Props) => (controls: React$Node, { values, submitting }: FormProps) => { const Review = ({ name }: Props) => (controls: React.Node, { values, submitting }: FormProps) => {
const text = values[DECREASE_PARAM] const text = values[DECREASE_PARAM]
? 'This operation will decrease the threshold of the safe' ? 'This operation will decrease the threshold of the safe'
: 'This operation will not modify the threshold of the safe' : 'This operation will not modify the threshold of the safe'
@ -30,7 +30,9 @@ const Review = ({ name }: Props) => (controls: React$Node, { values, submitting
<OpenPaper controls={controls}> <OpenPaper controls={controls}>
<Heading tag="h2">Review the Remove Owner operation</Heading> <Heading tag="h2">Review the Remove Owner operation</Heading>
<Paragraph align="left"> <Paragraph align="left">
<Bold>Owner Name: </Bold> {name} <Bold>Owner Name: </Bold>
{' '}
{name}
</Paragraph> </Paragraph>
<Paragraph align="left"> <Paragraph align="left">
<Bold>{text}</Bold> <Bold>{text}</Bold>

View File

@ -32,7 +32,7 @@ type SafeProps = {
} }
type State = { type State = {
component?: React$Node, component?: React.Node,
} }
const listStyle = { const listStyle = {

View File

@ -21,7 +21,7 @@ const spinnerStyle = {
minHeight: '50px', minHeight: '50px',
} }
const ReviewTx = ({ symbol }: Props) => (controls: React$Node, { values, submitting }: FormProps) => ( const ReviewTx = ({ symbol }: Props) => (controls: React.Node, { values, submitting }: FormProps) => (
<OpenPaper controls={controls}> <OpenPaper controls={controls}>
<Heading tag="h2">Review the move token funds</Heading> <Heading tag="h2">Review the move token funds</Heading>
<Paragraph align="left"> <Paragraph align="left">

View File

@ -2,7 +2,9 @@
import * as React from 'react' import * as React from 'react'
import Field from '~/components/forms/Field' import Field from '~/components/forms/Field'
import TextField from '~/components/forms/TextField' import TextField from '~/components/forms/TextField'
import { composeValidators, inLimit, mustBeFloat, required, greaterThan, mustBeEthereumAddress } from '~/components/forms/validator' import {
composeValidators, inLimit, mustBeFloat, required, greaterThan, mustBeEthereumAddress,
} from '~/components/forms/validator'
import Block from '~/components/layout/Block' import Block from '~/components/layout/Block'
import OpenPaper from '~/components/Stepper/OpenPaper' import OpenPaper from '~/components/Stepper/OpenPaper'
import Heading from '~/components/layout/Heading' import Heading from '~/components/layout/Heading'
@ -17,7 +19,7 @@ type Props = {
symbol: string, symbol: string,
} }
const SendTokenForm = ({ funds, symbol }: Props) => (controls: React$Node) => ( const SendTokenForm = ({ funds, symbol }: Props) => (controls: React.Node) => (
<OpenPaper controls={controls}> <OpenPaper controls={controls}>
<Heading tag="h2" margin="lg"> <Heading tag="h2" margin="lg">
Send tokens Transaction Send tokens Transaction

View File

@ -17,11 +17,13 @@ const spinnerStyle = {
minHeight: '50px', minHeight: '50px',
} }
const Review = () => (controls: React$Node, { values, submitting }: FormProps) => ( const Review = () => (controls: React.Node, { values, submitting }: FormProps) => (
<OpenPaper controls={controls}> <OpenPaper controls={controls}>
<Heading tag="h2">Review the Threshold operation</Heading> <Heading tag="h2">Review the Threshold operation</Heading>
<Paragraph align="left"> <Paragraph align="left">
<Bold>The new threshold will be: </Bold> {values[THRESHOLD_PARAM]} <Bold>The new threshold will be: </Bold>
{' '}
{values[THRESHOLD_PARAM]}
</Paragraph> </Paragraph>
<Block style={spinnerStyle}> <Block style={spinnerStyle}>
{ submitting && <CircularProgress size={50} /> } { submitting && <CircularProgress size={50} /> }

View File

@ -5,7 +5,9 @@ import Heading from '~/components/layout/Heading'
import OpenPaper from '~/components/Stepper/OpenPaper' import OpenPaper from '~/components/Stepper/OpenPaper'
import Field from '~/components/forms/Field' import Field from '~/components/forms/Field'
import TextField from '~/components/forms/TextField' import TextField from '~/components/forms/TextField'
import { composeValidators, minValue, maxValue, mustBeInteger, required } from '~/components/forms/validator' import {
composeValidators, minValue, maxValue, mustBeInteger, required,
} from '~/components/forms/validator'
import { type Safe } from '~/routes/safe/store/models/safe' import { type Safe } from '~/routes/safe/store/models/safe'
export const THRESHOLD_PARAM = 'threshold' export const THRESHOLD_PARAM = 'threshold'
@ -15,7 +17,7 @@ type ThresholdProps = {
safe: Safe, safe: Safe,
} }
const ThresholdForm = ({ numOwners, safe }: ThresholdProps) => (controls: React$Node) => ( const ThresholdForm = ({ numOwners, safe }: ThresholdProps) => (controls: React.Node) => (
<OpenPaper controls={controls}> <OpenPaper controls={controls}>
<Heading tag="h2" margin="lg"> <Heading tag="h2" margin="lg">
{'Change safe\'s threshold'} {'Change safe\'s threshold'}

View File

@ -13,7 +13,7 @@ import { MOVE_FUNDS_BUTTON_TEXT } from '~/routes/safe/components/Safe/BalanceInf
export type DomSafe = { export type DomSafe = {
address: string, address: string,
safeButtons: Element[], safeButtons: Element[],
safe: React$Component<any, any>, safe: React.Component<any, any>,
accounts: string[], accounts: string[],
store: Store<GlobalState>, store: Store<GlobalState>,
} }

View File

@ -33,7 +33,7 @@ export const listTxsClickingOn = async (store: Store, seeTxsButton: Element, saf
await sleep(800) await sleep(800)
} }
export const checkMinedTx = (Transaction: React$Component<any, any>, name: string) => { export const checkMinedTx = (Transaction: React.Component<any, any>, name: string) => {
const paragraphs = TestUtils.scryRenderedDOMComponentsWithTag(Transaction, 'p') const paragraphs = TestUtils.scryRenderedDOMComponentsWithTag(Transaction, 'p')
const status = 'Already executed' const status = 'Already executed'
@ -49,9 +49,9 @@ export const checkMinedTx = (Transaction: React$Component<any, any>, name: strin
expect(hashParagraph).toContain(EMPTY_DATA) expect(hashParagraph).toContain(EMPTY_DATA)
} }
export const getListItemsFrom = (Transaction: React$Component<any, any>) => TestUtils.scryRenderedComponentsWithType(Transaction, ListItemText) export const getListItemsFrom = (Transaction: React.Component<any, any>) => TestUtils.scryRenderedComponentsWithType(Transaction, ListItemText)
export const expand = async (Transaction: React$Component<any, any>) => { export const expand = async (Transaction: React.Component<any, any>) => {
const listItems = getListItemsFrom(Transaction) const listItems = getListItemsFrom(Transaction)
if (listItems.length > 4) { if (listItems.length > 4) {
return return
@ -68,7 +68,7 @@ export const expand = async (Transaction: React$Component<any, any>) => {
} }
export const checkPendingTx = async ( export const checkPendingTx = async (
Transaction: React$Component<any, any>, Transaction: React.Component<any, any>,
safeThreshold: number, safeThreshold: number,
name: string, name: string,
statusses: string[], statusses: string[],

View File

@ -101,7 +101,7 @@ const deploySafe = async (createSafeForm: any, threshold: number, numOwners: num
} }
const aDeployedSafe = async (specificStore: Store<GlobalState>, threshold?: number = 1, numOwners?: number = 1) => { const aDeployedSafe = async (specificStore: Store<GlobalState>, threshold?: number = 1, numOwners?: number = 1) => {
const safe: React$Component<{}> = await renderOpenSafeForm(specificStore) const safe: React.Component<{}> = await renderOpenSafeForm(specificStore)
const safeAddress = await deploySafe(safe, threshold, numOwners) const safeAddress = await deploySafe(safe, threshold, numOwners)
return safeAddress return safeAddress

View File

@ -2,7 +2,7 @@
import * as React from 'react' import * as React from 'react'
type WrapperProps = { type WrapperProps = {
children: React$Node, children: React.Node,
} }
const Wrapper = ({ children }: WrapperProps) => <React.Fragment>{children}</React.Fragment> const Wrapper = ({ children }: WrapperProps) => <React.Fragment>{children}</React.Fragment>

View File

@ -37,7 +37,7 @@ type FinsihedTx = {
finishedTransaction: boolean, finishedTransaction: boolean,
} }
export const whenExecuted = (SafeDom: React$Component<any, any>, ParentComponent: React$ElementType): Promise<void> => new Promise((resolve, reject) => { export const whenExecuted = (SafeDom: React.Component<any, any>, ParentComponent: React.ElementType): Promise<void> => new Promise((resolve, reject) => {
let times = 0 let times = 0
const interval = setInterval(() => { const interval = setInterval(() => {
if (times >= MAX_TIMES_EXECUTED) { if (times >= MAX_TIMES_EXECUTED) {
@ -47,7 +47,7 @@ export const whenExecuted = (SafeDom: React$Component<any, any>, ParentComponent
// $FlowFixMe // $FlowFixMe
const SafeComponent = TestUtils.findRenderedComponentWithType(SafeDom, ParentComponent) const SafeComponent = TestUtils.findRenderedComponentWithType(SafeDom, ParentComponent)
type GnoStepperType = React$Component<FinsihedTx, any> type GnoStepperType = React.Component<FinsihedTx, any>
// $FlowFixMe // $FlowFixMe
const StepperComponent: GnoStepperType = TestUtils.findRenderedComponentWithType(SafeComponent, GnoStepper) const StepperComponent: GnoStepperType = TestUtils.findRenderedComponentWithType(SafeComponent, GnoStepper)
@ -64,8 +64,8 @@ type MiddleStep = {
} }
export const whenOnNext = ( export const whenOnNext = (
SafeDom: React$Component<any, any>, SafeDom: React.Component<any, any>,
ParentComponent: React$ElementType, ParentComponent: React.ElementType,
position: number, position: number,
): Promise<void> => new Promise((resolve, reject) => { ): Promise<void> => new Promise((resolve, reject) => {
let times = 0 let times = 0
@ -77,7 +77,7 @@ export const whenOnNext = (
// $FlowFixMe // $FlowFixMe
const SafeComponent = TestUtils.findRenderedComponentWithType(SafeDom, ParentComponent) const SafeComponent = TestUtils.findRenderedComponentWithType(SafeDom, ParentComponent)
type StepperType = React$Component<MiddleStep, any> type StepperType = React.Component<MiddleStep, any>
// $FlowFixMe // $FlowFixMe
const StepperComponent: StepperType = TestUtils.findRenderedComponentWithType(SafeComponent, Stepper) const StepperComponent: StepperType = TestUtils.findRenderedComponentWithType(SafeComponent, Stepper)
if (StepperComponent.props.activeStep === position) { if (StepperComponent.props.activeStep === position) {

View File

@ -4,14 +4,14 @@ import * as TestUtils from 'react-dom/test-utils'
import AddToken from '~/logic/tokens/component/AddToken' import AddToken from '~/logic/tokens/component/AddToken'
import { whenOnNext, whenExecuted } from '~/test/utils/logTransactions' import { whenOnNext, whenExecuted } from '~/test/utils/logTransactions'
export const clickOnAddToken = async (TokensDom: React$Component<any, any>) => { export const clickOnAddToken = async (TokensDom: React.Component<any, any>) => {
const buttons = TestUtils.scryRenderedDOMComponentsWithTag(TokensDom, 'button') const buttons = TestUtils.scryRenderedDOMComponentsWithTag(TokensDom, 'button')
expect(buttons.length).toBe(1) expect(buttons.length).toBe(1)
TestUtils.Simulate.click(buttons[0]) TestUtils.Simulate.click(buttons[0])
await sleep(400) await sleep(400)
} }
export const fillAddress = async (TokensDom: React$Component<any, any>, secondErc20Token: any) => { export const fillAddress = async (TokensDom: React.Component<any, any>, secondErc20Token: any) => {
// fill the form // fill the form
const AddTokenComponent = TestUtils.findRenderedComponentWithType(TokensDom, AddToken) const AddTokenComponent = TestUtils.findRenderedComponentWithType(TokensDom, AddToken)
if (!AddTokenComponent) throw new Error() if (!AddTokenComponent) throw new Error()
@ -28,7 +28,7 @@ export const fillAddress = async (TokensDom: React$Component<any, any>, secondEr
return whenOnNext(TokensDom, AddToken, 1) return whenOnNext(TokensDom, AddToken, 1)
} }
export const fillHumanReadableInfo = async (TokensDom: React$Component<any, any>) => { export const fillHumanReadableInfo = async (TokensDom: React.Component<any, any>) => {
// fill the form // fill the form
const AddTokenComponent = TestUtils.findRenderedComponentWithType(TokensDom, AddToken) const AddTokenComponent = TestUtils.findRenderedComponentWithType(TokensDom, AddToken)
if (!AddTokenComponent) throw new Error() if (!AddTokenComponent) throw new Error()

View File

@ -6,8 +6,8 @@ import { whenExecuted } from '~/test/utils/logTransactions'
import AddOwner from '~/routes/safe/components/AddOwner' import AddOwner from '~/routes/safe/components/AddOwner'
export const sendAddOwnerForm = async ( export const sendAddOwnerForm = async (
SafeDom: React$Component<any, any>, SafeDom: React.Component<any, any>,
addOwner: React$Component<any, any>, addOwner: React.Component<any, any>,
ownerName: string, ownerName: string,
ownerAddress: string, ownerAddress: string,
increase: boolean = false, increase: boolean = false,
@ -39,12 +39,12 @@ export const sendAddOwnerForm = async (
return whenExecuted(SafeDom, AddOwner) return whenExecuted(SafeDom, AddOwner)
} }
export const checkMinedAddOwnerTx = (Transaction: React$Component<any, any>, name: string) => { export const checkMinedAddOwnerTx = (Transaction: React.Component<any, any>, name: string) => {
checkMinedTx(Transaction, name) checkMinedTx(Transaction, name)
} }
export const checkPendingAddOwnerTx = async ( export const checkPendingAddOwnerTx = async (
Transaction: React$Component<any, any>, Transaction: React.Component<any, any>,
safeThreshold: number, safeThreshold: number,
name: string, name: string,
statusses: string[], statusses: string[],

View File

@ -6,8 +6,8 @@ import SendToken from '~/routes/safe/components/SendToken'
import { whenExecuted } from '~/test/utils/logTransactions' import { whenExecuted } from '~/test/utils/logTransactions'
export const sendMoveFundsForm = async ( export const sendMoveFundsForm = async (
SafeDom: React$Component<any, any>, SafeDom: React.Component<any, any>,
expandBalance: React$Component<any, any>, expandBalance: React.Component<any, any>,
value: string, value: string,
destination: string, destination: string,
) => { ) => {
@ -38,12 +38,12 @@ export const sendMoveFundsForm = async (
return whenExecuted(SafeDom, SendToken) return whenExecuted(SafeDom, SendToken)
} }
export const checkMinedMoveFundsTx = (Transaction: React$Component<any, any>, name: string) => { export const checkMinedMoveFundsTx = (Transaction: React.Component<any, any>, name: string) => {
checkMinedTx(Transaction, name) checkMinedTx(Transaction, name)
} }
export const checkPendingMoveFundsTx = async ( export const checkPendingMoveFundsTx = async (
Transaction: React$Component<any, any>, Transaction: React.Component<any, any>,
safeThreshold: number, safeThreshold: number,
name: string, name: string,
statusses: string[], statusses: string[],

View File

@ -11,8 +11,8 @@ import addTokens from '~/logic/tokens/store/actions/saveTokens'
import { calculateBalanceOf } from '~/routes/safe/store/actions/fetchTokenBalances' import { calculateBalanceOf } from '~/routes/safe/store/actions/fetchTokenBalances'
export const sendMoveTokensForm = async ( export const sendMoveTokensForm = async (
SafeDom: React$Component<any, any>, SafeDom: React.Component<any, any>,
expandBalance: React$Component<any, any>, expandBalance: React.Component<any, any>,
value: number, value: number,
destination: string, destination: string,
) => { ) => {
@ -64,12 +64,12 @@ export const dispatchTknBalance = async (store: Store, tokenAddress: string, add
fetchBalancesMock.mockRestore() fetchBalancesMock.mockRestore()
} }
export const checkMinedMoveTokensTx = (Transaction: React$Component<any, any>, name: string) => { export const checkMinedMoveTokensTx = (Transaction: React.Component<any, any>, name: string) => {
checkMinedTx(Transaction, name) checkMinedTx(Transaction, name)
} }
export const checkPendingMoveTokensTx = async ( export const checkPendingMoveTokensTx = async (
Transaction: React$Component<any, any>, Transaction: React.Component<any, any>,
safeThreshold: number, safeThreshold: number,
name: string, name: string,
statusses: string[], statusses: string[],

View File

@ -7,8 +7,8 @@ import { whenExecuted } from '~/test/utils/logTransactions'
import RemoveOwner from '~/routes/safe/components/RemoveOwner' import RemoveOwner from '~/routes/safe/components/RemoveOwner'
export const sendRemoveOwnerForm = async ( export const sendRemoveOwnerForm = async (
SafeDom: React$Component<any, any>, SafeDom: React.Component<any, any>,
expandOwners: React$Component<any, any>, expandOwners: React.Component<any, any>,
) => { ) => {
// Expand owners // Expand owners
TestUtils.Simulate.click(expandOwners) TestUtils.Simulate.click(expandOwners)
@ -34,12 +34,12 @@ export const sendRemoveOwnerForm = async (
return whenExecuted(SafeDom, RemoveOwner) return whenExecuted(SafeDom, RemoveOwner)
} }
export const checkMinedRemoveOwnerTx = (Transaction: React$Component<any, any>, name: string) => { export const checkMinedRemoveOwnerTx = (Transaction: React.Component<any, any>, name: string) => {
checkMinedTx(Transaction, name) checkMinedTx(Transaction, name)
} }
export const checkPendingRemoveOwnerTx = async ( export const checkPendingRemoveOwnerTx = async (
Transaction: React$Component<any, any>, Transaction: React.Component<any, any>,
safeThreshold: number, safeThreshold: number,
name: string, name: string,
statusses: string[], statusses: string[],

View File

@ -7,8 +7,8 @@ import Threshold from '~/routes/safe/components/Threshold'
import { whenExecuted } from '~/test/utils/logTransactions' import { whenExecuted } from '~/test/utils/logTransactions'
export const sendChangeThresholdForm = async ( export const sendChangeThresholdForm = async (
SafeDom: React$Component<any, any>, SafeDom: React.Component<any, any>,
changeThreshold: React$Component<any, any>, changeThreshold: React.Component<any, any>,
threshold: string, threshold: string,
) => { ) => {
// Load the Threshold Form // Load the Threshold Form
@ -29,7 +29,7 @@ export const sendChangeThresholdForm = async (
return whenExecuted(SafeDom, Threshold) return whenExecuted(SafeDom, Threshold)
} }
export const checkMinedThresholdTx = (Transaction: React$Component<any, any>, name: string) => { export const checkMinedThresholdTx = (Transaction: React.Component<any, any>, name: string) => {
checkMinedTx(Transaction, name) checkMinedTx(Transaction, name)
} }