Skip to content

Commit

Permalink
Merge pull request #12017 from rwjblue/deprecate-render-function
Browse files Browse the repository at this point in the history
[BUGFIX release] Deprecate specifying `.render` to views/components.
  • Loading branch information
rwjblue committed Aug 8, 2015
2 parents 7f62867 + 32fb31a commit 4feb881
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -790,7 +790,7 @@ QUnit.test('non-expression hasBlockParams', function() {
});

QUnit.test('implementing `render` allows pushing into a string buffer', function() {
expect(1);
expect(2);

registry.register('component:non-block', Component.extend({
render(buffer) {
Expand All @@ -803,6 +803,8 @@ QUnit.test('implementing `render` allows pushing into a string buffer', function
container: container
}).create();

expectDeprecation('Using a custom `.render` function is deprecated and will be removed in Ember 2.0.0.');

runAppend(view);

equal(view.$('#zomg').text(), 'Whoop!');
Expand Down Expand Up @@ -1301,7 +1303,10 @@ if (isEnabled('ember-htmlbars-component-generation')) {
});

QUnit.test('implementing `render` allows pushing into a string buffer', function() {
expect(1);
expect(2);

// this deprecation is fired upon init
expectDeprecation('Using a custom `.render` function is deprecated and will be removed in Ember 2.0.0.');

registry.register('component:non-block', Component.extend({
render(buffer) {
Expand Down
6 changes: 6 additions & 0 deletions packages/ember-views/lib/views/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -1311,6 +1311,12 @@ var View = CoreView.extend(
}

this.renderer.componentInitAttrs(this, this.attrs || {});

Ember.deprecate(
'Using a custom `.render` function is deprecated and will be removed in Ember 2.0.0.',
!this.render,
{ id: 'ember-views.render', until: '2.0.0' }
);
},

__defineNonEnumerable(property) {
Expand Down
2 changes: 2 additions & 0 deletions packages/ember-views/tests/compat/view_render_hook_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ var view, parentView, originalViewKeyword;

QUnit.module('ember-views: View#render hook', {
setup() {
expectDeprecation('Using a custom `.render` function is deprecated and will be removed in Ember 2.0.0.');

originalViewKeyword = registerKeyword('view', viewKeyword);
},
teardown() {
Expand Down

0 comments on commit 4feb881

Please sign in to comment.