This repository has been archived by the owner on Jun 26, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 40
T/1009: Element#getNodeByPath() should expect offsets not indexes #1043
Conversation
This file contains 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
Reinmar
reviewed
Jul 25, 2017
tests/model/documentfragment.js
Outdated
|
||
// <paragraph>foo<bold>bar</bold>bom</paragraph> | ||
|
||
expect( frag.getNodeByPath( [ 0, 0 ] ) ).to.equal( foo ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not good when all tests start with 0
offset. E.g. if we'd implement this method recursively this would pass while there still might be a bug in DF itself.
Minor R- for incomplete tests. Besides that, have you checked how and why existing |
The tests are fine now. But this question remains:
|
I found only one place in the whole project where the method is used:
|
So could we have a test (which would fail before this fix) for that method? |
Finally, I did it! :D |
Great. That's a really good test. |
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.
Suggested merge commit message (convention)
Fix:
model.Element#getNodeByPath()
andmodel.DocumentFragment#getNodeByPath()
work with offsets instead of indexes. Closes ckeditor/ckeditor5#4108.