This repository was archived by the owner on Jul 1, 2020. It is now read-only.
Replacing div with React Fragment#8
Open
krishnaglick wants to merge 3 commits into
Open
Conversation
Using div means this affects the dom. This could have unintended consequences. Replacing it with React.Fragment (<> shorthand) removes that issue.
krishnaglick
commented
May 20, 2020
| @@ -0,0 +1,15 @@ | |||
| // Jest Snapshot v1, https://goo.gl/fbAQLP | |||
Author
There was a problem hiding this comment.
Snapshots are a great way to enforce tests without manually writing out all the html in each test!
|
|
||
| expect(component.html()).toBe('<div></div>') | ||
| expect(component.html()).toBe(null) | ||
| expect(component.html()).toMatchSnapshot() |
Author
There was a problem hiding this comment.
Since it doesn't render the extra div, we now default to null. This is possibly a breaking change.
| ) | ||
|
|
||
| expect(component.html()).toBe('<div><div>No errors! Context variable</div></div>') | ||
| expect(component.html()).toBe('<div>No errors! Context variable</div>') |
Author
There was a problem hiding this comment.
Keeping these expectations to show things passing, but it'd be awesome to switch solely to snapshots.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Using div means this affects the dom. This could have unintended consequences. Replacing it with React.Fragment (<> shorthand) removes that issue.