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>
This commit is contained in:
CheongJY
2020-09-01 08:15:22 +08:00
committed by GitHub
parent b0f85de311
commit a294021d53

View File

@ -31,7 +31,8 @@ tests:
- text: <code>MyComponent</code> should render an <code>h1</code> header enclosed in a single <code>div</code>.
testString: assert(/<div><h1>.*<\/h1><\/div>/.test(Enzyme.mount(React.createElement(MyComponent)).html()));
- text: The rendered <code>h1</code> header should contain text rendered from the component&apos;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 === ''<div><h1>TestName</h1></div>'');};'
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 === '<div><h1>TestName</h1></div>'); };
```