Skip to content
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

Merged
merged 4 commits into from Jun 1, 2021

Conversation

flochtililoch
Copy link
Collaborator

@flochtililoch flochtililoch commented May 27, 2021

Render list items that are direct children of the <list> element, or nested under a <items> children node.

Filter list of items with those that have the current list instance as a parent.
@adamstep
Copy link
Contributor

Would it relatively easy to add unit tests to account for all of these cases?

@flochtililoch
Copy link
Collaborator Author

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

@flochtililoch
Copy link
Collaborator Author

@adamstep I've added tests in 4b8cb95

Copy link
Contributor

@adamstep adamstep left a 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.

@flochtililoch flochtililoch merged commit 042ac5a into master Jun 1, 2021
@flochtililoch flochtililoch deleted the florent/nested-lists branch June 1, 2021 16:34
flochtililoch pushed a commit that referenced this pull request Jun 10, 2021
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.
flochtililoch pushed a commit that referenced this pull request Jun 10, 2021
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants