Skip to content

Commit

Permalink
fix test failures
Browse files Browse the repository at this point in the history
  • Loading branch information
Michail Yasonik committed May 12, 2020
1 parent 040ad2d commit d5d564c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions src/core/public/chrome/ui/header/collapsible_nav.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,14 @@ function mockProps() {
};
}

function expectNavLinksCount(component: ReactWrapper, count: number) {
function expectShownNavLinksCount(component: ReactWrapper, count: number) {
expect(
component.find('.euiAccordion-isOpen a[data-test-subj="collapsibleNavAppLink"]').length
component.find('.euiAccordion-isOpen a[data-test-subj^="collapsibleNavAppLink"]').length
).toEqual(count);
}

function expectNavIsClosed(component: ReactWrapper) {
expectNavLinksCount(component, 0);
expectShownNavLinksCount(component, 0);
}

function clickGroup(component: ReactWrapper, group: string) {
Expand Down Expand Up @@ -137,14 +137,14 @@ describe('CollapsibleNav', () => {
recentNavLinks={recentNavLinks}
/>
);
expectNavLinksCount(component, 3);
expectShownNavLinksCount(component, 3);
clickGroup(component, 'kibana');
clickGroup(component, 'recentlyViewed');
expectNavLinksCount(component, 1);
expectShownNavLinksCount(component, 1);
component.setProps({ isOpen: false });
expectNavIsClosed(component);
component.setProps({ isOpen: true });
expectNavLinksCount(component, 1);
expectShownNavLinksCount(component, 1);
});

it('closes the nav after clicking a link', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/core/public/chrome/ui/header/collapsible_nav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ export function CollapsibleNav({
// TODO #64541
// Can remove icon from recent links completely
listItems={recentNavLinks.map(({ iconType, onClick = () => {}, ...link }) => ({
'data-test-subj': 'collapsibleNavAppLink',
'data-test-subj': 'collapsibleNavAppLink--recent',
onClick: (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => {
onIsOpenUpdate(false);
onClick(e);
Expand Down

0 comments on commit d5d564c

Please sign in to comment.