diff --git a/src/components/__tests__/SkillTree.test.tsx b/src/components/__tests__/SkillTree.test.tsx index 232dd71..11bcea1 100644 --- a/src/components/__tests__/SkillTree.test.tsx +++ b/src/components/__tests__/SkillTree.test.tsx @@ -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; @@ -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