Skip to content
Merged
Show file tree
Hide file tree
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
9 changes: 9 additions & 0 deletions tests/integration/components/angle-bracket-invocation-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,15 @@ module('Integration | Component | angle-bracket-invocation', function(hooks) {
assert.dom('[data-one="from render"][data-two="from outer"]').hasText('hi martin!');
});

test('passing into angle invocation - unused', async function(assert) {
this.owner.register('template:components/comp-outer', hbs`<CompInner ...attributes />`);
this.owner.register('template:components/comp-inner', hbs`hi martin!`);

await render(hbs`<CompOuter />`);

assert.dom('div div').hasText('hi martin!');
});

test('passing into element - normal component', async function(assert) {
this.owner.register(
'template:components/foo-bar',
Expand Down
35 changes: 20 additions & 15 deletions vendor/angle-bracket-invocation-polyfill/runtime-polyfill.js
Original file line number Diff line number Diff line change
Expand Up @@ -232,9 +232,11 @@ import { lte, gte } from 'ember-compatibility-helpers';
let angleAttrs = args.get('__ANGLE_ATTRS__');
// this use of value is OK because the set of keys isn't allowed to change dynamically
let snapshot = angleAttrs.value();
for (let attributeName in snapshot) {
let attributeReference = angleAttrs.get(attributeName);
operations.setAttribute(attributeName, attributeReference, false, null);
if (snapshot) {
for (let attributeName in snapshot) {
let attributeReference = angleAttrs.get(attributeName);
operations.setAttribute(attributeName, attributeReference, false, null);
}
}
}
};
Expand Down Expand Up @@ -382,18 +384,21 @@ import { lte, gte } from 'ember-compatibility-helpers';
// on < 2.15 `namedArgs` is only present when there were arguments
if (args && args.has('__ANGLE_ATTRS__')) {
let attributeReferences = args.get('__ANGLE_ATTRS__');
let names = Object.keys(attributeReferences.value());
for (let i = 0; i < names.length; i++) {
let attributeName = names[i];
let attributeReference = attributeReferences.get(attributeName);

operations.addDynamicAttribute(
element,
attributeName,
attributeReference,
false,
null
);
let snapshot = attributeReferences.value();
if (snapshot) {
let names = Object.keys(snapshot);
for (let i = 0; i < names.length; i++) {
let attributeName = names[i];
let attributeReference = attributeReferences.get(attributeName);

operations.addDynamicAttribute(
element,
attributeName,
attributeReference,
false,
null
);
}
}
}
};
Expand Down