diff --git a/packages/ember-views/lib/mixins/component_template_deprecation.js b/packages/ember-views/lib/mixins/component_template_deprecation.js deleted file mode 100644 index 91263275f84..00000000000 --- a/packages/ember-views/lib/mixins/component_template_deprecation.js +++ /dev/null @@ -1,58 +0,0 @@ -import Ember from 'ember-metal/core'; // Ember.deprecate -import { get } from 'ember-metal/property_get'; -import { Mixin } from 'ember-metal/mixin'; - -/* - The ComponentTemplateDeprecation mixin is used to provide a useful - deprecation warning when using either `template` or `templateName` with - a component. The `template` and `templateName` properties specified at - extend time are moved to `layout` and `layoutName` respectively. - - This is used internally by Ember in `Ember.Component`. -*/ -export default Mixin.create({ - /** - @private - - Moves `templateName` to `layoutName` and `template` to `layout` at extend - time if a layout is not also specified. - - Note that this currently modifies the mixin themselves, which is technically - dubious but is practically of little consequence. This may change in the - future. - - @method willMergeMixin - @since 1.4.0 - */ - willMergeMixin(props) { - // must call _super here to ensure that the ActionHandler - // mixin is setup properly (moves actions -> _actions) - // - // Calling super is only OK here since we KNOW that - // there is another Mixin loaded first. - this._super(...arguments); - - var deprecatedProperty, replacementProperty; - var layoutSpecified = (props.layoutName || props.layout || get(this, 'layoutName')); - - if (props.templateName && !layoutSpecified) { - deprecatedProperty = 'templateName'; - replacementProperty = 'layoutName'; - - props.layoutName = props.templateName; - delete props['templateName']; - } - - if (props.template && !layoutSpecified) { - deprecatedProperty = 'template'; - replacementProperty = 'layout'; - - props.layout = props.template; - delete props['template']; - } - - Ember.deprecate('Do not specify ' + deprecatedProperty + ' on a Component, use ' + replacementProperty + ' instead.', - !deprecatedProperty, - { id: 'ember-views.component-deprecated-template-layout-properties', until: '3.0.0' }); - } -}); diff --git a/packages/ember-views/lib/views/component.js b/packages/ember-views/lib/views/component.js index 5767947860f..d44edefade9 100644 --- a/packages/ember-views/lib/views/component.js +++ b/packages/ember-views/lib/views/component.js @@ -1,6 +1,5 @@ import Ember from 'ember-metal/core'; // Ember.assert, Ember.Handlebars -import ComponentTemplateDeprecation from 'ember-views/mixins/component_template_deprecation'; import TargetActionSupport from 'ember-runtime/mixins/target_action_support'; import View from 'ember-views/views/view'; @@ -113,7 +112,7 @@ function validateAction(component, actionName) { @extends Ember.View @public */ -var Component = View.extend(TargetActionSupport, ComponentTemplateDeprecation, { +var Component = View.extend(TargetActionSupport, { isComponent: true, /* This is set so that the proto inspection in appendTemplatedView does not diff --git a/packages/ember-views/tests/views/component_test.js b/packages/ember-views/tests/views/component_test.js index f7db50c8b02..14ce6b84201 100644 --- a/packages/ember-views/tests/views/component_test.js +++ b/packages/ember-views/tests/views/component_test.js @@ -35,40 +35,6 @@ QUnit.test('The controller (target of `action`) of an Ember.Component is itself' strictEqual(component, component.get('controller'), 'A component\'s controller is itself'); }); -QUnit.test('A templateName specified to a component is moved to the layoutName', function() { - expectDeprecation(/Do not specify templateName on a Component, use layoutName instead/); - component = Component.extend({ - templateName: 'blah-blah' - }).create(); - - equal(component.get('layoutName'), 'blah-blah', 'The layoutName now contains the templateName specified.'); -}); - -QUnit.test('A template specified to a component is moved to the layout', function() { - expectDeprecation(/Do not specify template on a Component, use layout instead/); - component = Component.extend({ - template: 'blah-blah' - }).create(); - - equal(component.get('layout'), 'blah-blah', 'The layoutName now contains the templateName specified.'); -}); - -QUnit.test('A template specified to a component is deprecated', function() { - expectDeprecation(function() { - component = Component.extend({ - template: 'blah-blah' - }).create(); - }, 'Do not specify template on a Component, use layout instead.'); -}); - -QUnit.test('A templateName specified to a component is deprecated', function() { - expectDeprecation(function() { - component = Component.extend({ - templateName: 'blah-blah' - }).create(); - }, 'Do not specify templateName on a Component, use layoutName instead.'); -}); - QUnit.test('Specifying both templateName and layoutName to a component is NOT deprecated', function() { expectNoDeprecation(); component = Component.extend({ diff --git a/packages/ember/tests/component_registration_test.js b/packages/ember/tests/component_registration_test.js index 7aa6b87855e..c6281648a37 100644 --- a/packages/ember/tests/component_registration_test.js +++ b/packages/ember/tests/component_registration_test.js @@ -86,15 +86,13 @@ QUnit.test('If a component is registered, it is used', function() { }); -QUnit.test('Late-registered components can be rendered with custom `template` property (DEPRECATED)', function() { +QUnit.test('Late-registered components can be rendered with custom `layout` property', function() { Ember.TEMPLATES.application = compile('
The files are *inside* the computer?!
") + layout: compile("The files are *inside* the computer?!
") })); var view = View.create();