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

Nested loop not correctly resolving #15

Open
jelmerveen opened this issue Nov 6, 2023 · 0 comments
Open

Nested loop not correctly resolving #15

jelmerveen opened this issue Nov 6, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@jelmerveen
Copy link
Collaborator

Test code:

it('renders a nested loop correctly', () => {
        const template = "<div>TestDiv</div>{{% for item of list <ul>{{% for object of item  <li>{{object.label}}</li> %}}</ul> %}}";

        const templateObject = {
            list: [[{ label: "Item1" }, { label: "Item2" }, { label: "Item3" }]],
        };

        expect(cleanHtml(render(template, templateObject))).toBe("<div>TestDiv</div><ul><li>Item1</li><li>Item2</li><li>Item3</li></ul>");
    });

Notice the <ul> inside the first loop, it should also be repeated 3x.

"<div>TestDiv</div><ul><li>Item1</li></ul><ul><li>Item2</li></ul><ul><li>Item3</li></ul>"
@jelmerveen jelmerveen added the bug Something isn't working label Nov 6, 2023
@jelmerveen jelmerveen changed the title Nested loop has a bug Nested loop not correctly resolving Nov 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant