From e6e2369d24dae13878badd13e7070fc6c44a7087 Mon Sep 17 00:00:00 2001 From: Liad Idan Date: Sat, 24 Nov 2018 13:46:14 +0200 Subject: [PATCH] fix(module:menu): fix dropdown menu item selected className (#2434) close #2433 --- components/dropdown/nz-dropdown.spec.ts | 11 ++++++++++- components/menu/nz-menu-item.directive.ts | 17 +++++++++++++---- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/components/dropdown/nz-dropdown.spec.ts b/components/dropdown/nz-dropdown.spec.ts index d8b4acb5d7d..e85604acfea 100644 --- a/components/dropdown/nz-dropdown.spec.ts +++ b/components/dropdown/nz-dropdown.spec.ts @@ -133,6 +133,14 @@ describe('dropdown', () => { expect(items[ 0 ].classList.contains('ant-dropdown-menu-item')).toBe(true); expect(items[ 0 ].classList.contains('ant-dropdown-menu-item-selected')).toBe(false); }); + it('should append the correct className', () => { + testComponent.visible = true; + testComponent.itemSelected = true; + fixture.detectChanges(); + const items = overlayContainerElement.querySelectorAll('.ant-dropdown-menu-item') as NodeListOf; + expect(items[ 0 ].classList.contains('.ant-menu-item-selected')).toBe(false); + expect(items[ 0 ].classList.contains('ant-dropdown-menu-item-selected')).toBe(true); + }); it('should backdrop work with click', () => { testComponent.trigger = 'click'; fixture.detectChanges(); @@ -390,7 +398,7 @@ describe('dropdown', () => { Hover me