diff --git a/tests/integration/components/angle-bracket-invocation-test.js b/tests/integration/components/angle-bracket-invocation-test.js index 4da0a1c..78a8347 100644 --- a/tests/integration/components/angle-bracket-invocation-test.js +++ b/tests/integration/components/angle-bracket-invocation-test.js @@ -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``); + this.owner.register('template:components/comp-inner', hbs`hi martin!`); + + await render(hbs``); + + assert.dom('div div').hasText('hi martin!'); + }); + test('passing into element - normal component', async function(assert) { this.owner.register( 'template:components/foo-bar', diff --git a/vendor/angle-bracket-invocation-polyfill/runtime-polyfill.js b/vendor/angle-bracket-invocation-polyfill/runtime-polyfill.js index 40b0ae5..c5107f2 100644 --- a/vendor/angle-bracket-invocation-polyfill/runtime-polyfill.js +++ b/vendor/angle-bracket-invocation-polyfill/runtime-polyfill.js @@ -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); + } } } }; @@ -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 + ); + } } } };