Skip to content
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

[Verify] Update new-architecture input fields on base screens to pass through all textfield props #461

Merged
merged 12 commits into from
Sep 13, 2023

Conversation

manojleaton
Copy link
Contributor

Fixes #BLUI-4302 .

Changes proposed in this Pull Request:

  • Added TextFieldProps type in setPassword, VerifyCodeScreenBase, ChangePasswordDialog and ForgotPasswordScreen.

To Test:

  • yarn start:example

Any specific feedback you are looking for?

@github-actions github-actions bot added the brightlayer-ui Used to identify Brightlayer UI platform issues for easy filtering label Sep 4, 2023
@github-actions
Copy link

github-actions bot commented Sep 4, 2023

Visit the preview URL for this PR (updated for commit 7501b30):

https://blui-react-login--pr461-4302-adding-textfi-dox9hmyf.web.app

(expires Fri, 15 Sep 2023 10:35:14 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: 1e9064d2e35ed37fe01e053587ea5f209719a043

@@ -99,6 +100,7 @@ export const ChangePasswordDialogBase: React.FC<ChangePasswordDialogProps> = (pr
id="current-password"
label={currentPasswordLabel}
value={currentPassword}
{...currentPasswordTextFieldProps}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@huayunh
Copy link
Contributor

huayunh commented Sep 7, 2023

And ensure you update docs too, including the readmes and jsdocs

@@ -84,13 +86,15 @@ export const SetPassword: React.FC<React.PropsWithChildren<SetPasswordProps>> =
inputRef={passwordRef}
label={newPasswordLabel}
value={passwordInput}
error={shouldValidatePassword && !isValidPassword()}
sx={TextFieldStyles(theme)}
{...passwordTextFieldProps}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any particular reason the passwordTextFieldProps is spreaded here as opposed to spreaded towards the end of this props list? I'd like to hear your reasoning.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same for the other spreads you added in this pull request

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To override the defaults which we set in the base screen components, spreaded the TextFieldProps towards the end of the props list.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not understand. I see that you still have onChange, onKeyUp and onBlur under the {...passwordTextFieldProps}, so this is not the end of the props list of PasswordTextField?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just had a discussion with Joe in Office hours regarding this, so we need to merge events with TextFieldProps like we did for WorkFlowActions.

Copy link
Collaborator

@surajeaton surajeaton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please resolve the conflicts.

Copy link
Collaborator

@surajeaton surajeaton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please resolve the conflicts.

onChange={(evt: ChangeEvent<HTMLInputElement>): void => onPassChange(evt.target.value)}
error={shouldValidatePassword && !isValidPassword()}
sx={TextFieldStyles(theme)}
{...passwordTextFieldProps}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just so I know, why do we have both of these? just for theme aware items? plus additional sx styles?
sx={TextFieldStyles(theme)}
{...passwordTextFieldProps}

Copy link
Contributor Author

@manojleaton manojleaton Sep 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Raised a PR for removed passing theme object to functions to generate styles. sx prop is for adding styles.
Spreading passwordTextFieldProps to pass text field specific props. Like variant, onChange and etc.

@JeffGreiner-eaton
Copy link
Collaborator

JeffGreiner-eaton commented Sep 12, 2023

Just putting this here so we all know...

Confused when running tests locally with yarn test and running the one test file.

locally when running yarn test I see failed test here...

image image

and notice the test error description doesn't match the test I found that can't find the role input. The actual test with description "should show success screen, when okay button is clicked" has no findAllByRole in it but the previous test does, very strange
Not sure about the findAllByRole because the output from the test only finds these roles.

image image image

when I run only the test file itself the test passes and also passes in circleCI.

the findAllByRole query is searching the entire DOM and this is known as a slow running query because of that. We will need to keep an eye on these types of queries and be more direct by using getByRole

@manojleaton manojleaton merged commit e57a6c5 into dev Sep 13, 2023
1 check passed
@manojleaton manojleaton deleted the 4302---adding-textfield-props branch September 13, 2023 10:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
brightlayer-ui Used to identify Brightlayer UI platform issues for easy filtering
Development

Successfully merging this pull request may close these issues.

5 participants