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

Failing test of more complex templates #13

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions test/unit/build-time-component-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -751,22 +751,22 @@ describe('BuildTimeComponent', function() {
expect(modifiedTemplate).toEqual(`<div>42</div>`);
});

it('can have a template which contains a block', function() {
it('can have a template which contains a block with an arg that shadows an external reference', function() {
class MyComponent extends BuildTimeComponent {
constructor(node: BuildTimeComponentNode, opts?: Partial<BuildTimeComponentOptions>) {
super(node, opts);
this.layout`<article>{{#each items as |item|}}<div>{{item.name}}</div>{{/each}}</article>`
this.layout`<article>{{item.name}}{{#each items as |item|}}<div>{{item.name}}{{some-helper foo thing=bar}}</div>{{/each}}</article>`
}
}
let modifiedTemplate = processTemplate(`{{my-component items=people}}`, {
let modifiedTemplate = processTemplate(`{{my-component items=people item=person foo=bar bar=qux}}`, {
MustacheStatement(node) {
if (node.path.original === 'my-component') {
return new MyComponent(node).toElement();
}
}
});

expect(modifiedTemplate).toEqual(`<div><article>{{#each people as |item|}}<div>{{item.name}}</div>{{/each}}</article></div>`);
expect(modifiedTemplate).toEqual(`<div><article>{{person.name}}{{#each people as |item|}}<div>{{item.name}}{{some-helper bar thing=qux}}<</div>{{/each}}</article></div>`);
});

it('can have a template with mustaches inside bound to invocation properties with string literals', function() {
Expand Down