-
Notifications
You must be signed in to change notification settings - Fork 735
TextField - create new driver and refactor tests to it #2890
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
Conversation
@@ -5,7 +5,7 @@ import {usePressableDriver} from '../../testkit/new/usePressable.driver'; | |||
export const TextDriver = (props: ComponentProps) => { | |||
const driver = usePressableDriver<TextProps>(useComponentDriver(props)); | |||
|
|||
const getText = () => { | |||
const getText = (): React.ReactNode | undefined => { |
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.
Doesn't it suppose to return a string?
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.
I thought so, and then I saw it does not, although I think we do compare it to string in tests, maybe we should return as string | undefined
so it's more clear?
I am really not sure
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.
Let's see if it meets us when we or others use it..
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.
As you've mentioned, this can technically be a Text
child
import View from '../../../components/view'; | ||
import {TextFieldDriver} from '../TextField.driver'; | ||
import {TextFieldDriver} from '../TextField.driver.new'; |
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.
Let's remove the old file
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.
I think we can't do it yet because we still have other components that depend on the old ones.
import _ from 'lodash'; | ||
import {fireEvent} from '@testing-library/react-native'; | ||
import {TextFieldProps} from './types'; | ||
import {useComponentDriver, ComponentProps} from '../../testkit/new/Component.driver'; |
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.
Is this a good name for the driver arguments? Perhaps ComponentDriverArguments or DriverArguments will be better?
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.
If you're talking about ComponentProps
then this is not the PR to change it; feel free to create a PR for it.
Description
TextField - create new driver and refactor tests to it
Changelog
TextField - create new driver and refactor tests to it
Additional info
None