Skip to content

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

Merged
merged 7 commits into from
Jan 16, 2024

Conversation

M-i-k-e-l
Copy link
Collaborator

Description

TextField - create new driver and refactor tests to it

Changelog

TextField - create new driver and refactor tests to it

Additional info

None

@M-i-k-e-l M-i-k-e-l added this to the Quality milestone Jan 14, 2024
@M-i-k-e-l M-i-k-e-l marked this pull request as draft January 15, 2024 08:26
@M-i-k-e-l M-i-k-e-l marked this pull request as ready for review January 15, 2024 12:16
@@ -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 => {
Copy link
Collaborator

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?

Copy link
Collaborator Author

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

Copy link
Collaborator

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..

Copy link
Collaborator Author

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';
Copy link
Collaborator

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

Copy link
Collaborator Author

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.

@M-i-k-e-l M-i-k-e-l requested a review from ethanshar January 15, 2024 14:48
import _ from 'lodash';
import {fireEvent} from '@testing-library/react-native';
import {TextFieldProps} from './types';
import {useComponentDriver, ComponentProps} from '../../testkit/new/Component.driver';
Copy link
Collaborator

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?

Copy link
Collaborator Author

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.

@M-i-k-e-l M-i-k-e-l requested a review from nitzanyiz January 16, 2024 08:52
@ethanshar ethanshar merged commit 35d588f into master Jan 16, 2024
@M-i-k-e-l M-i-k-e-l deleted the infra/testing-text-field-new-driver branch January 16, 2024 10:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants