feat(aio): when select node in sidebar close other expanded nodes

This commit is contained in:
Ward Bell 2017-04-15 00:37:41 -07:00 committed by Pete Bacon Darwin
parent abecf3eb6d
commit e20a72280b
2 changed files with 6 additions and 3 deletions

View File

@ -15,7 +15,7 @@ describe('site App', function() {
expect(page.getDocViewerText()).toMatch(/Progressive web apps/i); 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 // check that we can navigate directly to the tutorial page
page.navigateTo('tutorial/'); page.navigateTo('tutorial/');
expect(page.getDocViewerText()).toMatch(/Tutorial: Tour of Heroes/i); expect(page.getDocViewerText()).toMatch(/Tutorial: Tour of Heroes/i);
@ -24,9 +24,12 @@ describe('site App', function() {
page.getLink('features').click(); page.getLink('features').click();
expect(page.getDocViewerText()).toMatch(/Features/i); 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(); page.docsMenuLink.click();
// Open the tutorial header
page.getNavItem(/tutorial/i).click();
// Navigate to the tutorial introduction via a link in the sidenav // Navigate to the tutorial introduction via a link in the sidenav
page.getNavItem(/introduction/i).click(); page.getNavItem(/introduction/i).click();
expect(page.getDocViewerText()).toMatch(/Tutorial: Tour of Heroes/i); expect(page.getDocViewerText()).toMatch(/Tutorial: Tour of Heroes/i);

View File

@ -17,7 +17,7 @@ export class NavItemComponent implements OnChanges {
ngOnChanges(changes: SimpleChanges) { ngOnChanges(changes: SimpleChanges) {
if (changes['selectedNodes'] || changes['node']) { if (changes['selectedNodes'] || changes['node']) {
this.isSelected = this.selectedNodes.indexOf(this.node) !== -1; this.isSelected = this.selectedNodes.indexOf(this.node) !== -1;
this.isExpanded = this.isExpanded || this.isSelected; this.isExpanded = this.isSelected;
} }
this.setClasses(); this.setClasses();
} }