-
Notifications
You must be signed in to change notification settings - Fork 80
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
Fix all broken tests #484
Fix all broken tests #484
Conversation
- reactstrap UncontrolledTooltip searches the document object for ids at first render, by adding invisible divs with the required ids th tests will pass and on render the tooltips will be correctly applied to the tests' correct buttons reactstrap/reactstrap#773 (comment) - Update snaps
Thanks @Kornil for the submission! 🎉 I will have a look at it and comment here in case of any change request! |
Thank you for the feedback @dej611, and sorry for the late reply, I'm having a busy week. I might be able to use this to make it look a bit better but it will look very similar. Let me know your opinion. |
I see. |
I could not find a way to use createNodeMock to fix these tests so I opted for a clear To reduce codebase pollution, I moved all the fixes to the respective @dej611 let me know what you think. While exploring I found a few more issues to address around testing but I will open new PRs so this one stays scoped to only fix the broken tests. |
I checked out your last commits, while they are much better in a code prospective, they pose an issue with the Storybook tool. For instance, take this Storybook component: const AvatarLinkWithTooltipFix = () => {
// TODO find a better way to handle this
// Storyshot does not use the dom so can't render refs
// to fix the problem we append the elements manually
// this fixes tests without touching the rendered components
// nor storybook
// https://github.com/storybookjs/storybook/issues/886
// https://github.com/infinitered/addon-storyshots#using-createnodemock-to-mock-refs
ids.map((id, i) => {
const div = document.createElement('div')
div.setAttribute('id', id)
document.body.appendChild(div)
})
return <AvatarLinkWithTooltip />
} While this looks much better as the original source code is untouched, in the Storybook info panel this is the actual source code that will be shown :( May I propose to rollback the last 3 commits and add the comments on the stories themselves? I know its a step back from before but at least we can give users some directions about the specific context and to ignore those lines for their development. |
Thank you for the feedback, I reverted the last 3 commits and added the comments where I placed the fix originally. |
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.
Good job @Kornil 👍
Fixes #23
PR Checklist
master
branch.I have added necessary documentation (if appropriate)Short description of what this resolves:
master
) and the snapshots not updated.stories/Tooltip/Tooltip.stories.js
. ReactstrapUncontrolledTooltip
tries to queries thebody
, since we don't have one being in a test environment, I simulated having it with the correct ids.This fixes the test while not changing the stories. Storybook still behaves as it should, using the rendered elements to display tooltips.
see Tooltip cannot find ID of a React element rendered next to it reactstrap/reactstrap#773 (comment) for the issue.
stories/Avatar/AvatarLinkWithTooltip.js
stories/Templates/servizi/Servizi.js
Open to feedback.
master
) mentre gli snapshot no.stories/Tooltip/Tooltip.stories.js
. ReactstrapUncontrolledTooltip
cerca gliid
su body e non trovandoli manda in errore prima di poter vedere gli elementi corretti. Come fix ho simulato gli id su div invisibili su document, questo fixa i test senza cambiare niente su storybook. Tutti i tooltip continuano a funzionare sugli elementi specificati inizialmente.Tooltip cannot find ID of a React element rendered next to it reactstrap/reactstrap#773 (comment) per il problema.
stories/Avatar/AvatarLinkWithTooltip.js
stories/Templates/servizi/Servizi.js
Fatemi sapere.