Skip to content

Commit

Permalink
add test for info icon
Browse files Browse the repository at this point in the history
  • Loading branch information
andrico1234 committed Nov 13, 2019
1 parent 4e9b18b commit 3a89eba
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/components/__tests__/SkillTree.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ const defaultStoreContents = {
};

function renderComponent(props: Props) {
const modalRoot = document.createElement('div');
modalRoot.setAttribute('id', 'modal-root');
document.body.appendChild(modalRoot);

let selectedSkillCount: SkillCount;
let resetSkills: VoidFunction;

Expand Down Expand Up @@ -413,6 +417,27 @@ describe('SkillTree', () => {
});
});

describe('Description', () => {
it('should not display info icon if no description is passed through', () => {
const { queryByText } = renderComponent(defaultProps);

expect(queryByText('ⓘ')).toBeNull();
});

it('should display on hover', () => {
const props = {
...defaultProps,
description: 'this is the description boys',
};

const { getByText } = renderComponent(props);

const infoIcon = getByText('ⓘ');

expect(infoIcon).toBeTruthy();
});
});

describe('resizing', () => {
function fireResize(width: number) {
// @ts-ignore
Expand Down

0 comments on commit 3a89eba

Please sign in to comment.