Skip to content

Commit

Permalink
Fix support for reopening LinkView in 1.13
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike North committed Jun 29, 2015
1 parent 2dcc809 commit 3dea044
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
17 changes: 17 additions & 0 deletions packages/ember-routing-htmlbars/tests/helpers/link-to_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,23 @@ QUnit.test("unescaped inline form (triple curlies) does not escape link title",
equal(view.$('b').length, 1, '<b> was found');
});

QUnit.test("reopening on LinkView actually reopens on LinkComponent", function() {
expect(2);
var oldreopen = Ember.LinkComponent.reopen;

Ember.LinkComponent.reopen = function () {
ok(true, 'reopen was called on LinkComponent');
return oldreopen.apply(this, arguments);
};

expectDeprecation(function () {
Ember.LinkView.reopen({});
});

Ember.LinkComponent.reopen = oldreopen;

});

QUnit.test("unwraps controllers", function() {
var template = "{{#link-to 'index' view.otherController}}Text{{/link-to}}";

Expand Down
11 changes: 9 additions & 2 deletions packages/ember-routing-views/lib/views/link.js
Original file line number Diff line number Diff line change
Expand Up @@ -512,13 +512,20 @@ var DeprecatedLinkView = LinkComponent.extend({
this._super.apply(this, arguments);
}
});
var originalReopen = DeprecatedLinkView.reopen;

DeprecatedLinkView.reopen = function reopenWithDeprecation() {
Ember.deprecate('Ember.LinkView is deprecated. Please use Ember.LinkComponent.', false);

return originalReopen.apply(this, arguments);
return LinkComponent.reopen.apply(LinkComponent, arguments);
};

DeprecatedLinkView.reopenClass({
extend: function () {
Ember.deprecate('Ember.LinkView is deprecated. Please extend from Ember.LinkComponent.', false);
this._super.apply(this, arguments);

This comment has been minimized.

Copy link
@nathanhammond

nathanhammond Jun 30, 2015

Member

@truenorth I believe that we need a return here otherwise when we call extend we get undefined back.

This comment has been minimized.

Copy link
@stefanpenner

stefanpenner Jun 30, 2015

Member

you are correct, mind opening a new issue (or even better a follow up PR)

Be sure to submit it against the stable branch

This comment has been minimized.

Copy link
@mike-north

mike-north Jun 30, 2015

Contributor

Good catch @nathanhammond. Thanks!

}
});

export { DeprecatedLinkView };
/* DeprecatedLinkView - End*/

Expand Down

0 comments on commit 3dea044

Please sign in to comment.