Skip to content

Nested loop not correctly resolving #15

@jelmerveen

Description

@jelmerveen

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>"

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions