-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bugfix: Child id can be smaller than parent id #26
Bugfix: Child id can be smaller than parent id #26
Conversation
@jesusisao can we cover the |
spec/invalid-tree-spec.js
Outdated
expect( node[key_parent] ).toBe(0); | ||
expect( key_child in node ).toBe(true); | ||
expect( node[key_child].length ).toBe(2); | ||
expect( node[depthKeyName] ).toBe(0); |
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.
@DenQ
I added a depth test like this
spec/invalid-tree-spec.js
Outdated
parent: 101 // bad id | ||
}, { | ||
id: 10, | ||
parent: 102 // bad id |
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.
I also added a test if it was an invalid list.
(To prevent the recursive function from going into an infinite loop)
@jesusisao i will look soon. Thank you. |
feature
This PR allows users to use smaller child id than parent id.
#27
how
Achieved by adding "__depth" key and using it in sorting.
before:
after:
I'm not good at English, so I'm sorry if it's rude