Test: add test for opening help window on articleForm (#4237)

This commit is contained in:
Karin Hendrikse 2019-10-07 14:49:44 +02:00 committed by Ben Halpern
parent 580fd11bb9
commit 14c9adefd5

View file

@ -60,6 +60,15 @@ describe('<ArticleForm />', () => {
form.find('.clear').simulate('click');
expect(form.state().bodyMarkdown).toBe('');
});
it('toggles help on help button press', () => {
const form = deep(getArticleForm());
global.scrollTo = jest.fn();
form.find('.articleform__buttons--small').simulate('click', { preventDefault: () => {} });
expect(form.state().helpShowing).toBe(true);
form.find('.articleform__buttons--small').simulate('click', { preventDefault: () => {} });
expect(form.state().helpShowing).toBe(false);
});
});
const getArticleForm = () => (