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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add deprecation for Route#renderTemplate #19433

Merged
Merged
Show file tree
Hide file tree
Changes from 2 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
11 changes: 11 additions & 0 deletions packages/@ember/-internals/routing/lib/system/route.ts
Expand Up @@ -1507,6 +1507,17 @@ class Route extends EmberObject implements IRoute {
@public
*/
renderTemplate(_controller: any, _model: {}) {
if (this.renderTemplate !== Route.prototype.renderTemplate) {
deprecate('Usage of `renderTemplate` is deprecated.', false, {
id: 'route-render-template',
until: '4.0.0',
url: 'https://deprecations.emberjs.com/v3.x/#toc_route-render-template',
for: 'ember-source',
since: {
enabled: '3.27.0',
},
});
}
rwjblue marked this conversation as resolved.
Show resolved Hide resolved
// eslint-disable-line no-unused-vars
this.render();
}
Expand Down
24 changes: 13 additions & 11 deletions packages/ember-testing/tests/acceptance_test.js
Expand Up @@ -51,6 +51,7 @@ if (!jQueryDisabled) {
'route:posts',
Route.extend({
renderTemplate() {
expectDeprecation('Usage of `renderTemplate` is deprecated.');
testContext.currentRoute = 'posts';
this._super(...arguments);
},
Expand All @@ -73,6 +74,7 @@ if (!jQueryDisabled) {
'route:comments',
Route.extend({
renderTemplate() {
expectDeprecation('Usage of `renderTemplate` is deprecated.');
testContext.currentRoute = 'comments';
this._super(...arguments);
},
Expand Down Expand Up @@ -125,7 +127,7 @@ if (!jQueryDisabled) {
}

[`@test helpers can be chained with then`](assert) {
assert.expect(6);
assert.expect(8);

window
.visit('/posts')
Expand Down Expand Up @@ -164,7 +166,7 @@ if (!jQueryDisabled) {
}

[`@test helpers can be chained to each other (legacy)`](assert) {
assert.expect(7);
assert.expect(10);

window
.visit('/posts')
Expand Down Expand Up @@ -192,7 +194,7 @@ if (!jQueryDisabled) {
}

[`@test helpers don't need to be chained`](assert) {
assert.expect(5);
assert.expect(8);

window.visit('/posts');

Expand All @@ -219,7 +221,7 @@ if (!jQueryDisabled) {
}

[`@test Nested async helpers`](assert) {
assert.expect(5);
assert.expect(8);

window.visit('/posts');

Expand Down Expand Up @@ -247,7 +249,7 @@ if (!jQueryDisabled) {
}

[`@test Multiple nested async helpers`](assert) {
assert.expect(3);
assert.expect(5);

window.visit('/posts');

Expand All @@ -270,7 +272,7 @@ if (!jQueryDisabled) {
}

[`@test Helpers nested in thens`](assert) {
assert.expect(5);
assert.expect(8);

window.visit('/posts').then(() => {
window.click('a:first', '#comments-link');
Expand Down Expand Up @@ -311,7 +313,7 @@ if (!jQueryDisabled) {
}

[`@test Unhandled exceptions are logged via Ember.Test.adapter#exception`](assert) {
assert.expect(2);
assert.expect(3);

console.error = () => {}; // eslint-disable-line no-console
let asyncHandled;
Expand Down Expand Up @@ -343,7 +345,7 @@ if (!jQueryDisabled) {
[`@test Unhandled exceptions in 'andThen' are logged via Ember.Test.adapter#exception`](
assert
) {
assert.expect(1);
assert.expect(2);

console.error = () => {}; // eslint-disable-line no-console
Test.adapter = QUnitAdapter.create({
Expand All @@ -364,7 +366,7 @@ if (!jQueryDisabled) {
}

[`@test should not start routing on the root URL when visiting another`](assert) {
assert.expect(4);
assert.expect(5);

window.visit('/posts');

Expand Down Expand Up @@ -427,7 +429,7 @@ if (!jQueryDisabled) {
}

[`@test visiting a URL that causes another transition should yield the correct URL`](assert) {
assert.expect(2);
assert.expect(3);

window.visit('/redirect');

Expand All @@ -439,7 +441,7 @@ if (!jQueryDisabled) {
[`@test visiting a URL and then visiting a second URL with a transition should yield the correct URL`](
assert
) {
assert.expect(3);
assert.expect(5);

window.visit('/posts');

Expand Down
3 changes: 2 additions & 1 deletion packages/ember/tests/routing/template_rendering_test.js
Expand Up @@ -305,7 +305,7 @@ moduleFor(
}

['@test Generated names can be customized when providing routes with dot notation'](assert) {
assert.expect(4);
assert.expect(5);

this.addTemplate('index', '<div>Index</div>');
this.addTemplate('application', "<h1>Home</h1><div class='main'>{{outlet}}</div>");
Expand All @@ -325,6 +325,7 @@ moduleFor(
'route:foo',
Route.extend({
renderTemplate() {
expectDeprecation('Usage of `renderTemplate` is deprecated.');
assert.ok(true, 'FooBarRoute was called');
return this._super(...arguments);
},
Expand Down