Skip to content

Commit

Permalink
[BUGFIX release] 3.27 deprecation metadata
Browse files Browse the repository at this point in the history
* Unify deprecation ids
* Add missing `url` and `since`
* Correctly reference `@ember/legacy-built-in-components` addon
* Error instead for `<LinkTo @href=...>`
  • Loading branch information
chancancode authored and Chris Garrett committed May 12, 2021
1 parent 414cbee commit 060a44c
Show file tree
Hide file tree
Showing 17 changed files with 163 additions and 43 deletions.
10 changes: 8 additions & 2 deletions packages/@ember/-internals/glimmer/lib/components/-link-to.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1035,8 +1035,11 @@ if (EMBER_MODERNIZED_BUILT_IN_COMPONENTS) {
{
id: 'ember.built-in-components.reopen',
for: 'ember-source',
since: {},
since: {
enabled: '3.27.0',
},
until: '4.0.0',
url: 'https://deprecations.emberjs.com/v3.x#toc_ember-built-in-components-reopen',
}
);

Expand All @@ -1060,8 +1063,11 @@ if (EMBER_MODERNIZED_BUILT_IN_COMPONENTS) {
{
id: 'ember.built-in-components.reopen',
for: 'ember-source',
since: {},
since: {
enabled: '3.27.0',
},
until: '4.0.0',
url: 'https://deprecations.emberjs.com/v3.x#toc_ember-built-in-components-reopen',
}
);

Expand Down
10 changes: 8 additions & 2 deletions packages/@ember/-internals/glimmer/lib/components/-textarea.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,11 @@ if (EMBER_MODERNIZED_BUILT_IN_COMPONENTS) {
{
id: 'ember.built-in-components.reopen',
for: 'ember-source',
since: {},
since: {
enabled: '3.27.0',
},
until: '4.0.0',
url: 'https://deprecations.emberjs.com/v3.x#toc_ember-built-in-components-reopen',
}
);

Expand All @@ -87,8 +90,11 @@ if (EMBER_MODERNIZED_BUILT_IN_COMPONENTS) {
{
id: 'ember.built-in-components.reopen',
for: 'ember-source',
since: {},
since: {
enabled: '3.27.0',
},
until: '4.0.0',
url: 'https://deprecations.emberjs.com/v3.x#toc_ember-built-in-components-reopen',
}
);

Expand Down
10 changes: 8 additions & 2 deletions packages/@ember/-internals/glimmer/lib/components/checkbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,11 @@ if (EMBER_MODERNIZED_BUILT_IN_COMPONENTS) {
{
id: 'ember.built-in-components.reopen',
for: 'ember-source',
since: {},
since: {
enabled: '3.27.0',
},
until: '4.0.0',
url: 'https://deprecations.emberjs.com/v3.x#toc_ember-built-in-components-reopen',
}
);

Expand All @@ -206,8 +209,11 @@ if (EMBER_MODERNIZED_BUILT_IN_COMPONENTS) {
{
id: 'ember.built-in-components.reopen',
for: 'ember-source',
since: {},
since: {
enabled: '3.27.0',
},
until: '4.0.0',
url: 'https://deprecations.emberjs.com/v3.x#toc_ember-built-in-components-reopen',
}
);

Expand Down
24 changes: 20 additions & 4 deletions packages/@ember/-internals/glimmer/lib/components/internal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -274,8 +274,12 @@ export function handleDeprecatedArguments(target: DeprecatingInternalComponentCo
deprecate(`Passing the \`@${name}\` argument to <${angle}> is deprecated.`, false, {
id: 'ember.built-in-components.legacy-arguments',
for: 'ember-source',
since: {},
since: {
enabled: '3.27.0',
},
until: '4.0.0',
url:
'https://deprecations.emberjs.com/v3.x#toc_ember-built-in-components-legacy-arguments',
});

this.modernized = false;
Expand Down Expand Up @@ -356,8 +360,12 @@ export function handleDeprecatedAttributeArguments(
{
id: 'ember.built-in-components.legacy-attribute-arguments',
for: 'ember-source',
since: {},
since: {
enabled: '3.27.0',
},
until: '4.0.0',
url:
'https://deprecations.emberjs.com/v3.x#toc_ember-built-in-components-legacy-attribute-arguments',
}
);

Expand Down Expand Up @@ -517,8 +525,12 @@ if (EMBER_MODERNIZED_BUILT_IN_COMPONENTS) {
{
id: 'ember.built-in-components.legacy-attribute-arguments',
for: 'ember-source',
since: {},
since: {
enabled: '3.27.0',
},
until: '4.0.0',
url:
'https://deprecations.emberjs.com/v3.x#toc_ember-built-in-components-legacy-attribute-arguments',
}
);

Expand All @@ -530,8 +542,12 @@ if (EMBER_MODERNIZED_BUILT_IN_COMPONENTS) {
{
id: 'ember.built-in-components.legacy-attribute-arguments',
for: 'ember-source',
since: {},
since: {
enabled: '3.27.0',
},
until: '4.0.0',
url:
'https://deprecations.emberjs.com/v3.x#toc_ember-built-in-components-legacy-attribute-arguments',
}
);

Expand Down
54 changes: 47 additions & 7 deletions packages/@ember/-internals/glimmer/lib/components/link-to.ts
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,6 @@ if (EMBER_MODERNIZED_BUILT_IN_COMPONENTS) {
['role', 'ariaRole'],

// LinkTo
'href',
'title',
'rel',
'tabindex',
Expand All @@ -402,6 +401,23 @@ if (EMBER_MODERNIZED_BUILT_IN_COMPONENTS) {

handleDeprecatedEventArguments(LinkTo);

// @href
{
let superOnUnsupportedArgument = prototype['onUnsupportedArgument'];

Object.defineProperty(prototype, 'onUnsupportedArgument', {
configurable: true,
enumerable: false,
value: function onUnsupportedArgument(this: LinkTo, name: string): void {
if (name === 'href') {
assert(`Passing the \`@href\` argument to <LinkTo> is not supported.`);
} else {
superOnUnsupportedArgument.call(this, name);
}
},
});
}

// @tagName
{
let superOnUnsupportedArgument = prototype['onUnsupportedArgument'];
Expand Down Expand Up @@ -454,8 +470,12 @@ if (EMBER_MODERNIZED_BUILT_IN_COMPONENTS) {
{
id: 'ember.built-in-components.legacy-arguments',
for: 'ember-source',
since: {},
since: {
enabled: '3.27.0',
},
until: '4.0.0',
url:
'https://deprecations.emberjs.com/v3.x#toc_ember-built-in-components-legacy-arguments',
}
);

Expand All @@ -472,8 +492,12 @@ if (EMBER_MODERNIZED_BUILT_IN_COMPONENTS) {
{
id: 'ember.built-in-components.legacy-arguments',
for: 'ember-source',
since: {},
since: {
enabled: '3.27.0',
},
until: '4.0.0',
url:
'https://deprecations.emberjs.com/v3.x#toc_ember-built-in-components-legacy-arguments',
}
);

Expand Down Expand Up @@ -505,8 +529,12 @@ if (EMBER_MODERNIZED_BUILT_IN_COMPONENTS) {
{
id: 'ember.built-in-components.legacy-arguments',
for: 'ember-source',
since: {},
since: {
enabled: '3.27.0',
},
until: '4.0.0',
url:
'https://deprecations.emberjs.com/v3.x#toc_ember-built-in-components-legacy-arguments',
}
);
} else {
Expand All @@ -519,8 +547,12 @@ if (EMBER_MODERNIZED_BUILT_IN_COMPONENTS) {
{
id: 'ember.built-in-components.legacy-arguments',
for: 'ember-source',
since: {},
since: {
enabled: '3.27.0',
},
until: '4.0.0',
url:
'https://deprecations.emberjs.com/v3.x#toc_ember-built-in-components-legacy-arguments',
}
);

Expand All @@ -540,8 +572,12 @@ if (EMBER_MODERNIZED_BUILT_IN_COMPONENTS) {
{
id: 'ember.built-in-components.legacy-arguments',
for: 'ember-source',
since: {},
since: {
enabled: '3.27.0',
},
until: '4.0.0',
url:
'https://deprecations.emberjs.com/v3.x#toc_ember-built-in-components-legacy-arguments',
}
);

Expand All @@ -556,8 +592,12 @@ if (EMBER_MODERNIZED_BUILT_IN_COMPONENTS) {
{
id: 'ember.built-in-components.legacy-arguments',
for: 'ember-source',
since: {},
since: {
enabled: '3.27.0',
},
until: '4.0.0',
url:
'https://deprecations.emberjs.com/v3.x#toc_ember-built-in-components-legacy-arguments',
}
);
}
Expand Down
10 changes: 8 additions & 2 deletions packages/@ember/-internals/glimmer/lib/components/text-field.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,11 @@ if (EMBER_MODERNIZED_BUILT_IN_COMPONENTS) {
{
id: 'ember.built-in-components.reopen',
for: 'ember-source',
since: {},
since: {
enabled: '3.27.0',
},
until: '4.0.0',
url: 'https://deprecations.emberjs.com/v3.x#toc_ember-built-in-components-reopen',
}
);

Expand All @@ -250,8 +253,11 @@ if (EMBER_MODERNIZED_BUILT_IN_COMPONENTS) {
{
id: 'ember.built-in-components.reopen',
for: 'ember-source',
since: {},
since: {
enabled: '3.27.0',
},
until: '4.0.0',
url: 'https://deprecations.emberjs.com/v3.x#toc_ember-built-in-components-reopen',
}
);

Expand Down
1 change: 1 addition & 0 deletions packages/@ember/-internals/glimmer/lib/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ const VM_DEPRECATION_OVERRIDES: (DeprecationOptions & {
},
{
id: 'argument-less-helper-paren-less-invocation',
url: 'https://deprecations.emberjs.com/v3.x#toc_argument-less-helper-paren-less-invocation',
until: '4.0.0',
for: 'ember-source',
since: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { Router, Route } from '@ember/-internals/routing';
import Controller from '@ember/controller';
import { set } from '@ember/-internals/metal';
import { LinkComponent } from '@ember/-internals/glimmer';
import { DEBUG } from '@glimmer/env';

moduleFor(
'<LinkTo /> component (rendering tests)',
Expand All @@ -22,6 +23,19 @@ moduleFor(
);
}

async [`@test it throws a useful error if you pass the href argument`](assert) {
this.addTemplate('application', `<LinkTo @href="nope" @route="index">Index</LinkTo>`);

if (DEBUG) {
await assert.rejects(
this.visit('/'),
/Passing the `@href` argument to <LinkTo> is not supported\./
);
} else {
assert.expect(0);
}
}

async ['@test it should be able to be inserted in DOM when the router is not present']() {
this.addTemplate('application', `<LinkTo @route='index'>Go to Index</LinkTo>`);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { moduleFor, ApplicationTestCase, RenderingTestCase, runTask } from 'inte
import Controller from '@ember/controller';
import { set } from '@ember/-internals/metal';
import { LinkComponent } from '@ember/-internals/glimmer';
import { DEBUG } from '@glimmer/env';

moduleFor(
'{{link-to}} component (rendering tests)',
Expand All @@ -15,6 +16,19 @@ moduleFor(
}, /You must provide one or more parameters to the `{{link-to}}` component\. \('my-app\/templates\/application\.hbs' @ L1:C0\)/);
}

async [`@test it throws a useful error if you pass the href argument`](assert) {
this.addTemplate('application', `{{#link-to href="nope" route="index"}}Index{{/link-to}}`);

if (DEBUG) {
await assert.rejects(
this.visit('/'),
/Passing the `@href` argument to <LinkTo> is not supported\./
);
} else {
assert.expect(0);
}
}

async ['@test it should be able to be inserted in DOM when the router is not present']() {
this.addTemplate('application', `{{#link-to route='index'}}Go to Index{{/link-to}}`);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,11 @@ if (EMBER_MODERNIZED_BUILT_IN_COMPONENTS) {
deprecate('Reopening Ember.TargetActionSupport is deprecated.', false, {
id: 'ember.built-in-components.reopen',
for: 'ember-source',
since: {},
since: {
enabled: '3.27.0',
},
until: '4.0.0',
url: 'https://deprecations.emberjs.com/v3.x#toc_ember-built-in-components-reopen',
});

TargetActionSupport._wasReopened = true;
Expand Down
5 changes: 4 additions & 1 deletion packages/@ember/-internals/views/lib/mixins/text_support.js
Original file line number Diff line number Diff line change
Expand Up @@ -365,8 +365,11 @@ if (EMBER_MODERNIZED_BUILT_IN_COMPONENTS) {
deprecate('Reopening Ember.TextSupport is deprecated.', false, {
id: 'ember.built-in-components.reopen',
for: 'ember-source',
since: {},
since: {
enabled: '3.27.0',
},
until: '4.0.0',
url: 'https://deprecations.emberjs.com/v3.x#toc_ember-built-in-components-reopen',
});

TextSupport._wasReopened = true;
Expand Down
9 changes: 5 additions & 4 deletions packages/@ember/component/checkbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,17 @@ import { deprecate } from '@ember/debug';
if (EMBER_MODERNIZED_BUILT_IN_COMPONENTS) {
deprecate(
`Using Ember.Checkbox or importing from 'Checkbox' has been deprecated, install the ` +
`\`ember-legacy-built-in-components\` addon and use \`import { Checkbox } from ` +
`'ember-legacy-built-in-components';\` instead`,
`\`@ember/legacy-built-in-components\` addon and use \`import { Checkbox } from ` +
`'@ember/legacy-built-in-components';\` instead`,
false,
{
id: 'ember.legacy-built-in-components',
id: 'ember.built-in-components.import',
until: '4.0.0',
for: 'ember-source',
since: {
// TODO: update this when enabling the feature
enabled: '3.27.0',
},
url: 'https://deprecations.emberjs.com/v3.x#toc_ember-built-in-components-import',
}
);
}
Expand Down
Loading

0 comments on commit 060a44c

Please sign in to comment.