Skip to content

Commit

Permalink
Merge pull request #10493 from ebryn/better-nested-yield-fix
Browse files Browse the repository at this point in the history
[BUGFIX release] Fix nested simple bindings inside of nested yields within views
  • Loading branch information
mixonic committed Feb 20, 2015
2 parents 2ad9699 + 72efdae commit baa2c22
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/ember-htmlbars/lib/helpers/yield.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,5 +103,5 @@ export function yieldHelper(params, hash, options, env) {

Ember.assert("You called yield in a template that was not a layout", !!view);

return view._yield(null, env, options.morph, params);
return view._yield(this, env, options.morph, params);
}
2 changes: 1 addition & 1 deletion packages/ember-htmlbars/lib/hooks/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export default function content(env, morph, view, path) {
}

if (isStream(result)) {
appendSimpleBoundView(env.data.view, morph, result);
appendSimpleBoundView(view, morph, result);
} else {
morph.setContent(result);
}
Expand Down
13 changes: 13 additions & 0 deletions packages/ember-htmlbars/tests/helpers/yield_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,19 @@ QUnit.test("simple bindings inside of a yielded template should work properly wh
equal(view.$().text(), "ohai");
});

QUnit.test("nested simple bindings inside of a yielded template should work properly when the yield is nested inside of another view", function() {
view = EmberView.create({
layout: compile('{{#if view.falsy}}{{else}}{{yield}}{{/if}}'),
template: compile("{{#if view.falsy}}{{else}}{{view.text}}{{/if}}"),
text: "ohai"
});

run(function() {
view.createElement();
});

equal(view.$().text(), "ohai");
});

QUnit.module("ember-htmlbars: Component {{yield}}", {
setup: function() {},
Expand Down
2 changes: 1 addition & 1 deletion packages/ember-views/lib/views/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -763,7 +763,7 @@ var View = CoreView.extend(

if (template) {
if (template.isHTMLBars) {
return template.render(this, options, morph.contextualElement);
return template.render(context, options, morph.contextualElement);
} else {
return template(context, options);
}
Expand Down

0 comments on commit baa2c22

Please sign in to comment.