From 14c9adefd53dea7a7320c6c7abfbbccbd3674d82 Mon Sep 17 00:00:00 2001 From: Karin Hendrikse <30577427+khendrikse@users.noreply.github.com> Date: Mon, 7 Oct 2019 14:49:44 +0200 Subject: [PATCH] Test: add test for opening help window on articleForm (#4237) --- .../article-form/__tests__/articleForm.test.jsx | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/javascript/article-form/__tests__/articleForm.test.jsx b/app/javascript/article-form/__tests__/articleForm.test.jsx index b4079f920..0b1d1ff43 100644 --- a/app/javascript/article-form/__tests__/articleForm.test.jsx +++ b/app/javascript/article-form/__tests__/articleForm.test.jsx @@ -60,6 +60,15 @@ describe('', () => { 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 = () => (