Skip to content

Commit

Permalink
fix: remove hardcoded intervals from the test
Browse files Browse the repository at this point in the history
  • Loading branch information
kirillzyusko committed Nov 19, 2024
1 parent ca40573 commit 868d1ac
Show file tree
Hide file tree
Showing 8 changed files with 588 additions and 539 deletions.
5 changes: 5 additions & 0 deletions src/components/MoneyRequestAmountInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ type MoneyRequestAmountInputProps = {

/** The width of inner content */
contentWidth?: number;

/** The testID of the input. Used to locate this view in end-to-end tests. */
testID?: string;
};

type Selection = {
Expand Down Expand Up @@ -127,6 +130,7 @@ function MoneyRequestAmountInput(
shouldKeepUserInput = false,
autoGrow = true,
contentWidth,
testID,
...props
}: MoneyRequestAmountInputProps,
forwardedRef: ForwardedRef<BaseTextInputRef>,
Expand Down Expand Up @@ -337,6 +341,7 @@ function MoneyRequestAmountInput(
onMouseDown={handleMouseDown}
onMouseUp={handleMouseUp}
contentWidth={contentWidth}
testID={testID}

Check failure on line 344 in src/components/MoneyRequestAmountInput.tsx

View workflow job for this annotation

GitHub Actions / typecheck

Type '{ autoGrow: boolean; disableKeyboard: boolean; formattedAmount: string; onChangeAmount: (newAmount: string) => void; onCurrencyButtonPress: (() => void) | undefined; onBlur: () => void; placeholder: string; ... 18 more ...; testID: string | undefined; }' is not assignable to type 'IntrinsicAttributes & Omit<BaseTextInputWithCurrencySymbolProps, "onSelectionChange"> & { onSelectionChange?: ((start: number, end: number) => void) | undefined; } & RefAttributes<...>'.
/>
);
}
Expand Down
File renamed without changes.
534 changes: 534 additions & 0 deletions src/components/TextInput/BaseTextInput/implementation/index.tsx

Large diffs are not rendered by default.

26 changes: 26 additions & 0 deletions src/components/TextInput/BaseTextInput/index.e2e.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import type {ForwardedRef} from 'react';
import React, {forwardRef, useEffect} from 'react';
import {DeviceEventEmitter} from 'react-native';
import BaseTextInput from './implementation';
import type {BaseTextInputProps, BaseTextInputRef} from './types';

function BaseTextInputE2E(props: BaseTextInputProps, ref: ForwardedRef<BaseTextInputRef>) {
useEffect(() => {
const testId = props.testID;
if (!testId) {
return;
}
console.debug(`[E2E] BaseTextInput: text-input with testID: ${testId} changed text to ${props.value}`);

DeviceEventEmitter.emit('onChangeText', {testID: testId, value: props.value});
}, [props.value, props.testID]);

return (
<BaseTextInput
ref={ref}
{...props}
/>
);
}

export default forwardRef(BaseTextInputE2E);
Loading

0 comments on commit 868d1ac

Please sign in to comment.