Account for closing html tags during diff#455
Merged
acjh merged 1 commit intoMarkBind:masterfrom Oct 18, 2018
Merged
Conversation
acjh
reviewed
Oct 17, 2018
test/test_site/testUtil/diffHtml.js
Outdated
| * <div/> | ||
| */ | ||
| const endsWithOpeningTag = (fragment) => { | ||
| let numUnopenedTag = 0; |
Contributor
There was a problem hiding this comment.
Sounds odd as it sounds like we're saying one can close a tag before opening it.
Is it reasonable to assume that this is +/-1? How about hasUnmatchedClosingBracket?
Contributor
Author
There was a problem hiding this comment.
I was thinking of a fragment like
<panel header="<a>Test</a>">Here there are 2 > s before a <.
Maybe i will use numUnmatchedClosingBracket?
test/test_site/testUtil/diffHtml.js
Outdated
| */ | ||
| const diffHtml = (expected, actual) => { | ||
| // console.log(expected); | ||
| // console.log(actual); |
Contributor
Author
There was a problem hiding this comment.
My bad 😅
97f5a54 to
757daeb
Compare
acjh
reviewed
Oct 17, 2018
| } | ||
| if (fragment[i] === '>') { | ||
| return false; | ||
| numUnmatchedClosingBracket += 1; |
Contributor
There was a problem hiding this comment.
Maybe more intuitive to +1 before -1, and check for 0 explicitly.
if > {
+1
} else if < {
if 0 {
return true
}
-1
}
Contributor
Author
There was a problem hiding this comment.
I've updated the commit
61ea3e5 to
2e06b06
Compare
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What is the purpose of this pull request? (put "X" next to an item, remove the rest)
• [ ] Documentation update
• [X] Bug fix
• [ ] New feature
• [ ] Enhancement to an existing feature
• [ ] Other, please explain:
What is the rationale for this request?
Address the bug found in #454 where the diffing logic incorrectly identifies a diff outside a file path.
What changes did you make? (Give an overview)
The fragment that causes this is (note i've formatted it for readability)
To decide if the diff
\is found in a path, it checks if the diff>or<first.<is found, its within a html tag - diff is in path>is found, assume not within html tag - diff is not in path (and this is incorrect for the case above)For the last case, instead of assuming not within html tag, we look to check if the
>is "closed" by a<. If so, continue searching for<.Provide some example code that this change will affect:
Is there anything you'd like reviewers to focus on?
Testing instructions:
For code snippet in above found above in
test/test_site/expected/index.html, change the path separator and check that there is no diff error reported by runningnpm run test.