Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[cleanup]: this. property fallback id:this-property-fallback #19736

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 0 additions & 17 deletions packages/@ember/-internals/environment/lib/env.ts
Expand Up @@ -155,23 +155,6 @@ export const ENV = {
*/
_RERENDER_LOOP_LIMIT: 1000,

/**
Allows disabling the implicit this property fallback deprecation. This could be useful
as a way to control the volume of deprecations that are issued by temporarily disabling
the implicit this fallback deprecations, which would allow the other deprecations to be more easily
identified in the console).

NOTE: The fallback behavior **will be removed** in Ember 4.0.0, disabling **_IS NOT_**
a viable strategy for handling this deprecation.

@property _DISABLE_PROPERTY_FALLBACK_DEPRECATION
@for EmberENV
@type boolean
@default false
@private
*/
_DISABLE_PROPERTY_FALLBACK_DEPRECATION: false,

EMBER_LOAD_HOOKS: {} as {
[hook: string]: Function[];
},
Expand Down
10 changes: 0 additions & 10 deletions packages/@ember/-internals/glimmer/lib/environment.ts
Expand Up @@ -106,16 +106,6 @@ const VM_DEPRECATION_OVERRIDES: (DeprecationOptions & {
enabled: '3.21.0',
},
},
{
id: 'this-property-fallback',
disabled: ENV._DISABLE_PROPERTY_FALLBACK_DEPRECATION,
url: 'https://deprecations.emberjs.com/v3.x#toc_this-property-fallback',
until: '4.0.0',
for: 'ember-source',
since: {
enabled: '3.26.0',
},
},
{
id: 'argument-less-helper-paren-less-invocation',
url: 'https://deprecations.emberjs.com/v3.x#toc_argument-less-helper-paren-less-invocation',
Expand Down
Expand Up @@ -178,7 +178,7 @@ moduleFor(
}

['@test sharing a template between engine and application has separate refinements']() {
this.assert.expect(2);
this.assert.expect(1);

let sharedTemplate = compile(strip`
<h1>{{this.contextType}}</h1>
Expand All @@ -187,10 +187,6 @@ moduleFor(
{{outlet}}
`);

expectDeprecation(
/The `[^`]+` property(?: path)? was used in the `[^`]+` template without using `this`. This fallback behavior has been deprecated, all properties must be looked up on `this` when used in the template: {{[^}]+}}/
);

this.add('template:application', sharedTemplate);
this.add(
'controller:application',
Expand Down Expand Up @@ -238,10 +234,6 @@ moduleFor(
['@test sharing a layout between engine and application has separate refinements']() {
this.assert.expect(2);

expectDeprecation(
/The `[^`]+` property(?: path)? was used in the `[^`]+` template without using `this`. This fallback behavior has been deprecated, all properties must be looked up on `this` when used in the template: {{[^}]+}}/
);

let sharedLayout = compile(strip`
{{ambiguous-curlies}}
`);
Expand Down
Expand Up @@ -105,47 +105,7 @@ moduleFor(
});
}

['@test it can access the model provided by the route via implicit this fallback']() {
expectDeprecation(
/The `[^`]+` property(?: path)? was used in the `[^`]+` template without using `this`. This fallback behavior has been deprecated, all properties must be looked up on `this` when used in the template: {{[^}]+}}/
);

this.add(
'route:application',
Route.extend({
model() {
return ['red', 'yellow', 'blue'];
},
})
);

this.addTemplate(
'application',
strip`
<ul>
{{#each model as |item|}}
<li>{{item}}</li>
{{/each}}
</ul>
`
);

return this.visit('/').then(() => {
this.assertInnerHTML(strip`
<ul>
<li>red</li>
<li>yellow</li>
<li>blue</li>
</ul>
`);
});
}

async ['@test interior mutations on the model with set'](assert) {
expectDeprecation(
/The `[^`]+` property(?: path)? was used in the `[^`]+` template without using `this`. This fallback behavior has been deprecated, all properties must be looked up on `this` when used in the template: {{[^}]+}}/
);

this.router.map(function () {
this.route('color', { path: '/:color' });
});
Expand All @@ -164,7 +124,7 @@ moduleFor(
strip`
[@model: {{@model.color}}]
[this.model: {{this.model.color}}]
[model: {{model.color}}]
[model: {{this.model.color}}]
`
);

Expand Down Expand Up @@ -203,10 +163,6 @@ moduleFor(
}

async ['@test interior mutations on the model with tracked properties'](assert) {
expectDeprecation(
/The `[^`]+` property(?: path)? was used in the `[^`]+` template without using `this`. This fallback behavior has been deprecated, all properties must be looked up on `this` when used in the template: {{[^}]+}}/
);

class Model {
@tracked color;

Expand All @@ -233,7 +189,7 @@ moduleFor(
strip`
[@model: {{@model.color}}]
[this.model: {{this.model.color}}]
[model: {{model.color}}]
[model: {{this.model.color}}]
`
);

Expand Down Expand Up @@ -271,10 +227,6 @@ moduleFor(
}

async ['@test exterior mutations on the model with set'](assert) {
expectDeprecation(
/The `[^`]+` property(?: path)? was used in the `[^`]+` template without using `this`. This fallback behavior has been deprecated, all properties must be looked up on `this` when used in the template: {{[^}]+}}/
);

this.router.map(function () {
this.route('color', { path: '/:color' });
});
Expand All @@ -293,7 +245,7 @@ moduleFor(
strip`
[@model: {{@model}}]
[this.model: {{this.model}}]
[model: {{model}}]
[model: {{this.model}}]
`
);

Expand Down Expand Up @@ -332,10 +284,6 @@ moduleFor(
}

async ['@test exterior mutations on the model with tracked properties'](assert) {
expectDeprecation(
/The `[^`]+` property(?: path)? was used in the `[^`]+` template without using `this`. This fallback behavior has been deprecated, all properties must be looked up on `this` when used in the template: {{[^}]+}}/
);

this.router.map(function () {
this.route('color', { path: '/:color' });
});
Expand All @@ -361,7 +309,7 @@ moduleFor(
strip`
[@model: {{@model}}]
[this.model: {{this.model}}]
[model: {{model}}]
[model: {{this.model}}]
`
);

Expand Down
Expand Up @@ -3515,24 +3515,6 @@ moduleFor(
this.assertComponentElement(this.firstChild, { content: 'hello' });
}

['@test can use `{{component.foo}}` in a template GH#19313']() {
expectDeprecation(
/The `[^`]+` property(?: path)? was used in the `[^`]+` template without using `this`. This fallback behavior has been deprecated, all properties must be looked up on `this` when used in the template: {{[^}]+}}/
);

this.registerComponent('foo-bar', {
template: '{{component.foo}}',
});

this.render('{{foo-bar component=(hash foo="bar")}}');

this.assertComponentElement(this.firstChild, { content: 'bar' });

runTask(() => this.rerender());

this.assertComponentElement(this.firstChild, { content: 'bar' });
}

['@test can use `{{@component.foo}}` in a template GH#19313']() {
this.registerComponent('foo-bar', {
template: '{{@component.foo}}',
Expand Down
Expand Up @@ -197,11 +197,7 @@ if (ENV._TEMPLATE_ONLY_GLIMMER_COMPONENTS) {
}

['@test it renders named arguments as reflected properties']() {
expectDeprecation(
/The `[^`]+` property(?: path)? was used in the `[^`]+` template without using `this`. This fallback behavior has been deprecated, all properties must be looked up on `this` when used in the template: {{[^}]+}}/
);

this.registerTemplateOnlyComponent('foo-bar', '|{{foo}}|{{this.bar}}|');
this.registerTemplateOnlyComponent('foo-bar', '|{{this.foo}}|{{this.bar}}|');

this.render('{{foo-bar foo=this.foo bar=this.bar}}', {
foo: 'foo',
Expand Down
Expand Up @@ -35,10 +35,6 @@ moduleFor(
}

['@test it does not resolve helpers with a `.` (period)']() {
expectDeprecation(
/The `[^`]+` property(?: path)? was used in the `[^`]+` template without using `this`. This fallback behavior has been deprecated, all properties must be looked up on `this` when used in the template: {{[^}]+}}/
);

this.registerHelper('hello.world', () => 'hello world');

this.render('{{hello.world}}', {
Expand Down
Expand Up @@ -725,34 +725,28 @@ class EachTest extends AbstractEachTest {
}

['@test the scoped variable is not available outside the {{#each}} block.']() {
expectDeprecation(
/The `[^`]+` property(?: path)? was used in the `[^`]+` template without using `this`. This fallback behavior has been deprecated, all properties must be looked up on `this` when used in the template: {{[^}]+}}/
);

this.makeList(['Yehuda']);

this.render(`{{name}}-{{#each this.list as |name|}}{{name}}{{/each}}-{{name}}`, {
name: 'Stef',
});
this.render(`{{name}}-{{#each this.list as |name|}}{{name}}{{/each}}-{{name}}`);

this.assertText('Stef-Yehuda-Stef');
this.assertText('-Yehuda-Stef');

runTask(() => this.rerender());

this.assertText('Stef-Yehuda-Stef');
this.assertText('-Yehuda-');

runTask(() => this.pushObjects([' ', 'Katz']));

this.assertText('Stef-Yehuda Katz-Stef');
this.assertText('-Yehuda Katz-');

runTask(() => set(this.context, 'name', 'Tom'));

this.assertText('Tom-Yehuda Katz-Tom');
this.assertText('-Yehuda Katz-');

runTask(() => set(this.context, 'name', 'Stef'));
this.replaceList(['Yehuda']);

this.assertText('Stef-Yehuda-Stef');
this.assertText('-Yehuda-');
}

['@test inverse template is displayed with context']() {
Expand Down Expand Up @@ -946,52 +940,45 @@ class EachTest extends AbstractEachTest {
}

['@test the scoped variable is not available outside the {{#each}} block']() {
expectDeprecation(
/The `[^`]+` property(?: path)? was used in the `[^`]+` template without using `this`. This fallback behavior has been deprecated, all properties must be looked up on `this` when used in the template: {{[^}]+}}/
);

let first = this.createList(['Limbo']);
let fifth = this.createList(['Wrath']);
let ninth = this.createList(['Treachery']);

this.render(
`{{ring}}-{{#each this.first as |ring|}}{{ring}}-{{#each this.fifth as |ring|}}{{ring}}-{{#each this.ninth as |ring|}}{{ring}}-{{/each}}{{ring}}-{{/each}}{{ring}}-{{/each}}{{ring}}`,
{
ring: 'Greed',
first: first.list,
fifth: fifth.list,
ninth: ninth.list,
}
);

this.assertText('Greed-Limbo-Wrath-Treachery-Wrath-Limbo-Greed');
this.assertText('-Limbo-Wrath-Treachery-Wrath-Limbo-');

runTask(() => this.rerender());

this.assertText('Greed-Limbo-Wrath-Treachery-Wrath-Limbo-Greed');
this.assertText('-Limbo-Wrath-Treachery-Wrath-Limbo-');

runTask(() => {
set(this.context, 'ring', 'O');
fifth.delegate.insertAt(0, 'D');
});

this.assertText('O-Limbo-D-Treachery-D-Wrath-Treachery-Wrath-Limbo-O');
this.assertText('-Limbo-D-Treachery-D-Wrath-Treachery-Wrath-Limbo-');

runTask(() => {
first.delegate.pushObject('I');
ninth.delegate.replace(0, 1, ['K']);
});

this.assertText('O-Limbo-D-K-D-Wrath-K-Wrath-Limbo-I-D-K-D-Wrath-K-Wrath-I-O');
this.assertText('-Limbo-D-K-D-Wrath-K-Wrath-Limbo-I-D-K-D-Wrath-K-Wrath-I-');

runTask(() => {
set(this.context, 'ring', 'Greed');
set(this.context, 'first', this.createList(['Limbo']).list);
set(this.context, 'fifth', this.createList(['Wrath']).list);
set(this.context, 'ninth', this.createList(['Treachery']).list);
});

this.assertText('Greed-Limbo-Wrath-Treachery-Wrath-Limbo-Greed');
this.assertText('-Limbo-Wrath-Treachery-Wrath-Limbo-');
}

['@test it should support {{#each this.name as |foo|}}, then {{#each foo as |bar|}}']() {
Expand Down