From cf456eb2ea4ee6383df85cc3d1a89fe5d8e9c97e Mon Sep 17 00:00:00 2001 From: Tom Coleman Date: Tue, 8 Apr 2014 21:31:26 +1000 Subject: [PATCH 1/4] Added failing test for using `{{#with` in layouts Conflicts: layout-test.js --- layout-test.html | 6 ++++++ layout-test.js | 15 ++++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/layout-test.html b/layout-test.html index 3d7f2c8..59d98ed 100644 --- a/layout-test.html +++ b/layout-test.html @@ -26,6 +26,12 @@ {{> yield region="footer"}} + + diff --git a/layout-test.js b/layout-test.js index f6b6b97..7ed13a7 100644 --- a/layout-test.js +++ b/layout-test.js @@ -224,7 +224,6 @@ Tinytest.add('layout - region templates not found in lookup', function (test) { }); - // SEE IR#276 for detailed discussion Tinytest.add('layout - Templates render with correct data even if setData is called after setRegion', function (test) { withRenderedLayout({template: 'LayoutWithOneYield'}, function (layout, screen) { @@ -242,5 +241,19 @@ Tinytest.add('layout - Templates render with correct data even if setData is cal layout.setData(true); Deps.flush(); test.equal(screen.innerHTML.compact(), 'layoutcallback'); + +Tinytest.add('layout - set data via with', function (test) { + withRenderedLayout({template: 'LayoutThatSetsData'}, function (layout, screen) { + layout.setRegion('main', 'ChildWithData'); + + layout.setData({ + title: 'parentTitle', + childData: { + title: 'childTitle' + } + }); + + Deps.flush(); + test.equal(screen.innerHTML.compact(), 'childchildTitle'); }); }); \ No newline at end of file From 6df604686844be064fd1c8e2f94a513e9b50d89c Mon Sep 17 00:00:00 2001 From: Tom Coleman Date: Tue, 8 Apr 2014 22:31:44 +1000 Subject: [PATCH 2/4] Made the test a little better --- layout-test.html | 3 +++ layout-test.js | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/layout-test.html b/layout-test.html index 59d98ed..4cf41b5 100644 --- a/layout-test.html +++ b/layout-test.html @@ -30,6 +30,9 @@ {{#with childData}} {{> yield}} {{/with}} + {{#with childData}} + {{> yield region="footer"}} + {{/with}}