Skip to content

Commit 5c788e6

Browse files
fix spelling and split condition for skipping inAttr
1 parent 08d0dd2 commit 5c788e6

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

transforms/angle-brackets/test.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1047,12 +1047,14 @@ test('wallstreet.hbs', () => {
10471047
test('attr-space', () => {
10481048
let input = `
10491049
<MyComp::Test @color={{"custom-2"}} @visible={{Group.item.isNew}} />
1050+
<MyComp::Test @color="custom-2" @visible={{Group.item.isNew}} />
10501051
<MyComp @value={{value}} @cont={{this}} @class={{model.some-stuff-here}} />
10511052
`;
10521053

10531054
expect(runTest('attr-space.hbs', input)).toMatchInlineSnapshot(`
10541055
"
10551056
<MyComp::Test @color={{\\"custom-2\\"}} @visible={{Group.item.isNew}} />
1057+
<MyComp::Test @color=\\"custom-2\\" @visible={{Group.item.isNew}} />
10561058
<MyComp @value={{value}} @cont={{this}} @class={{model.some-stuff-here}} />
10571059
"
10581060
`);

transforms/angle-brackets/transform.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ function transformTagName(tagName) {
5050
return char.toUpperCase();
5151
}
5252

53-
// Remove all occurances of '-'s from the tagName that aren't starting with `-`
53+
// Remove all occurrences of '-'s from the tagName that aren't starting with `-`
5454
return char === '-' ? '' : char.toLowerCase();
5555
});
5656

@@ -323,12 +323,15 @@ function transformNode(node, fileInfo, config) {
323323
let namesParams = transformAttrs(tagName, node.hash.pairs);
324324
attributes = attributes.concat(namesParams);
325325
} else {
326-
if (nodeHasPositionalParameters(node) || inAttr) {
326+
if (nodeHasPositionalParameters(node)) {
327327
logger.warn(
328328
`WARNING: {{${node.path.original}}} was not converted as it has positional parameters which can't be automatically converted. Source: ${fileInfo.path}`
329329
);
330330
return;
331331
}
332+
if (inAttr) {
333+
return;
334+
}
332335
attributes = transformNodeAttributes(tagName, node);
333336
}
334337
return b.element(

0 commit comments

Comments
 (0)