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

Navigation: add unit tests and refactor AMP constants #4968

Merged
merged 10 commits into from
Dec 19, 2019

Conversation

tochwill
Copy link
Contributor

@tochwill tochwill commented Dec 16, 2019

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:

  • A bullet point list of key code changes that have been made.
  • When describing code changes, try to communicate how and why you implemented something a specific way, not just what has changed.

  • I have assigned myself to this PR and the corresponding issues
  • I have added labels to this PR for the relevant pod(s) affected by these changes
  • I have assigned this PR to the Simorgh project

Testing:

  • Automated (jest and/or cypress) tests added (for new features) or updated (for existing features)
  • If necessary, I have run the local E2E non-smoke tests relevant to my changes (CYPRESS_APP_ENV=local CYPRESS_SMOKE=false npm run test:e2e:interactive)
  • This PR requires manual testing

@tochwill tochwill changed the title Navigation unit tests Navigation: add unit tests and refactor AMP constants Dec 16, 2019
@tochwill tochwill self-assigned this Dec 16, 2019
const dropdownListItems = (
// Hidden attribute is added if we're on amp because the amp toggleVisibility
Copy link
Contributor

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 })} .

Copy link
Contributor Author

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"
Copy link
Contributor

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.

Copy link
Contributor

@Bopchy Bopchy Dec 17, 2019

Choose a reason for hiding this comment

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

Wondering if removing skipLink from the Navigation should be done on this PR? Update: Seen that this is being handled here

Copy link
Contributor

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.

Copy link
Contributor Author

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"
/>
);

Copy link
Contributor

@Bopchy Bopchy Dec 17, 2019

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?

@AlistairGempf AlistairGempf mentioned this pull request Dec 17, 2019
4 tasks
Copy link
Contributor

@Bopchy Bopchy left a comment

Choose a reason for hiding this comment

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

LGTM 👍

Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

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

Jenkins is failing. Could be cause of the failing Brand container test.
Screenshot 2019-12-19 at 10 52 07

@tochwill
Copy link
Contributor Author

@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

@ghost
Copy link

ghost commented Dec 19, 2019

@tochwill Ok. That makes sense.

Copy link

@ghost ghost left a 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. 👍

@tochwill tochwill merged commit 4fb649c into integrate-new-navigation Dec 19, 2019
@tochwill tochwill deleted the navigation-unit-tests branch December 19, 2019 10:13
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.

3 participants