Skip to content

Commit

Permalink
[BUGFIX release] Fix nested render helpers
Browse files Browse the repository at this point in the history
  • Loading branch information
Andy Waer committed Apr 7, 2015
1 parent 2390ea9 commit 53832b3
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
7 changes: 7 additions & 0 deletions packages/ember-routing-htmlbars/lib/helpers/render.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,13 @@ function impersonateAnOutlet(currentView, view, name) {
view._isOutlet = true;
view._outletName = '__ember_orphans__';
view._matchOutletName = name;
view._parentOutlet = function() {
var parent = this._parentView;
while (parent && !parent._isOutlet) {
parent = parent._parentView;
}
return parent;
};
view.setOutletState = function(state) {
var ownState;
if (state && (ownState = state.outlets[this._matchOutletName])) {
Expand Down
17 changes: 17 additions & 0 deletions packages/ember-routing-htmlbars/tests/helpers/render_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,23 @@ QUnit.test("{{render}} helper should render given template", function() {
ok(container.lookup('router:main')._lookupActiveView('home'), 'should register home as active view');
});

QUnit.test("{{render}} helper should render nested helpers", function() {
var template = "<h1>HI</h1>{{render 'foo'}}";
var controller = EmberController.extend({ container: container });
view = EmberView.create({
controller: controller.create(),
template: compile(template)
});

Ember.TEMPLATES['foo'] = compile("<p>FOO</p>{{render 'bar'}}");
Ember.TEMPLATES['bar'] = compile("<p>BAR</p>{{render 'baz'}}");
Ember.TEMPLATES['baz'] = compile("<p>BAZ</p>");

runAppend(view);

equal(view.$().text(), 'HIFOOBARBAZ');
});

QUnit.test("{{render}} helper should have assertion if neither template nor view exists", function() {
var template = "<h1>HI</h1>{{render 'oops'}}";
var controller = EmberController.extend({ container: container });
Expand Down

3 comments on commit 53832b3

@stefanpenner
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May have run into an issue here on this one... Digging in

@awaer
Copy link

@awaer awaer commented on 53832b3 Apr 13, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@stefanpenner Have you had a chance to look into this yet?

@stefanpenner
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ya, turns out the issue was unrelated.

Please sign in to comment.