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

feat(menu): apply default values for menuItems #344

Merged
merged 1 commit into from
Apr 5, 2018

Conversation

mishkolesnikov
Copy link
Contributor

Apply defaults for menu items

  • fix logic for inference of selected items from URL for fragment and queryParams cases
  • e2e tests for fragment and queryParams in menu

@mishkolesnikov mishkolesnikov requested a review from nnixaa April 3, 2018 10:52

ngOnInit() {
this.menuService
.onItemClick()
.pipe(takeWhile(() => this.alive))
.subscribe((data: { tag: string; item: NbMenuItem }) => console.info(data));
.subscribe((data: { tag: string; item: NbMenuItem }) => {}); // console.info(data));
Copy link
Collaborator

Choose a reason for hiding this comment

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

what's the meaning of this change?

(exact && location === item.link) ||
(!exact && location.includes(item.link)) ||
(exact && item.fragment && location.substr(location.indexOf('#') + 1).includes(item.fragment))
const selected = (
Copy link
Collaborator

Choose a reason for hiding this comment

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

how about we divide this logic into smaller helpers or even a separate helper class? and create a unit test for it.

@mishkolesnikov mishkolesnikov force-pushed the feature/menu-items-defaults branch from 9350d58 to 2818682 Compare April 3, 2018 15:22
@mishkolesnikov mishkolesnikov force-pushed the feature/menu-items-defaults branch from 2818682 to 36a2e91 Compare April 4, 2018 11:20
@mishkolesnikov mishkolesnikov removed the WIP label Apr 4, 2018
BREAKING CHANGES: URL fragment no longer affect menu items selection.
Now we olny find mathes between path part of the URL and `link` property of menu-item.
@mishkolesnikov mishkolesnikov force-pushed the feature/menu-items-defaults branch from 36a2e91 to da792c6 Compare April 4, 2018 15:59
@nnixaa nnixaa merged commit 674eef5 into akveo:master Apr 5, 2018
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.

2 participants