diff --git a/transforms/angle-brackets/telemetry/mock-invokables.js b/transforms/angle-brackets/telemetry/mock-invokables.js
index 9715c6ea1..98b1352d7 100644
--- a/transforms/angle-brackets/telemetry/mock-invokables.js
+++ b/transforms/angle-brackets/telemetry/mock-invokables.js
@@ -101,4 +101,7 @@ module.exports = {
'app/helpers/nested/helper': {
type: 'Helper',
},
+ 'app/components/power-select': {
+ type: 'Component',
+ },
};
diff --git a/transforms/angle-brackets/transform.js b/transforms/angle-brackets/transform.js
index 56d7132c3..f271cd44e 100755
--- a/transforms/angle-brackets/transform.js
+++ b/transforms/angle-brackets/transform.js
@@ -12,6 +12,8 @@ const HTML_ATTRIBUTES = ['class', 'placeholder', 'required'];
const BUILT_IN_COMPONENTS = ['link-to', 'input', 'textarea'];
let inAttr = false;
+let havingBlockParams = false;
+let currentBlockParams = [];
function isAttribute(key) {
return HTML_ATTRIBUTES.includes(key) || isDataAttribute(key);
@@ -435,16 +437,23 @@ function transformToAngleBracket(fileInfo, config, invokableData) {
node.loc.source !== '(synthetic)' &&
!shouldIgnoreMustacheStatement(tagName, config, invokableData);
const isNestedComponent = isNestedComponentTagName(tagName);
+ const isNotBlockParamValue =
+ !havingBlockParams && !currentBlockParams.includes(node.path.original);
if (
isValidMustache &&
- (node.hash.pairs.length > 0 || node.params.length > 0 || isNestedComponent)
+ (node.hash.pairs.length > 0 || node.params.length > 0 || isNestedComponent) &&
+ isNotBlockParamValue
) {
return transformNode(node, fileInfo, config);
}
},
BlockStatement(node) {
let tagName = `${node.path.original}`;
+ havingBlockParams = node.program.blockParams.length > 0;
+ if (havingBlockParams) {
+ currentBlockParams = node.program.blockParams;
+ }
if (
!shouldIgnoreMustacheStatement(node.path.original, config, invokableData) ||
isWallStreet(tagName)
diff --git a/transforms/angle-brackets/transform.test.js b/transforms/angle-brackets/transform.test.js
index 937cd79d5..32ae98641 100644
--- a/transforms/angle-brackets/transform.test.js
+++ b/transforms/angle-brackets/transform.test.js
@@ -1164,3 +1164,61 @@ test('No telemetry', () => {
"
`);
});
+
+test('contextual-component-variable', () => {
+ let input = `
+ {{#power-select search=(perform searchThings)
+ selected=selectedResult
+ placeholder="Enter the thing..."
+ loadingMessage="Searching..."
+ onchange=(perform selectThing) as |fooResult|}}
+ {{fooResult.attributes.thing-desc}}
+ {{/power-select}}
+ `;
+
+ expect(runTest('contextual-component-variable.hbs', input)).toMatchInlineSnapshot(`
+ "
+
+ {{fooResult.attributes.thing-desc}}
+
+ "
+ `);
+});
+
+test('nested-block-params', () => {
+ let input = `
+ {{#my-component as |foo myAction hash components|}}
+ {{foo}} {{myAction}}
+ {{hash.property}} {{hash.foo}}
+
+ {{components.foo}}
+
+ {{#components.my-component}}
+
+ {{/components.my-component}}
+
+ {{#components.block as |block|}}
+ {{block}}
+ {{/components.block}}
+ {{/my-component}}
+ `;
+
+ expect(runTest('nested-block-params', input)).toMatchInlineSnapshot(`
+ "
+
+ {{foo}} {{myAction}}
+ {{hash.property}} {{hash.foo}}
+
+ {{components.foo}}
+
+
+
+
+
+
+ {{block}}
+
+
+ "
+ `);
+});