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

Issue:
link-to conversion drops params
Noticed while working on ember-api-docs, an example of this is here: https://github.com/ember-learn/ember-api-docs/pull/768/commits/3acc0d5fd868eb273c754402f0faa0dd0c553131#diff-86ff65401adf2a1a22505ed43fd38b01de6f9f5781bfbfb100d1e51c55c0d5e3L55

I'm not sure which of the "special cases" are necessary to trigger this but in our case the dynamic route, query-params present, and data-test hash pair are all present.

Input:
```hbs 
{{#link-to (concat parentName ".index")
           model.project.id
           model.projectVersion.compactVersion
           model.name
           (query-params anchor=undefined)
           class="tabbed-layout__menu__item"
           activeClass="tabbed-layout__menu__item_selected"
           current-when=(concat parentName ".index")
           data-test-tab="index"
        }}
```

Broken output:

```hbs
<LinkTo @route={{concat parentName ".index" }} @models={{array model.project.id model.projectVersion.compactVersion}} @query={{hash anchor=undefined}} class="tabbed-layout__menu__item" @activeClass="tabbed-layout__menu__item_selected" @current-when={{concat parentName ".index"}} data-test-tab="index">
```

Notice that `model.name` is not in the array constructed for `@models`

Pull request description:
fix any number of models in link-to
resolves #485 

Patch:
diff --git a/transforms/angle-brackets/transform.js b/transforms/angle-brackets/transform.js
index bab4559..77991e5 100755
--- a/transforms/angle-brackets/transform.js
+++ b/transforms/angle-brackets/transform.js
@@ -261,7 +261,10 @@ function transformLinkToAttrs(params) {
       if (models.length < 3) {
         _modelsParam = b.attr('@model', transformModelParams(models[0]));
       } else {
-        _modelsParam = b.attr('@models', b.mustache(b.path('array'), models.slice().splice(0, 2)));
+        _modelsParam = b.attr(
+          '@models',
+          b.mustache(b.path('array'), models.slice(0, models.length - 1))
+        );
       }
       _qpParam = b.attr('@query', b.mustache(b.path('hash'), [], models[models.length - 1].hash));
     } else {


Test patch:
diff --git a/transforms/angle-brackets/transform.test.js b/transforms/angle-brackets/transform.test.js
index 45eef9b..af91eba 100644
--- a/transforms/angle-brackets/transform.test.js
+++ b/transforms/angle-brackets/transform.test.js
@@ -615,6 +615,31 @@ test('link-to-query-param', () => {
       'all-users'
       (query-params searchTerm=searchTerm)
     }}
+    {{#link-to (concat parentName ".index")
+      model.project.id
+      model.projectVersion.compactVersion
+      model.name
+      (query-params anchor=undefined)
+      class="tabbed-layout__menu__item"
+      activeClass="tabbed-layout__menu__item_selected"
+      current-when=(concat parentName ".index")
+      data-test-tab="index"
+    }}
+      <span>Events</span>
+    {{/link-to}}
+    {{#link-to (concat parentName ".index")
+      model.project.id
+      model.projectVersion.compactVersion
+      model.name
+      model.description
+      (query-params anchor=undefined)
+      class="tabbed-layout__menu__item"
+      activeClass="tabbed-layout__menu__item_selected"
+      current-when=(concat parentName ".index")
+      data-test-tab="index"
+    }}
+      <span>Events</span>
+    {{/link-to}}
   `;
   /**
    * NOTE: An issue has been opened in `ember-template-recast` (https://github.com/ember-template-lint/ember-template-recast/issues/82)
@@ -639,6 +664,12 @@ test('link-to-query-param', () => {
           Recent Posts
         </LinkTo>
         <LinkTo @route=\\"apps.app.users.segments.segment\\" @model=\\"all-users\\" @query={{hash searchTerm=searchTerm}}>Users</LinkTo>
+        <LinkTo @route={{concat parentName \\".index\\"}} @models={{array model.project.id model.projectVersion.compactVersion model.name}} @query={{hash anchor=undefined}} class=\\"tabbed-layout__menu__item\\" @activeClass=\\"tabbed-layout__menu__item_selected\\" @current-when={{concat parentName \\".index\\"}} data-test-tab=\\"index\\">
+          <span>Events</span>
+        </LinkTo>
+        <LinkTo @route={{concat parentName \\".index\\"}} @models={{array model.project.id model.projectVersion.compactVersion model.name model.description}} @query={{hash anchor=undefined}} class=\\"tabbed-layout__menu__item\\" @activeClass=\\"tabbed-layout__menu__item_selected\\" @current-when={{concat parentName \\".index\\"}} data-test-tab=\\"index\\">
+          <span>Events</span>
+        </LinkTo>
       "
   `);
 });