-
Notifications
You must be signed in to change notification settings - Fork 229
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
Navigation: add unit tests and refactor AMP constants #4968
Conversation
const dropdownListItems = ( | ||
// Hidden attribute is added if we're on amp because the amp toggleVisibility |
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 comment was added by Alistair after the swarm review to explain the usage of the hidden
attribute. I would keep it and put it before the {cloneElement(dropdownListItems, { id: DROPDOWN_ID, hidden: true })}
.
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.
Sure, I'll add a comment back in :)
<Navigation | ||
scrollableListItems={scrollableListItems} | ||
dropdownListItems={dropdownListItems} | ||
skipLinkText="skip link" |
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.
We don't need to pass the Skip link
to the Navigation anymore, since it will be handled by the Brand
.
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.
You can remove it from the NavigationContainer
, but still, we don't need to pass it in this PR.
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 spot - I missed that this was still being passed.
dir="ltr" | ||
/> | ||
); | ||
|
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.
Could we put scrollableTestId
, dropdownTestId
, scrollableListItems
, dropdownListItems
and navigation
in a file, and imported them here and in src/app/containers/Navigation/index.amp.test.jsx
- as they are mostly similar?
Co-Authored-By: sadickisaac <[email protected]>
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.
LGTM 👍
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.
@sadickisaac we left the brand container test failing in the feature branch, to ensure that we couldn't merge this into latest until we added the skip to content link back into the brand container |
@tochwill Ok. That makes sense. |
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 looks really good. 👍
Resolves #NUMBER
Overall change:
Writes unit tests for the navigation, and applies code review feedback for AMP constants and converting repeated component composition into a reusable function.
Code changes:
Testing:
CYPRESS_APP_ENV=local CYPRESS_SMOKE=false npm run test:e2e:interactive
)