Skip to content

Commit

Permalink
Remove deprecated <Link> component (#747)
Browse files Browse the repository at this point in the history
  • Loading branch information
gossi authored Apr 21, 2023
1 parent aac00e4 commit 47220b7
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 73 deletions.
26 changes: 0 additions & 26 deletions addon/components/link/component.ts

This file was deleted.

12 changes: 0 additions & 12 deletions addon/components/link/template.hbs

This file was deleted.

48 changes: 24 additions & 24 deletions tests/acceptance/link-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ module('Acceptance | link', function (hooks) {
this.owner.register(
'template:application',
hbs`
<Link @route="foo" as |l|>
{{#let (link route="foo") as |l|}}
<a
data-test-link
href={{l.href}}
Expand All @@ -40,7 +40,7 @@ module('Acceptance | link', function (hooks) {
>
Link
</a>
</Link>
{{/let}}
`
);

Expand All @@ -59,7 +59,7 @@ module('Acceptance | link', function (hooks) {
this.owner.register(
'template:application',
hbs`
<Link @route="with-model" @models={{array 123}} as |l|>
{{#let (link route="with-model" models=(array 123)) as |l|}}
<a
data-test-link
href={{l.href}}
Expand All @@ -68,7 +68,7 @@ module('Acceptance | link', function (hooks) {
>
Link
</a>
</Link>
{{/let}}
`
);

Expand All @@ -87,7 +87,7 @@ module('Acceptance | link', function (hooks) {
this.owner.register(
'template:application',
hbs`
<Link @route="with-model" @model="123" as |l|>
{{#let (link route="with-model" model="123") as |l|}}
<a
data-test-link
href={{l.href}}
Expand All @@ -96,7 +96,7 @@ module('Acceptance | link', function (hooks) {
>
Link
</a>
</Link>
{{/let}}
`
);

Expand All @@ -115,7 +115,7 @@ module('Acceptance | link', function (hooks) {
this.owner.register(
'template:application',
hbs`
<Link @route="parent.child" @models={{array 123 456}} as |l|>
{{#let (link route="parent.child" models=(array 123 456)) as |l|}}
<a
data-test-link
href={{l.href}}
Expand All @@ -124,7 +124,7 @@ module('Acceptance | link', function (hooks) {
>
Link
</a>
</Link>
{{/let}}
`
);

Expand All @@ -145,7 +145,7 @@ module('Acceptance | link', function (hooks) {
this.owner.register(
'template:application',
hbs`
<Link @route="with-model" @models={{array 123}} as |l|>
{{#let (link route="with-model" models=(array 123)) as |l|}}
<a
data-test-123
href={{l.href}}
Expand All @@ -154,8 +154,8 @@ module('Acceptance | link', function (hooks) {
>
Link
</a>
</Link>
<Link @route="with-model" @models={{array 456}} as |l|>
{{/let}}
{{#let (link route="with-model" models=(array 456)) as |l|}}
<a
data-test-456
href={{l.href}}
Expand All @@ -164,7 +164,7 @@ module('Acceptance | link', function (hooks) {
>
Link
</a>
</Link>
{{/let}}
`
);

Expand Down Expand Up @@ -209,7 +209,7 @@ module('Acceptance | link', function (hooks) {
this.owner.register(
'template:application',
hbs`
<Link @route="foo" @query={{hash qp=123}} as |l|>
{{#let (link route="foo" query=(hash qp=123)) as |l|}}
<a
data-test-123
href={{l.href}}
Expand All @@ -218,8 +218,8 @@ module('Acceptance | link', function (hooks) {
>
Link
</a>
</Link>
<Link @route="foo" @query={{hash qp=456}} as |l|>
{{/let}}
{{#let (link route="foo" query=(hash qp=456)) as |l|}}
<a
data-test-456
href={{l.href}}
Expand All @@ -228,7 +228,7 @@ module('Acceptance | link', function (hooks) {
>
Link
</a>
</Link>
{{/let}}
`
);

Expand Down Expand Up @@ -277,7 +277,7 @@ module('Acceptance | link', function (hooks) {
this.owner.register(
'template:application',
hbs`
<Link @route="foo" @query={{hash qp=123}} as |l|>
{{#let (link route="foo" query=(hash qp=123)) as |l|}}
<a
data-test-123
href={{l.href}}
Expand All @@ -286,7 +286,7 @@ module('Acceptance | link', function (hooks) {
>
Link
</a>
</Link>
{{/let}}
`
);

Expand Down Expand Up @@ -331,7 +331,7 @@ module('Acceptance | link', function (hooks) {
this.owner.register(
'template:application',
hbs`
<Link @route="foo" @query={{hash qp=123}} as |l|>
{{#let (link route="foo" query=(hash qp=123)) as |l|}}
<a
data-test-123
href={{l.href}}
Expand All @@ -340,7 +340,7 @@ module('Acceptance | link', function (hooks) {
>
Link
</a>
</Link>
{{/let}}
`
);

Expand Down Expand Up @@ -406,15 +406,15 @@ module('Acceptance | link', function (hooks) {
this.owner.register(
'template:application',
hbs`
<Link @route="foo" @query={{hash qp=123}} @onTransitionTo={{this.spy}} as |l|>
{{#let (link route="foo" query=(hash qp=123) onTransitionTo=this.spy) as |l|}}
<a
data-test-123
href={{l.href}}
{{on "click" l.transitionTo}}
>
Link
</a>
</Link>
{{/let}}
`
);

Expand All @@ -438,15 +438,15 @@ module('Acceptance | link', function (hooks) {
this.owner.register(
'template:application',
hbs`
<Link @route="foo" @query={{hash qp=123}} @onReplaceWith={{this.spy}} as |l|>
{{#let (link route="foo" query=(hash qp=123) onReplaceWith=this.spy) as |l|}}
<a
data-test-123
href={{l.href}}
{{on "click" l.replaceWith}}
>
Link
</a>
</Link>
{{/let}}
`
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { setupLink } from 'ember-link/test-support';

import waitForError from 'dummy/tests/helpers/wait-for-error';

module('Integration | Component | link', function (hooks) {
module('Integration | Helper | link', function (hooks) {
setupRenderingTest(hooks);

for (const withSetupLink of [false, true]) {
Expand All @@ -23,7 +23,7 @@ module('Integration | Component | link', function (hooks) {
// Regression for: https://github.com/buschtoens/ember-link/issues/126
test('it renders', async function (assert) {
await render(hbs`
<Link @route="foo" as |l|>
{{#let (link route="foo") as |l|}}
<a
data-test-link
href={{l.href}}
Expand All @@ -32,7 +32,7 @@ module('Integration | Component | link', function (hooks) {
>
Link
</a>
</Link>
{{/let}}
`);

assert
Expand All @@ -43,7 +43,7 @@ module('Integration | Component | link', function (hooks) {

test('triggering a transition has no effect', async function (assert) {
await render(hbs`
<Link @route="foo" as |l|>
{{#let (link route="foo") as |l|}}
<a
data-test-link
href={{l.href}}
Expand All @@ -52,7 +52,7 @@ module('Integration | Component | link', function (hooks) {
>
Link
</a>
</Link>
{{/let}}
`);
assert.strictEqual(currentURL(), null);

Expand All @@ -72,7 +72,7 @@ module('Integration | Component | link', function (hooks) {
module('with incomplete models', function () {
test('it renders', async function (assert) {
await render(hbs`
<Link @route="parent.second-child" as |l|>
{{#let (link route="parent.second-child") as |l|}}
<a
data-test-link
href={{l.href}}
Expand All @@ -81,7 +81,7 @@ module('Integration | Component | link', function (hooks) {
>
Link
</a>
</Link>
{{/let}}
`);

assert
Expand All @@ -92,7 +92,7 @@ module('Integration | Component | link', function (hooks) {

test('triggering a transition has no effect', async function (assert) {
await render(hbs`
<Link @route="parent.second-child" as |l|>
{{#let (link route="parent.second-child") as |l|}}
<a
data-test-link
href={{l.href}}
Expand All @@ -101,7 +101,7 @@ module('Integration | Component | link', function (hooks) {
>
Link
</a>
</Link>
{{/let}}
`);
assert.strictEqual(currentURL(), null);

Expand All @@ -120,7 +120,7 @@ module('Integration | Component | link', function (hooks) {

test('it does not break any following LinkTo components', async function (assert) {
await render(hbs`
<Link @route="parent.second-child" as |l|>
{{#let (link route="parent.second-child") as |l|}}
<a
data-test-link
href={{l.href}}
Expand All @@ -129,7 +129,7 @@ module('Integration | Component | link', function (hooks) {
>
Link
</a>
</Link>
{{/let}}
<LinkTo @route="parent.second-child" data-test-link-to>
Link
Expand Down

0 comments on commit 47220b7

Please sign in to comment.