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

test(button): add tests for button internals #4891

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

43081j
Copy link
Contributor

@43081j 43081j commented Sep 10, 2023

This just adds some tests for the underlying button implementation

can you let me know if this is how you've been testing internals? so i can keep it consistent with the rest of the repo

basically i used text-button for sake of getting a button but tested the internal behaviour all of them have

root?.remove();
});

it('renders inner button', async () => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

These tests seem really granular and test the implementation rather than the functionality.

What sort of value are we hoping to get out of these tests?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we don't seem to have any button tests yet.

i agree these are fairly granular as they are basically asserting we rendered what we expected to render.

you could try test from the outside instead, e.g. test that a button with a href is clickable as a link. though that seems we will just end up back here with less assertions (but the same remaining assertions).

one way or another, in that example, you have to test that the href actually resulted in something. so you have to assert we opened the link after clicking the button, or that the link existed in DOM.

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.

None yet

2 participants