From 51b3a9ef6a1949d4051c9108cb1cc204e1e2cff2 Mon Sep 17 00:00:00 2001 From: Matthew Beale Date: Tue, 3 Aug 2021 20:59:53 -0400 Subject: [PATCH] Remove {{partial}} --- packages/@ember/-internals/glimmer/index.ts | 41 -- .../@ember/-internals/glimmer/lib/resolver.ts | 77 +--- .../integration/application/engine-test.js | 150 ------- .../components/curly-components-test.js | 44 -- .../tests/integration/helpers/partial-test.js | 424 ------------------ packages/@ember/deprecated-features/index.ts | 1 - .../lib/test-cases/rendering.js | 10 - tests/docs/expected.js | 1 - 8 files changed, 3 insertions(+), 745 deletions(-) delete mode 100644 packages/@ember/-internals/glimmer/tests/integration/helpers/partial-test.js diff --git a/packages/@ember/-internals/glimmer/index.ts b/packages/@ember/-internals/glimmer/index.ts index cf7ecfdd08b..5028dea2934 100644 --- a/packages/@ember/-internals/glimmer/index.ts +++ b/packages/@ember/-internals/glimmer/index.ts @@ -292,47 +292,6 @@ @public */ -/** - The `partial` helper renders another template without - changing the template context: - - ```handlebars - {{foo}} - {{partial "nav"}} - ``` - - The above example template will render a template named - "-nav", which has the same context as the parent template - it's rendered into, so if the "-nav" template also referenced - `{{foo}}`, it would print the same thing as the `{{foo}}` - in the above example. - - If a "-nav" template isn't found, the `partial` helper will - fall back to a template named "nav". - - ### Bound template names - - The parameter supplied to `partial` can also be a path - to a property containing a template name, e.g.: - - ```handlebars - {{partial someTemplateName}} - ``` - - The above example will look up the value of `someTemplateName` - on the template context (e.g. a controller) and use that - value as the name of the template to render. If the resolved - value is falsy, nothing will be rendered. If `someTemplateName` - changes, the partial will be re-rendered using the new template - name. - - @method partial - @for Ember.Templates.helpers - @param {String} partialName The name of the template to render minus the leading underscore. - @deprecated Use a component instead - @public -*/ - export { templateFactory as template, templateCacheCounters } from '@glimmer/opcode-compiler'; export { default as RootTemplate } from './lib/templates/root'; diff --git a/packages/@ember/-internals/glimmer/lib/resolver.ts b/packages/@ember/-internals/glimmer/lib/resolver.ts index c20abe47c5f..e5e786210dc 100644 --- a/packages/@ember/-internals/glimmer/lib/resolver.ts +++ b/packages/@ember/-internals/glimmer/lib/resolver.ts @@ -1,9 +1,7 @@ import { privatize as P } from '@ember/-internals/container'; import { ENV } from '@ember/-internals/environment'; import { Factory, FactoryClass, LookupOptions, Owner } from '@ember/-internals/owner'; -import { assert, deprecate } from '@ember/debug'; -import { PARTIALS } from '@ember/deprecated-features'; -import EmberError from '@ember/error'; +import { assert } from '@ember/debug'; import { _instrumentStart } from '@ember/instrumentation'; import { DEBUG } from '@glimmer/env'; import { @@ -11,7 +9,6 @@ import { HelperDefinitionState, ModifierDefinitionState, Option, - PartialDefinition, ResolvedComponentDefinition, RuntimeResolver, Template, @@ -22,7 +19,6 @@ import { getInternalComponentManager, setInternalHelperManager, } from '@glimmer/manager'; -import { PartialDefinitionImpl } from '@glimmer/opcode-compiler'; import { array, concat, @@ -114,66 +110,6 @@ function lookupComponentPair( } } -let lookupPartial: { templateName: string; owner: Owner } | any; -let templateFor: { owner: Owner; underscored: string; name: string } | any; -let parseUnderscoredName: { templateName: string } | any; - -if (PARTIALS) { - lookupPartial = function (templateName: string, owner: Owner) { - deprecate( - `The use of \`{{partial}}\` is deprecated, please refactor the "${templateName}" partial to a component`, - false, - { - id: 'ember-views.partial', - until: '4.0.0', - url: 'https://deprecations.emberjs.com/v3.x#toc_ember-views-partial', - for: 'ember-source', - since: { - enabled: '3.15.0-beta.1', - }, - } - ); - - if (templateName === null) { - return; - } - - let template = templateFor(owner, parseUnderscoredName(templateName), templateName); - - assert(`Unable to find partial with name "${templateName}"`, Boolean(template)); - - return template; - }; - - templateFor = function (owner: any, underscored: string, name: string) { - if (PARTIALS) { - if (!name) { - return; - } - assert(`templateNames are not allowed to contain periods: ${name}`, name.indexOf('.') === -1); - - if (!owner) { - throw new EmberError( - 'Container was not found when looking up a views template. ' + - 'This is most likely due to manually instantiating an Ember.View. ' + - 'See: http://git.io/EKPpnA' - ); - } - - return owner.lookup(`template:${underscored}`) || owner.lookup(`template:${name}`); - } - }; - - parseUnderscoredName = function (templateName: string) { - let nameParts = templateName.split('/'); - let lastPart = nameParts[nameParts.length - 1]; - - nameParts[nameParts.length - 1] = `_${lastPart}`; - - return nameParts.join('/'); - }; -} - const BUILTIN_KEYWORD_HELPERS = { action, mut, @@ -227,15 +163,8 @@ const CLASSIC_HELPER_MANAGER_ASSOCIATED = new _WeakSet(); export default class ResolverImpl implements RuntimeResolver, CompileTimeResolver { private componentDefinitionCache: Map = new Map(); - lookupPartial(name: string, owner: Owner): Option { - if (PARTIALS) { - let templateFactory = lookupPartial(name, owner); - let template = templateFactory(owner); - - return new PartialDefinitionImpl(name, template); - } else { - return null; - } + lookupPartial(): null { + return null; } lookupHelper(name: string, owner: Owner): Option { diff --git a/packages/@ember/-internals/glimmer/tests/integration/application/engine-test.js b/packages/@ember/-internals/glimmer/tests/integration/application/engine-test.js index 49f3499b046..c070afe2bf5 100644 --- a/packages/@ember/-internals/glimmer/tests/integration/application/engine-test.js +++ b/packages/@ember/-internals/glimmer/tests/integration/application/engine-test.js @@ -157,44 +157,6 @@ moduleFor( ); } - setupAppAndRoutableEngineWithPartial(hooks) { - this.addTemplate('application', 'Application{{outlet}}'); - - this.router.map(function () { - this.mount('blog'); - }); - this.add('route-map:blog', function () {}); - this.add( - 'route:application', - Route.extend({ - model() { - hooks.push('application - application'); - }, - }) - ); - - this.add( - 'engine:blog', - Engine.extend({ - Resolver: ModuleBasedTestResolver, - - init() { - this._super(...arguments); - this.register('template:foo', compile('foo partial')); - this.register('template:application', compile('Engine{{outlet}} {{partial "foo"}}')); - this.register( - 'route:application', - Route.extend({ - model() { - hooks.push('engine - application'); - }, - }) - ); - }, - }) - ); - } - setupRoutelessEngine(hooks) { this.addTemplate('application', 'Application{{mount "chat-engine"}}'); this.add( @@ -207,82 +169,14 @@ moduleFor( ); } - setupAppAndRoutlessEngineWithPartial(hooks) { - this.setupRoutelessEngine(hooks); - - this.add( - 'engine:chat-engine', - Engine.extend({ - Resolver: ModuleBasedTestResolver, - - init() { - this._super(...arguments); - this.register('template:foo', compile('foo partial')); - this.register('template:application', compile('Engine {{partial "foo"}}')); - this.register( - 'controller:application', - Controller.extend({ - init() { - this._super(...arguments); - hooks.push('engine - application'); - }, - }) - ); - }, - }) - ); - } - additionalEngineRegistrations(callback) { this._additionalEngineRegistrations = callback; } - setupEngineWithAttrs() { - this.addTemplate('application', 'Application{{mount "chat-engine"}}'); - - this.add( - 'engine:chat-engine', - Engine.extend({ - Resolver: ModuleBasedTestResolver, - - init() { - this._super(...arguments); - this.register('template:components/foo-bar', compile(`{{partial "troll"}}`)); - this.register('template:troll', compile('{{attrs.wat}}')); - this.register( - 'controller:application', - Controller.extend({ - contextType: 'Engine', - }) - ); - this.register( - 'template:application', - compile('Engine {{foo-bar wat=this.contextType}}') - ); - }, - }) - ); - } - stringsEndWith(str, suffix) { return str.indexOf(suffix, str.length - suffix.length) !== -1; } - ['@test attrs in an engine']() { - expectDeprecation( - `The use of \`{{partial}}\` is deprecated, please refactor the "troll" partial to a component` - ); - expectDeprecation( - 'Using {{attrs}} to reference named arguments has been deprecated. {{attrs.wat}} should be updated to {{@wat}}. (L1:C2) ' - ); - - this.setupEngineWithAttrs([]); - - return this.visit('/').then(() => { - this.assertText('ApplicationEngine Engine'); - }); - } - ['@test sharing a template between engine and application has separate refinements']() { this.assert.expect(2); @@ -467,50 +361,6 @@ moduleFor( }); } - ['@test visit() with partials in routable engine'](assert) { - assert.expect(3); - - expectDeprecation( - `The use of \`{{partial}}\` is deprecated, please refactor the "foo" partial to a component` - ); - - let hooks = []; - - this.setupAppAndRoutableEngineWithPartial(hooks); - - return this.visit('/blog', { shouldRender: true }).then(() => { - this.assertText('ApplicationEngine foo partial'); - - this.assert.deepEqual( - hooks, - ['application - application', 'engine - application'], - 'the expected hooks were fired' - ); - }); - } - - ['@test visit() with partials in non-routable engine'](assert) { - assert.expect(3); - - expectDeprecation( - `The use of \`{{partial}}\` is deprecated, please refactor the "foo" partial to a component` - ); - - let hooks = []; - - this.setupAppAndRoutlessEngineWithPartial(hooks); - - return this.visit('/', { shouldRender: true }).then(() => { - this.assertText('ApplicationEngine foo partial'); - - this.assert.deepEqual( - hooks, - ['application - application', 'engine - application'], - 'the expected hooks were fired' - ); - }); - } - ['@test deactivate should be called on Engine Routes before destruction'](assert) { assert.expect(3); diff --git a/packages/@ember/-internals/glimmer/tests/integration/components/curly-components-test.js b/packages/@ember/-internals/glimmer/tests/integration/components/curly-components-test.js index 5932a7a9e0c..edbc4e56acb 100644 --- a/packages/@ember/-internals/glimmer/tests/integration/components/curly-components-test.js +++ b/packages/@ember/-internals/glimmer/tests/integration/components/curly-components-test.js @@ -746,50 +746,6 @@ moduleFor( }); } - ['@test it can render a basic component with a block when the yield is in a partial']() { - this.registerPartial('_partialWithYield', 'yielded: [{{yield}}]'); - - this.registerComponent('foo-bar', { - template: '{{partial "partialWithYield"}} - In component', - }); - - expectDeprecation(() => { - this.render('{{#foo-bar}}hello{{/foo-bar}}'); - }, 'The use of `{{partial}}` is deprecated, please refactor the "partialWithYield" partial to a component'); - - this.assertComponentElement(this.firstChild, { - content: 'yielded: [hello] - In component', - }); - - runTask(() => this.rerender()); - - this.assertComponentElement(this.firstChild, { - content: 'yielded: [hello] - In component', - }); - } - - ['@test it can render a basic component with a block param when the yield is in a partial']() { - this.registerPartial('_partialWithYield', 'yielded: [{{yield "hello"}}]'); - - this.registerComponent('foo-bar', { - template: '{{partial "partialWithYield"}} - In component', - }); - - expectDeprecation(() => { - this.render('{{#foo-bar as |value|}}{{value}}{{/foo-bar}}'); - }, 'The use of `{{partial}}` is deprecated, please refactor the "partialWithYield" partial to a component'); - - this.assertComponentElement(this.firstChild, { - content: 'yielded: [hello] - In component', - }); - - runTask(() => this.rerender()); - - this.assertComponentElement(this.firstChild, { - content: 'yielded: [hello] - In component', - }); - } - ['@test it renders the layout with the component instance as the context']() { let instance; diff --git a/packages/@ember/-internals/glimmer/tests/integration/helpers/partial-test.js b/packages/@ember/-internals/glimmer/tests/integration/helpers/partial-test.js deleted file mode 100644 index 1f0b9b10e56..00000000000 --- a/packages/@ember/-internals/glimmer/tests/integration/helpers/partial-test.js +++ /dev/null @@ -1,424 +0,0 @@ -import { RenderingTestCase, moduleFor, strip, runTask } from 'internal-test-helpers'; - -import { set } from '@ember/-internals/metal'; -import { A as emberA } from '@ember/-internals/runtime'; - -moduleFor( - 'Helpers test: {{partial}}', - class extends RenderingTestCase { - ['@test should render other templates registered with the container']() { - this.registerPartial('_subTemplateFromContainer', 'sub-template'); - - expectDeprecation(() => { - this.render(`This {{partial "subTemplateFromContainer"}} is pretty great.`); - }, 'The use of `{{partial}}` is deprecated, please refactor the "subTemplateFromContainer" partial to a component'); - - this.assertStableRerender(); - - this.assertText('This sub-template is pretty great.'); - } - - ['@test should render other slash-separated templates registered with the container']() { - this.registerPartial('child/_subTemplateFromContainer', 'sub-template'); - - expectDeprecation(() => { - this.render(`This {{partial "child/subTemplateFromContainer"}} is pretty great.`); - }, 'The use of `{{partial}}` is deprecated, please refactor the "child/subTemplateFromContainer" partial to a component'); - - this.assertStableRerender(); - - this.assertText('This sub-template is pretty great.'); - } - - ['@test should use the current context']() { - this.registerPartial('_person_name', '{{this.model.firstName}} {{this.model.lastName}}'); - - expectDeprecation(() => { - this.render('Who is {{partial "person_name"}}?', { - model: { - firstName: 'Kris', - lastName: 'Selden', - }, - }); - }, 'The use of `{{partial}}` is deprecated, please refactor the "person_name" partial to a component'); - - this.assertStableRerender(); - - this.assertText('Who is Kris Selden?'); - - runTask(() => set(this.context, 'model.firstName', 'Kelly')); - - this.assertText('Who is Kelly Selden?'); - - runTask(() => set(this.context, 'model', { firstName: 'Kris', lastName: 'Selden' })); - - this.assertText('Who is Kris Selden?'); - } - - ['@test Quoteless parameters passed to {{partial}} perform a bound property lookup of the partial name']() { - this.registerPartial('_subTemplate', 'sub-template'); - this.registerPartial('_otherTemplate', 'other-template'); - - expectDeprecation(() => { - this.render( - 'This {{partial this.templates.partialName}} is pretty {{partial this.nonexistent}}great.', - { - templates: { partialName: 'subTemplate' }, - } - ); - }, 'The use of `{{partial}}` is deprecated, please refactor the "subTemplate" partial to a component'); - - this.assertStableRerender(); - - this.assertText('This sub-template is pretty great.'); - - expectDeprecation(() => { - runTask(() => set(this.context, 'templates.partialName', 'otherTemplate')); - }, 'The use of `{{partial}}` is deprecated, please refactor the "otherTemplate" partial to a component'); - - this.assertText('This other-template is pretty great.'); - - runTask(() => set(this.context, 'templates.partialName', null)); - - this.assertText('This is pretty great.'); - - expectDeprecation(() => { - runTask(() => set(this.context, 'templates', { partialName: 'subTemplate' })); - }, 'The use of `{{partial}}` is deprecated, please refactor the "subTemplate" partial to a component'); - - this.assertText('This sub-template is pretty great.'); - } - - ['@test 1234 partial using data from {{#each}}']() { - this.registerPartial('show-item', '{{item}}'); - - expectDeprecation(() => { - this.render( - strip` - {{#each this.model.items as |item|}} - {{item}}: {{partial 'show-item'}} | - {{/each}}`, - { - model: { - items: emberA(['apple', 'orange', 'banana']), - }, - } - ); - }, 'The use of `{{partial}}` is deprecated, please refactor the "show-item" partial to a component'); - - this.assertStableRerender(); - - this.assertText('apple: apple |orange: orange |banana: banana |'); - - expectDeprecation(() => { - runTask(() => this.context.model.items.pushObject('strawberry')); - }, 'The use of `{{partial}}` is deprecated, please refactor the "show-item" partial to a component'); - - this.assertText('apple: apple |orange: orange |banana: banana |strawberry: strawberry |'); - - runTask(() => - set(this.context, 'model', { - items: emberA(['apple', 'orange', 'banana']), - }) - ); - - this.assertText('apple: apple |orange: orange |banana: banana |'); - } - - ['@test partial using `{{get` on data from {{#let}}']() { - this.registerPartial('show-id', '{{get item "id"}}'); - - expectDeprecation(() => { - this.render( - strip` - {{#let this.model as |item|}} - {{item.name}}: {{partial 'show-id'}} - {{/let}}`, - { - model: { id: 1, name: 'foo' }, - } - ); - }, 'The use of `{{partial}}` is deprecated, please refactor the "show-id" partial to a component'); - - this.assertStableRerender(); - - this.assertText('foo: 1'); - - runTask(() => set(this.context, 'model.id', 2)); - - this.assertText('foo: 2'); - - runTask(() => set(this.context, 'model.name', 'bar')); - - this.assertText('bar: 2'); - - runTask(() => set(this.context, 'model', { id: 1, name: 'foo' })); - - this.assertText('foo: 1'); - } - - ['@test partial using `{{get` on data from {{#each}}']() { - this.registerPartial('show-item', '{{get item "id"}}'); - - expectDeprecation(() => { - this.render( - strip` - {{#each this.items as |item|}} - {{item.id}}: {{partial 'show-item'}} | - {{/each}}`, - { - items: emberA([{ id: 1 }, { id: 2 }, { id: 3 }]), - } - ); - }, 'The use of `{{partial}}` is deprecated, please refactor the "show-item" partial to a component'); - - this.assertStableRerender(); - - this.assertText('1: 1 |2: 2 |3: 3 |'); - - expectDeprecation(() => { - runTask(() => this.context.items.pushObject({ id: 4 })); - }, 'The use of `{{partial}}` is deprecated, please refactor the "show-item" partial to a component'); - - this.assertText('1: 1 |2: 2 |3: 3 |4: 4 |'); - - expectDeprecation(() => { - runTask(() => set(this.context, 'items', emberA([{ id: 1 }, { id: 2 }, { id: 3 }]))); - }, 'The use of `{{partial}}` is deprecated, please refactor the "show-item" partial to a component'); - - this.assertText('1: 1 |2: 2 |3: 3 |'); - } - - ['@test partial using conditional on data from {{#each}}']() { - this.registerPartial('show-item', '{{#if item}}{{item}}{{/if}}'); - - expectDeprecation(() => { - this.render( - strip` - {{#each this.items as |item|}} - {{item}}: {{partial 'show-item'}} | - {{/each}}`, - { - items: emberA(['apple', null, 'orange', 'banana']), - } - ); - }, 'The use of `{{partial}}` is deprecated, please refactor the "show-item" partial to a component'); - - this.assertStableRerender(); - - this.assertText('apple: apple |: |orange: orange |banana: banana |'); - - expectDeprecation(() => { - runTask(() => this.context.items.pushObject('strawberry')); - }, 'The use of `{{partial}}` is deprecated, please refactor the "show-item" partial to a component'); - - this.assertText('apple: apple |: |orange: orange |banana: banana |strawberry: strawberry |'); - - runTask(() => set(this.context, 'items', emberA(['apple', null, 'orange', 'banana']))); - - this.assertText('apple: apple |: |orange: orange |banana: banana |'); - } - - ['@test nested partials using data from {{#each}}']() { - this.registerPartial( - '_outer-partial', - strip` - [outer: {{name}}] {{partial 'inner-partial'}} - ` - ); - - this.registerPartial('inner-partial', '[inner: {{name}}]'); - - expectDeprecation(() => { - this.render( - strip` - {{#each this.names as |name i|}} - {{i}}: {{partial 'outer-partial'}} - {{/each}}`, - { - names: emberA(['Alex', 'Ben']), - } - ); - }, /The use of `{{partial}}` is deprecated, please refactor the "(inner|outer)-partial" partial to a component/); - - this.assertStableRerender(); - - this.assertText('0: [outer: Alex] [inner: Alex]1: [outer: Ben] [inner: Ben]'); - - expectDeprecation(() => { - runTask(() => this.context.names.pushObject('Sophie')); - }, /The use of `{{partial}}` is deprecated, please refactor the "(inner|outer)-partial" partial to a component/); - - this.assertText( - '0: [outer: Alex] [inner: Alex]1: [outer: Ben] [inner: Ben]2: [outer: Sophie] [inner: Sophie]' - ); - - runTask(() => set(this.context, 'names', emberA(['Alex', 'Ben']))); - - this.assertText('0: [outer: Alex] [inner: Alex]1: [outer: Ben] [inner: Ben]'); - } - - ['@test nested partials within nested `{{#let}}` blocks']() { - this.registerPartial( - '_person2-partial', - strip` - {{#let 'Ben' as |person2|}} - Hi {{person1}} (aged {{age}}) and {{person2}}. {{partial 'person3-partial'}} - {{/let}} - ` - ); - - this.registerPartial( - '_person3-partial', - strip` - {{#let 'Alex' as |person3|}} - Hi {{person1}} (aged {{age}}), {{person2}} and {{person3}}. {{partial 'person4-partial'}} - {{/let}} - ` - ); - - this.registerPartial( - '_person4-partial', - strip` - {{#let 'Sarah' as |person4|}} - Hi {{person1}} (aged {{age}}), {{person2}}, {{person3}} and {{person4}}. - {{/let}} - ` - ); - - expectDeprecation(() => { - this.render( - strip` - {{#let 'Sophie' as |person1|}} - Hi {{person1}} (aged {{this.age}}). {{partial 'person2-partial'}} - {{/let}}`, - { age: 0 } - ); - }, /The use of `{{partial}}` is deprecated, please refactor the "person(2|3|4)-partial" partial to a component/); - - this.assertStableRerender(); - - this.assertText( - 'Hi Sophie (aged 0). Hi Sophie (aged 0) and Ben. Hi Sophie (aged 0), Ben and Alex. Hi Sophie (aged 0), Ben, Alex and Sarah.' - ); - - runTask(() => set(this.context, 'age', 1)); - - this.assertText( - 'Hi Sophie (aged 1). Hi Sophie (aged 1) and Ben. Hi Sophie (aged 1), Ben and Alex. Hi Sophie (aged 1), Ben, Alex and Sarah.' - ); - - runTask(() => set(this.context, 'age', 0)); - - this.assertText( - 'Hi Sophie (aged 0). Hi Sophie (aged 0) and Ben. Hi Sophie (aged 0), Ben and Alex. Hi Sophie (aged 0), Ben, Alex and Sarah.' - ); - } - - ['@test dynamic partials in {{#each}}']() { - this.registerPartial('_odd', 'ODD{{i}}'); - this.registerPartial('_even', 'EVEN{{i}}'); - - expectDeprecation(() => { - this.render( - strip` - {{#each this.model.items as |template i|}} - {{this.model.type}}: {{partial template}} - {{/each}}`, - { - model: { - items: ['even', 'odd', 'even', 'odd'], - type: 'number', - }, - } - ); - }, /The use of `{{partial}}` is deprecated, please refactor the "(odd|even)" partial to a component/); - - this.assertStableRerender(); - - this.assertText('number: EVEN0number: ODD1number: EVEN2number: ODD3'); - - runTask(() => set(this.context, 'model.type', 'integer')); - - this.assertText('integer: EVEN0integer: ODD1integer: EVEN2integer: ODD3'); - - runTask(() => - set(this.context, 'model', { - items: ['even', 'odd', 'even', 'odd'], - type: 'number', - }) - ); - - this.assertText('number: EVEN0number: ODD1number: EVEN2number: ODD3'); - } - - ['@test dynamic partials in {{#let}}']() { - this.registerPartial('_thing', '{{t}}'); - - this.render( - strip` - {{#let this.item.thing as |t|}} - {{partial t}} - {{/let}}`, - { - item: { thing: null }, - } - ); - - this.assertStableRerender(); - - this.assertText(''); - - expectDeprecation(() => { - runTask(() => set(this.context, 'item.thing', 'thing')); - }, 'The use of `{{partial}}` is deprecated, please refactor the "thing" partial to a component'); - - this.assertText('thing'); - - runTask(() => set(this.context, 'item', { thing: null })); - - this.assertText(''); - } - - ['@test partials which contain contextual components']() { - this.registerComponent('outer-component', { - template: '{{yield (hash inner=(component "inner-component" name=this.name))}}', - }); - - this.registerComponent('inner-component', { - template: '{{yield (hash name=this.name)}}', - }); - - this.registerPartial( - '_some-partial', - strip` - {{#outer.inner as |inner|}} - inner.name: {{inner.name}} - {{/outer.inner}} - ` - ); - - expectDeprecation(() => { - this.render( - strip` - {{#outer-component name=this.name as |outer|}} - {{partial 'some-partial'}} - {{/outer-component}}`, - { name: 'Sophie' } - ); - }, 'The use of `{{partial}}` is deprecated, please refactor the "some-partial" partial to a component'); - - this.assertStableRerender(); - - this.assertText('inner.name: Sophie'); - - runTask(() => set(this.context, 'name', 'Ben')); - - this.assertText('inner.name: Ben'); - - runTask(() => set(this.context, 'name', 'Sophie')); - - this.assertText('inner.name: Sophie'); - } - } -); diff --git a/packages/@ember/deprecated-features/index.ts b/packages/@ember/deprecated-features/index.ts index 62fa61f47a4..45d9c852108 100644 --- a/packages/@ember/deprecated-features/index.ts +++ b/packages/@ember/deprecated-features/index.ts @@ -7,5 +7,4 @@ export const ROUTER_EVENTS = !!'4.0.0'; export const JQUERY_INTEGRATION = !!'3.9.0'; export const APP_CTRL_ROUTER_PROPS = !!'3.10.0-beta.1'; export const MOUSE_ENTER_LEAVE_MOVE_EVENTS = !!'3.13.0-beta.1'; -export const PARTIALS = !!'3.15.0-beta.1'; export const ASSIGN = !!'4.0.0-beta.1'; diff --git a/packages/internal-test-helpers/lib/test-cases/rendering.js b/packages/internal-test-helpers/lib/test-cases/rendering.js index 3760da0de54..b3c59286749 100644 --- a/packages/internal-test-helpers/lib/test-cases/rendering.js +++ b/packages/internal-test-helpers/lib/test-cases/rendering.js @@ -153,16 +153,6 @@ export default class RenderingTestCase extends AbstractTestCase { this.owner.register(`helper:${name}`, definition); } - registerPartial(name, template) { - let owner = this.owner; - if (typeof template === 'string') { - owner.register( - `template:${name}`, - this.compile(template, { moduleName: `my-app/templates/-${name}.hbs` }) - ); - } - } - registerComponent(name, { ComponentClass = Component, template = null }) { let { owner } = this; diff --git a/tests/docs/expected.js b/tests/docs/expected.js index 925a25b1ca7..39ab2241f47 100644 --- a/tests/docs/expected.js +++ b/tests/docs/expected.js @@ -406,7 +406,6 @@ module.exports = { 'parent', 'parentView', 'parentViewDidChange', - 'partial', 'pattern', 'pauseTest', 'popObject',