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 committed May 12, 2021
1 parent 43da860 commit be77cdc
Show file tree
Hide file tree
Showing 17 changed files with 154 additions and 43 deletions.
10 changes: 8 additions & 2 deletions packages/@ember/-internals/glimmer/lib/components/-link-to.ts
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
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
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
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
55 changes: 48 additions & 7 deletions packages/@ember/-internals/glimmer/lib/components/link-to.ts
Expand Up @@ -393,7 +393,6 @@ if (EMBER_MODERNIZED_BUILT_IN_COMPONENTS) {
['role', 'ariaRole'],

// LinkTo
'href',
'title',
'rel',
'tabindex',
Expand All @@ -402,6 +401,24 @@ 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.`);
this.modernized = false;
} else {
superOnUnsupportedArgument.call(this, name);
}
},
});
}

// @tagName
{
let superOnUnsupportedArgument = prototype['onUnsupportedArgument'];
Expand Down Expand Up @@ -454,8 +471,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 +493,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 +530,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 +548,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 +573,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 +593,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
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
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
Expand Up @@ -22,6 +22,15 @@ 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>`);

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

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
Expand Up @@ -15,6 +15,15 @@ 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}}`);

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

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
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
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
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
9 changes: 5 additions & 4 deletions packages/@ember/component/text-area.ts
Expand Up @@ -4,16 +4,17 @@ import { deprecate } from '@ember/debug';
if (EMBER_MODERNIZED_BUILT_IN_COMPONENTS) {
deprecate(
`Using Ember.TextArea or importing from 'TextArea' has been deprecated, install the ` +
`\`ember-legacy-built-in-components\` addon and use \`import { TextArea } from ` +
`'ember-legacy-built-in-components';\` instead`,
`\`@ember/legacy-built-in-components\` addon and use \`import { TextArea } 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

0 comments on commit be77cdc

Please sign in to comment.