From 72efdae21941bb45c6269518f9f0307db5cfa2df Mon Sep 17 00:00:00 2001 From: Erik Bryn Date: Wed, 18 Feb 2015 16:28:35 -0800 Subject: [PATCH] [BUGFIX release] Fix nested simple bindings inside of nested yields within views --- packages/ember-htmlbars/lib/helpers/yield.js | 2 +- packages/ember-htmlbars/lib/hooks/content.js | 2 +- packages/ember-htmlbars/tests/helpers/yield_test.js | 13 +++++++++++++ packages/ember-views/lib/views/view.js | 2 +- 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/packages/ember-htmlbars/lib/helpers/yield.js b/packages/ember-htmlbars/lib/helpers/yield.js index 998d67dba61..77f2e1fb3f0 100644 --- a/packages/ember-htmlbars/lib/helpers/yield.js +++ b/packages/ember-htmlbars/lib/helpers/yield.js @@ -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); } diff --git a/packages/ember-htmlbars/lib/hooks/content.js b/packages/ember-htmlbars/lib/hooks/content.js index 49c6792a914..024de0cdadd 100644 --- a/packages/ember-htmlbars/lib/hooks/content.js +++ b/packages/ember-htmlbars/lib/hooks/content.js @@ -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); } diff --git a/packages/ember-htmlbars/tests/helpers/yield_test.js b/packages/ember-htmlbars/tests/helpers/yield_test.js index f989e2b34ad..6e542e67c79 100644 --- a/packages/ember-htmlbars/tests/helpers/yield_test.js +++ b/packages/ember-htmlbars/tests/helpers/yield_test.js @@ -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() {}, diff --git a/packages/ember-views/lib/views/view.js b/packages/ember-views/lib/views/view.js index bbc9b9b2bd0..c2f03716d6e 100644 --- a/packages/ember-views/lib/views/view.js +++ b/packages/ember-views/lib/views/view.js @@ -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); }