-
Notifications
You must be signed in to change notification settings - Fork 1.2k
[Test Modernization]: Add test modernization to Truncate and UnstyledButton #4327
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
size-limit report
|
BPScott
left a comment
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.
Two little thinks noted inline. Other than that all looks good to me!
| const button = mountWithAppProvider(<UnstyledButton external />); | ||
| expect(button.find('button').prop('external')).toBeUndefined(); | ||
| const button = mountWithApp(<UnstyledButton external />); | ||
| expect(button).toContainReactComponent('button'); |
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.
This should test for the absence of external
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.
Hi! Yes, I wasn't sure about this one, for that reason I opened but I didn't add anyone yet until I solve it now that I came back from vacation. My doubt is because external is only used in the UnstyledLink that appears when external is passed. If it is not passed, it renders a button (For that reason, I was asserting by checking the button. I was thinking to add an not.renders around the UnstyledLink with undefined external). If I insert this as a prop, VSCode says that external doesn't exist in button and for that reason I cannot do the assertion.
. Same with the one below. Do you have any suggestion around this?
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 updated the PR with the idea i had in mind, let me know what do you think @BPScott
| <UnstyledButton url={mockUrl} external disabled />, | ||
| ); | ||
| expect(button.find('a').prop('external')).toBeUndefined(); | ||
| expect(button).toContainReactComponent('a'); |
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.
This should test for the absence of external
b6a356a to
40263bc
Compare
…Button (#4327) * Add test modernization to Truncate and UnstyledButton * Add changes to unstyledbutton related to disabled and download
WHY are these changes introduced?
I am updating existing tests for
TruncateandUnstyledButtoncomponents to use the new modern framework.WHAT is this pull request doing?
Part of test modernization (https://docs.google.com/spreadsheets/d/1GBuEZbOpVYJLNISK7gL69DU8rCxocn5L5GYaKtPXPbU/edit#gid=1498187033), updating tests using {mountWithAppProvider} from 'test-utilities/legacy' to {mountWithApp} from 'test-utilities'.