diff --git a/packages/@ember/-internals/glimmer/tests/integration/application/debug-render-tree-test.ts b/packages/@ember/-internals/glimmer/tests/integration/application/debug-render-tree-test.ts index 0b7adb9c781..904990bbb2b 100644 --- a/packages/@ember/-internals/glimmer/tests/integration/application/debug-render-tree-test.ts +++ b/packages/@ember/-internals/glimmer/tests/integration/application/debug-render-tree-test.ts @@ -181,6 +181,7 @@ if (ENV._DEBUG_RENDER_TREE) { } async '@test named outlets'() { + expectDeprecation('Usage of `renderTemplate` is deprecated.'); this.addTemplate( 'application', strip` diff --git a/packages/@ember/-internals/glimmer/tests/integration/application/rendering-test.js b/packages/@ember/-internals/glimmer/tests/integration/application/rendering-test.js index 687cfdc252e..7efd7402d5b 100644 --- a/packages/@ember/-internals/glimmer/tests/integration/application/rendering-test.js +++ b/packages/@ember/-internals/glimmer/tests/integration/application/rendering-test.js @@ -440,6 +440,7 @@ moduleFor( } ['@test it can render into named outlets']() { + expectDeprecation('Usage of `renderTemplate` is deprecated.'); this.router.map(function () { this.route('colors'); }); @@ -599,6 +600,7 @@ moduleFor( } ['@test it should update correctly when the controller changes']() { + expectDeprecation('Usage of `renderTemplate` is deprecated.'); this.router.map(function () { this.route('color', { path: '/colors/:color' }); }); @@ -643,6 +645,7 @@ moduleFor( } ['@test it should produce a stable DOM when two routes render the same template']() { + expectDeprecation('Usage of `renderTemplate` is deprecated.'); this.router.map(function () { this.route('a'); this.route('b'); diff --git a/packages/@ember/-internals/routing/lib/system/route.ts b/packages/@ember/-internals/routing/lib/system/route.ts index 30169a18520..f57c581ef8c 100644 --- a/packages/@ember/-internals/routing/lib/system/route.ts +++ b/packages/@ember/-internals/routing/lib/system/route.ts @@ -988,6 +988,19 @@ class Route extends EmberObject implements IRoute { this.setupController(controller, context, transition); if (this._environment.options.shouldRender) { + deprecate( + 'Usage of `renderTemplate` is deprecated.', + this.renderTemplate === Route.prototype.renderTemplate, + { + 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', + }, + } + ); this.renderTemplate(controller, context); } diff --git a/packages/ember-testing/tests/acceptance_test.js b/packages/ember-testing/tests/acceptance_test.js index 6ed764cb5e0..c58f7ecac6a 100644 --- a/packages/ember-testing/tests/acceptance_test.js +++ b/packages/ember-testing/tests/acceptance_test.js @@ -125,7 +125,8 @@ if (!jQueryDisabled) { } [`@test helpers can be chained with then`](assert) { - assert.expect(6); + expectDeprecation('Usage of `renderTemplate` is deprecated.'); + assert.expect(7); window .visit('/posts') @@ -164,7 +165,8 @@ if (!jQueryDisabled) { } [`@test helpers can be chained to each other (legacy)`](assert) { - assert.expect(7); + expectDeprecation('Usage of `renderTemplate` is deprecated.'); + assert.expect(8); window .visit('/posts') @@ -192,7 +194,8 @@ if (!jQueryDisabled) { } [`@test helpers don't need to be chained`](assert) { - assert.expect(5); + expectDeprecation('Usage of `renderTemplate` is deprecated.'); + assert.expect(6); window.visit('/posts'); @@ -219,7 +222,8 @@ if (!jQueryDisabled) { } [`@test Nested async helpers`](assert) { - assert.expect(5); + expectDeprecation('Usage of `renderTemplate` is deprecated.'); + assert.expect(6); window.visit('/posts'); @@ -247,7 +251,8 @@ if (!jQueryDisabled) { } [`@test Multiple nested async helpers`](assert) { - assert.expect(3); + expectDeprecation('Usage of `renderTemplate` is deprecated.'); + assert.expect(4); window.visit('/posts'); @@ -270,7 +275,8 @@ if (!jQueryDisabled) { } [`@test Helpers nested in thens`](assert) { - assert.expect(5); + expectDeprecation('Usage of `renderTemplate` is deprecated.'); + assert.expect(6); window.visit('/posts').then(() => { window.click('a:first', '#comments-link'); @@ -311,7 +317,8 @@ if (!jQueryDisabled) { } [`@test Unhandled exceptions are logged via Ember.Test.adapter#exception`](assert) { - assert.expect(2); + expectDeprecation('Usage of `renderTemplate` is deprecated.'); + assert.expect(3); console.error = () => {}; // eslint-disable-line no-console let asyncHandled; @@ -343,7 +350,8 @@ if (!jQueryDisabled) { [`@test Unhandled exceptions in 'andThen' are logged via Ember.Test.adapter#exception`]( assert ) { - assert.expect(1); + expectDeprecation('Usage of `renderTemplate` is deprecated.'); + assert.expect(2); console.error = () => {}; // eslint-disable-line no-console Test.adapter = QUnitAdapter.create({ @@ -364,7 +372,8 @@ if (!jQueryDisabled) { } [`@test should not start routing on the root URL when visiting another`](assert) { - assert.expect(4); + expectDeprecation('Usage of `renderTemplate` is deprecated.'); + assert.expect(5); window.visit('/posts'); @@ -427,7 +436,8 @@ if (!jQueryDisabled) { } [`@test visiting a URL that causes another transition should yield the correct URL`](assert) { - assert.expect(2); + expectDeprecation('Usage of `renderTemplate` is deprecated.'); + assert.expect(3); window.visit('/redirect'); @@ -439,7 +449,8 @@ if (!jQueryDisabled) { [`@test visiting a URL and then visiting a second URL with a transition should yield the correct URL`]( assert ) { - assert.expect(3); + expectDeprecation('Usage of `renderTemplate` is deprecated.'); + assert.expect(4); window.visit('/posts'); diff --git a/packages/ember/tests/routing/decoupled_basic_test.js b/packages/ember/tests/routing/decoupled_basic_test.js index 8e5e13a6c26..9851ff0ccf5 100644 --- a/packages/ember/tests/routing/decoupled_basic_test.js +++ b/packages/ember/tests/routing/decoupled_basic_test.js @@ -919,6 +919,7 @@ moduleFor( } ['@test Router accounts for rootURL on page load when using history location'](assert) { + expectDeprecation('Usage of `renderTemplate` is deprecated.'); let rootURL = window.location.pathname + '/app'; let postsTemplateRendered = false; let setHistory; diff --git a/packages/ember/tests/routing/model_loading_test.js b/packages/ember/tests/routing/model_loading_test.js index 09dac8dbf6a..9a9151286e8 100644 --- a/packages/ember/tests/routing/model_loading_test.js +++ b/packages/ember/tests/routing/model_loading_test.js @@ -204,6 +204,7 @@ moduleFor( } [`@test The route controller specified via controllerName is used in render`](assert) { + expectDeprecation('Usage of `renderTemplate` is deprecated.'); this.router.map(function () { this.route('home', { path: '/' }); }); @@ -484,6 +485,7 @@ moduleFor( } ['@test Nested callbacks are not exited when moving to siblings'](assert) { + expectDeprecation('Usage of `renderTemplate` is deprecated.'); let rootSetup = 0; let rootRender = 0; let rootModel = 0; diff --git a/packages/ember/tests/routing/template_rendering_test.js b/packages/ember/tests/routing/template_rendering_test.js index b1da5207607..df0f00a8ea1 100644 --- a/packages/ember/tests/routing/template_rendering_test.js +++ b/packages/ember/tests/routing/template_rendering_test.js @@ -71,6 +71,7 @@ moduleFor( } [`@test The Homepage with explicit template name in renderTemplate`](assert) { + expectDeprecation('Usage of `renderTemplate` is deprecated.'); this.add( 'route:home', Route.extend({ @@ -87,6 +88,7 @@ moduleFor( } async [`@test an alternate template will pull in an alternate controller`](assert) { + expectDeprecation('Usage of `renderTemplate` is deprecated.'); this.add( 'route:home', Route.extend({ @@ -113,6 +115,7 @@ moduleFor( async [`@test An alternate template will pull in an alternate controller instead of controllerName`]( assert ) { + expectDeprecation('Usage of `renderTemplate` is deprecated.'); this.add( 'route:home', Route.extend({ @@ -147,6 +150,7 @@ moduleFor( } async [`@test The template will pull in an alternate controller via key/value`](assert) { + expectDeprecation('Usage of `renderTemplate` is deprecated.'); this.router.map(function () { this.route('homepage', { path: '/' }); }); @@ -181,6 +185,7 @@ moduleFor( async [`@test The Homepage with explicit template name in renderTemplate and controller`]( assert ) { + expectDeprecation('Usage of `renderTemplate` is deprecated.'); this.add( 'controller:home', Controller.extend({ @@ -205,6 +210,7 @@ moduleFor( } async [`@test Model passed via renderTemplate model is set as controller's model`](assert) { + expectDeprecation('Usage of `renderTemplate` is deprecated.'); this.addTemplate( 'bio', '

Model: {{@model.name}}

Controller: {{this.model.name}}

' @@ -284,6 +290,7 @@ moduleFor( } ['@test templateName is still used when calling render with no name and options'](assert) { + expectDeprecation('Usage of `renderTemplate` is deprecated.'); this.addTemplate('alert', `
Invader!
`); this.addTemplate('home', `

THIS IS THE REAL HOME

{{outlet 'alert'}}`); @@ -305,7 +312,8 @@ moduleFor( } ['@test Generated names can be customized when providing routes with dot notation'](assert) { - assert.expect(4); + expectDeprecation('Usage of `renderTemplate` is deprecated.'); + assert.expect(5); this.addTemplate('index', '
Index
'); this.addTemplate('application', "

Home

{{outlet}}
"); @@ -393,6 +401,7 @@ moduleFor( } ['@test Child routes render into specified template'](assert) { + expectDeprecation('Usage of `renderTemplate` is deprecated.'); this.addTemplate('index', '
Index
'); this.addTemplate('application', "

Home

{{outlet}}
"); this.addTemplate('top', "
{{outlet}}
"); @@ -433,6 +442,7 @@ moduleFor( } ['@test Rendering into specified template with slash notation'](assert) { + expectDeprecation('Usage of `renderTemplate` is deprecated.'); this.addTemplate('person.profile', 'profile {{outlet}}'); this.addTemplate('person.details', 'details!'); @@ -461,6 +471,7 @@ moduleFor( } ['@test Only use route rendered into main outlet for default into property on child'](assert) { + expectDeprecation('Usage of `renderTemplate` is deprecated.'); this.addTemplate('application', "{{outlet 'menu'}}{{outlet}}"); this.addTemplate('posts', '{{outlet}}'); this.addTemplate('posts.index', '

postsIndex

'); @@ -600,6 +611,7 @@ moduleFor( ['@test The template is not re-rendered when two routes present the exact same template & controller']( assert ) { + expectDeprecation('Usage of `renderTemplate` is deprecated.'); this.router.map(function () { this.route('first'); this.route('second'); @@ -678,6 +690,7 @@ moduleFor( } ['@test Route should tear down multiple outlets'](assert) { + expectDeprecation('Usage of `renderTemplate` is deprecated.'); this.addTemplate('application', "{{outlet 'menu'}}{{outlet}}{{outlet 'footer'}}"); this.addTemplate('posts', '{{outlet}}'); this.addTemplate('users', 'users'); @@ -999,7 +1012,8 @@ moduleFor( } ['@test Specifying non-existent controller name in route#render throws'](assert) { - assert.expect(1); + expectDeprecation('Usage of `renderTemplate` is deprecated.'); + assert.expect(2); this.router.map(function () { this.route('home', { path: '/' }); @@ -1049,6 +1063,7 @@ moduleFor( } ['@test Can render into a named outlet at the top level'](assert) { + expectDeprecation('Usage of `renderTemplate` is deprecated.'); this.addTemplate('application', 'A-{{outlet}}-B-{{outlet "other"}}-C'); this.addTemplate('modal', 'Hello world'); this.addTemplate('index', 'The index'); @@ -1079,6 +1094,7 @@ moduleFor( } ['@test Can disconnect a named outlet at the top level'](assert) { + expectDeprecation('Usage of `renderTemplate` is deprecated.'); this.addTemplate('application', 'A-{{outlet}}-B-{{outlet "other"}}-C'); this.addTemplate('modal', 'Hello world'); this.addTemplate('index', 'The index'); @@ -1125,6 +1141,7 @@ moduleFor( } ['@test Can render into a named outlet at the top level, with empty main outlet'](assert) { + expectDeprecation('Usage of `renderTemplate` is deprecated.'); this.addTemplate('application', 'A-{{outlet}}-B-{{outlet "other"}}-C'); this.addTemplate('modal', 'Hello world'); @@ -1185,6 +1202,7 @@ moduleFor( } ["@test Can render routes with no 'main' outlet and their children"](assert) { + expectDeprecation('Usage of `renderTemplate` is deprecated.'); this.addTemplate('application', '
{{outlet "app"}}
'); this.addTemplate( 'app', @@ -1297,6 +1315,7 @@ moduleFor( } ['@test Renders child into parent with non-default template name'](assert) { + expectDeprecation('Usage of `renderTemplate` is deprecated.'); this.addTemplate('application', '
{{outlet}}
'); this.addTemplate('exports.root', '
{{outlet}}
'); this.addTemplate('exports.index', '
');