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
<list>
fix: Prevent rendering items from nested <list>
#312
Conversation
Filter list of items with those that have the current list instance as a parent.
1ce8953
to
6ea3404
Compare
…t child node of `<list>`
Would it relatively easy to add unit tests to account for all of these cases? |
I'll take a look. I think I'll have to refactor it to isolate the code so that I can mock elements |
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.
Thanks for the tests, it adds confidence to the functionality here in case we refactor in the future.
Follow up for #312. One scenario with paginated lists was not accounted correctly. A paginated list could typically look like this: ```xml <list> <item>1</item> <item>2</item> <items> <item>3</item> <item>4</item> <items> <item>5</item> <item>6</item> <items> ... </items> </items> </items> </list> ``` Previous implementation did not account for recursive nesting aspect of `<items>`, and would only retrieve the items under the `<items>` directly nested under the main `<list>`. This fixes it by recursively checking that the parent list is the same as our current element.
Follow up for #312. One scenario with paginated lists was not accounted correctly. A paginated list could typically look like this: ```xml <list> <item>1</item> <item>2</item> <items> <item>3</item> <item>4</item> <items> <item>5</item> <item>6</item> <items> ... </items> </items> </items> </list> ``` Previous implementation did not account for recursive nesting aspect of `<items>`, and would only retrieve the items under the `<items>` directly nested under the main `<list>`. This fixes it by recursively checking that the parent list is the same as our current element.
Render list items that are direct children of the
<list>
element, or nested under a<items>
children node.