Repository: ember-codemods/ember-angle-brackets-codemod (js)

Issue:
computed link-to target route is removed
I just tried this codemod and it seems to run great.

I've found one issue though:

```hbs
        {{#link-to (concat settingsRoute ".profile") class="settings-nav-item"}}
          <div class="settings-nav-item__title">{{t "settings.profile.title"}}</div>
        {{/link-to}}
```

was transformed to:

```html
<LinkTo @route="" class="settings-nav-item">
          <div class="settings-nav-item__title">
            {{t "settings.profile.title"}}
          </div>
</LinkTo>
```

`concat` wasn't part of the codemod configuration helpers array.

Pull request:
fix: handle link-to with computed target route
fixes #164

Patch:
diff --git a/transforms/angle-brackets/transform.js b/transforms/angle-brackets/transform.js
index 73d330d..801cd53 100755
--- a/transforms/angle-brackets/transform.js
+++ b/transforms/angle-brackets/transform.js
@@ -228,6 +228,11 @@ function transformToAngleBracket(env, fileInfo, config) {
       firstParamOutput = b.attr('@query', b.mustache(b.path('hash'), [], firstParamInput.hash));
     } else if (firstParamInput.type === 'PathExpression') {
       firstParamOutput = b.attr('@route', b.mustache(firstParamInput.original));
+    } else if (firstParamInput.type === 'SubExpression') {
+      firstParamOutput = b.attr(
+        '@route',
+        b.mustache(firstParamInput.path, firstParamInput.params, firstParamInput.hash)
+      );
     } else {
       firstParamOutput = b.attr('@route', b.text(firstParamInput.value));
     }


Test patch:
diff --git a/transforms/angle-brackets/test.js b/transforms/angle-brackets/test.js
index 0e6a069..baed04b 100644
--- a/transforms/angle-brackets/test.js
+++ b/transforms/angle-brackets/test.js
@@ -957,3 +957,27 @@ test('preserve arguments', () => {
       "
   `);
 });
+
+test('handles link-to concat', () => {
+  let input = `
+    {{#link-to (concat someVariable ".detail") class="some-class"}}click{{/link-to}}
+  `;
+
+  expect(runTest('handles-link-to-concat.hbs', input)).toMatchInlineSnapshot(`
+    "
+        <LinkTo @route={{concat someVariable \\".detail\\"}} class=\\"some-class\\">click</LinkTo>
+      "
+  `);
+});
+
+test('handles link-to concat with hash', () => {
+  let input = `
+    {{#link-to (random-helper someVariable ".detail" do-the="thing") class="some-class"}}click{{/link-to}}
+  `;
+
+  expect(runTest('handles-link-to-concat.hbs', input)).toMatchInlineSnapshot(`
+    "
+        <LinkTo @route={{random-helper someVariable \\".detail\\" do-the=\\"thing\\"}} class=\\"some-class\\">click</LinkTo>
+      "
+  `);
+});