test: add ErrorModal tests and story#2325
Conversation
lindapaiste
left a comment
There was a problem hiding this comment.
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.
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.
The action wasn't picked up with this 😞 so left that argType.
There was a problem hiding this comment.
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.
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.
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.
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)developbranch.Fixes #123