From 5ee98e9ecd2be49fa2149a9597bc9e490f0692ed Mon Sep 17 00:00:00 2001 From: Ben Wheeler Date: Tue, 13 Aug 2019 15:20:56 -0400 Subject: [PATCH] added info button test --- test/unit/components/info-button.test.jsx | 34 +++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 test/unit/components/info-button.test.jsx diff --git a/test/unit/components/info-button.test.jsx b/test/unit/components/info-button.test.jsx new file mode 100644 index 000000000..777fa2f40 --- /dev/null +++ b/test/unit/components/info-button.test.jsx @@ -0,0 +1,34 @@ +import React from 'react'; +import {mountWithIntl} from '../../helpers/intl-helpers.jsx'; +import InfoButton from '../../../src/components/info-button/info-button'; + +describe('InfoButton', () => { + test('Info button defaults to not visible', () => { + const component = mountWithIntl( + + ); + expect(component.find('div.info-button-message').exists()).toEqual(false); + }); + test('clicking on info button makes info message visible', () => { + const component = mountWithIntl( + + ); + component.find('div.info-button').simulate('click'); + expect(component.find('div.info-button-message').exists()).toEqual(true); + }); + test('after message is visible, mouseOut makes it vanish', () => { + const component = mountWithIntl( + + ); + component.find('div.info-button').simulate('click'); + expect(component.find('div.info-button-message').exists()).toEqual(true); + component.find('div.info-button').simulate('mouseOut'); + expect(component.find('div.info-button-message').exists()).toEqual(false); + }); +});