From a294021d537abdc7e1582d72be2592727a0f8dec Mon Sep 17 00:00:00 2001 From: CheongJY <69667027+CheongJY@users.noreply.github.com> Date: Tue, 1 Sep 2020 08:15:22 +0800 Subject: [PATCH] fix: remove whitespace before testing (#39420) * Proposed change to remove whitespace for issue #39370 Issue #39370: whitespace fails the 3rd test with test comparing to a no whitespace example. Proposed: remove all whitespace in between tags(or literally all whitespaces) before comparing it with the no whitespace example * Update render-state-in-the-user-interface.english.md * Updated proposed change to remove whitespace An update to previously proposed change due to failed test of 'unexpected token \'<\'' was thrown' * Update curriculum/challenges/english/03-front-end-libraries/react/render-state-in-the-user-interface.english.md Co-authored-by: Shaun Hamilton <51722130+Sky020@users.noreply.github.com> * fix: linting issue Co-authored-by: Tom <20648924+moT01@users.noreply.github.com> Co-authored-by: Shaun Hamilton <51722130+Sky020@users.noreply.github.com> --- .../react/render-state-in-the-user-interface.english.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/curriculum/challenges/english/03-front-end-libraries/react/render-state-in-the-user-interface.english.md b/curriculum/challenges/english/03-front-end-libraries/react/render-state-in-the-user-interface.english.md index ce2d6dd472..52712f5697 100644 --- a/curriculum/challenges/english/03-front-end-libraries/react/render-state-in-the-user-interface.english.md +++ b/curriculum/challenges/english/03-front-end-libraries/react/render-state-in-the-user-interface.english.md @@ -31,7 +31,8 @@ tests: - text: MyComponent should render an h1 header enclosed in a single div. testString: assert(/

.*<\/h1><\/div>/.test(Enzyme.mount(React.createElement(MyComponent)).html())); - text: The rendered h1 header should contain text rendered from the component's state. - testString: 'async () => { const waitForIt = (fn) => new Promise((resolve, reject) => setTimeout(() => resolve(fn()), 250)); const mockedComponent = Enzyme.mount(React.createElement(MyComponent)); const first = () => { mockedComponent.setState({ name: ''TestName'' }); return waitForIt(() => mockedComponent.html()) }; const firstValue = await first(); assert(firstValue === ''

TestName

'');};' + testString: | + async () => { const waitForIt = (fn) => new Promise((resolve, reject) => setTimeout(() => resolve(fn()), 250)); const mockedComponent = Enzyme.mount(React.createElement(MyComponent)); const first = () => { mockedComponent.setState({ name: 'TestName' }); return waitForIt(() => mockedComponent.html()) }; const firstValue = await first(); const getValue = firstValue.replace(/\s/g, ''); assert(getValue === '

TestName

'); }; ```