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


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.

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.
@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