Skip to content

Commit

Permalink
fix(abc:sidebar-nav): fix invalid click children title in collap… (#673)
Browse files Browse the repository at this point in the history
  • Loading branch information
cipchk committed Aug 29, 2019
1 parent b77f2cb commit b6c1fc6
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/abc/sidebar-nav/sidebar-nav.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@ export class SidebarNavComponent implements OnInit, OnDestroy {
return false;
}
const id = +linkNode.dataset!.id!;
// Should be ingore children title trigger event
if (isNaN(id)) {
return false;
}

let item: Nav;
this.menuSrv.visit(this._d, i => {
if (!item && i.__id === id) {
Expand Down
12 changes: 12 additions & 0 deletions packages/abc/sidebar-nav/sidebar-nav.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,18 @@ describe('abc: sidebar-nav', () => {
page.showSubMenu();
expect(page.getEl('.sidebar-nav__floating-container .sidebar-nav__item', true) != null).toBe(true);
});
it('should be ingore children title trigger event', () => {
spyOn(context, 'select');
expect(context.select).not.toHaveBeenCalled();
const mockMenu = deepCopy(MOCKMENUS) as Nav[];
mockMenu[0].children![0].children = [{ text: 'a', children: [{ text: 'b' }] }];
menuSrv.add(mockMenu);
fixture.detectChanges();
page.showSubMenu();
const containerEl = page.getEl<HTMLElement>(floatingShowCls, true)!;
(containerEl.querySelector('.sidebar-nav__item-link') as HTMLElement).click();
expect(context.select).not.toHaveBeenCalled();
});
});
describe('should be hide sub-menu in floating container', () => {
it('muse be hide via click menu link', () => {
Expand Down

0 comments on commit b6c1fc6

Please sign in to comment.