From e20a72280b08431c4f7c139f32a8719dc171f885 Mon Sep 17 00:00:00 2001 From: Ward Bell Date: Sat, 15 Apr 2017 00:37:41 -0700 Subject: [PATCH] feat(aio): when select node in sidebar close other expanded nodes --- aio/e2e/app.e2e-spec.ts | 7 +++++-- aio/src/app/layout/nav-item/nav-item.component.ts | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/aio/e2e/app.e2e-spec.ts b/aio/e2e/app.e2e-spec.ts index b5271d6041..1955dc777f 100644 --- a/aio/e2e/app.e2e-spec.ts +++ b/aio/e2e/app.e2e-spec.ts @@ -15,7 +15,7 @@ describe('site App', function() { expect(page.getDocViewerText()).toMatch(/Progressive web apps/i); }); - it('should show the tutorial index page at `/tutorial/`', () => { + it('should show the tutorial index page at `/tutorial/` after jitterbugging through features', () => { // check that we can navigate directly to the tutorial page page.navigateTo('tutorial/'); expect(page.getDocViewerText()).toMatch(/Tutorial: Tour of Heroes/i); @@ -24,9 +24,12 @@ describe('site App', function() { page.getLink('features').click(); expect(page.getDocViewerText()).toMatch(/Features/i); - // Show the menu; the tutorial section should be fully open from previous visit + // Show the menu page.docsMenuLink.click(); + // Open the tutorial header + page.getNavItem(/tutorial/i).click(); + // Navigate to the tutorial introduction via a link in the sidenav page.getNavItem(/introduction/i).click(); expect(page.getDocViewerText()).toMatch(/Tutorial: Tour of Heroes/i); diff --git a/aio/src/app/layout/nav-item/nav-item.component.ts b/aio/src/app/layout/nav-item/nav-item.component.ts index 55189fcaec..dbea4784db 100644 --- a/aio/src/app/layout/nav-item/nav-item.component.ts +++ b/aio/src/app/layout/nav-item/nav-item.component.ts @@ -17,7 +17,7 @@ export class NavItemComponent implements OnChanges { ngOnChanges(changes: SimpleChanges) { if (changes['selectedNodes'] || changes['node']) { this.isSelected = this.selectedNodes.indexOf(this.node) !== -1; - this.isExpanded = this.isExpanded || this.isSelected; + this.isExpanded = this.isSelected; } this.setClasses(); }