-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
test: add ErrorModal tests and story #2325
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
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.
Looks good. I have some specific feedback but there's nothing here that's a problem.
'staleSession', | ||
'staleProject', | ||
'oauthError' | ||
], |
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 think it might be better to define these options in the propTypes
of the component rather than here. If we do it that way then Storybook will pick up on the options automatically and we'll also get the validation in prop-types
.
ErrorModal.propTypes = {
type: PropTypes.oneOf([
'forceAuthentication',
'staleSession',
'staleProject',
'oauthError'
]).isRequired,
closeModal: PropTypes.func.isRequired,
service: PropTypes.oneOf(['google', 'github'])
};
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.
The action wasn't picked up with this 😞 so left that argType.
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.
Yeah when I was playing around with it I left the closeModal
in. I'm not aware of a trick for those, at least not yet.
FYI, if you want to keep it as a dropdown rather than radio buttons (I don't think it matters?) then you can provide a partial config like service: { control: { type: 'select' } }
which specifies the control
and it will still infer the options
.
} | ||
}; | ||
|
||
const Template = (args) => <ErrorModal {...args} />; |
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.
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.
Oh interesting. I'm still familiarising myself with the components in the application. I was wondering where the overlay was 😄 It would make a nicer story seeing the modal represented with the overlay.
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 have to try it again after the theming changes in #2326. I think the way that they SCSS gets generated is that it creates selectors like .light .overlay
and .dark .overlay
but not just .overlay
. So it's possible that the overlay UI will work once it's inside the right parent container.
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.
Honestly it feels like a bit of a naming mistake that this is called ErrorModal
when it doesn't include the modal part. Really it's more of an ErrorMessage
!
It could potentially be modified so that it takes the overlay's title
and ariaLabel
as props and renders both the Overlay
and the message.
No issue number
Changes:
Adds tests and Storybook story around the ErrorModal component
I have verified that this pull request:
npm run lint
)npm run test
)develop
branch.Fixes #123