Skip to content

Commit

Permalink
Merge pull request #892 from cibernox/create-failing-test-for-yielded…
Browse files Browse the repository at this point in the history
…-components-receiving-splattributes

Failing test for forwarding attributes to yielded components
  • Loading branch information
rwjblue authored Jan 18, 2019
2 parents 543e767 + a233e05 commit 11033eb
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
3 changes: 3 additions & 0 deletions packages/@glimmer/compiler/lib/javascript-compiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,9 @@ export default class JavaScriptCompiler
}

attrSplat(to: Option<number>) {
// consume (and disregard) the value pushed for the
// ...attributes attribute
this.popValue();
this.push([Ops.AttrSplat, to!]);
}

Expand Down
1 change: 0 additions & 1 deletion packages/@glimmer/compiler/lib/template-compiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ export default class TemplateCompiler {
let { name, value } = action;

let namespace = getAttrNamespace(name);

let isStatic = this.prepareAttributeValue(value);

if (name.charAt(0) === '@') {
Expand Down
23 changes: 23 additions & 0 deletions packages/@glimmer/test-helpers/lib/suites/components.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,29 @@ export class BasicComponents extends RenderTest {
this.assertStableNodes();
}

@test({
kind: 'fragment',
})
'invoke a component forwarding attributes'() {
this.registerComponent(
'Glimmer',
'InnerComponent',
'<p data-foo="definition" data-bar="definition" ...attributes>Inner Component</p>'
);
this.render(
{
layout:
'{{#with (component "InnerComponent") as |Inner|}}<Inner data-foo="invocation" ...attributes />{{/with}}',
attributes: { title: 'Emberconf' },
},
{}
);
this.assertHTML(
"<p data-foo='invocation' data-bar='definition' title='Emberconf'>Inner Component</p>"
);
this.assertStableRerender();
}

@test({
kind: 'basic',
})
Expand Down

0 comments on commit 11033eb

Please sign in to comment.