From 5071a2c15d725ec3e94808c4422fadfeb5c6f2a9 Mon Sep 17 00:00:00 2001 From: Thomas Reynolds Date: Sun, 17 Jun 2012 12:03:36 -0700 Subject: [PATCH] Tests for #477 --- middleman-core/features/custom_layouts.feature | 16 +++++++++++++++- .../page-helper-layout-block-app/config.rb | 6 ++++++ .../source/index.html.erb | 1 + .../source/layouts/alt.erb | 3 +++ .../source/layouts/layout.erb | 3 +++ .../source/path/child.html.erb | 1 + .../source/path/index.html.erb | 1 + 7 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 middleman-core/fixtures/page-helper-layout-block-app/config.rb create mode 100644 middleman-core/fixtures/page-helper-layout-block-app/source/index.html.erb create mode 100644 middleman-core/fixtures/page-helper-layout-block-app/source/layouts/alt.erb create mode 100644 middleman-core/fixtures/page-helper-layout-block-app/source/layouts/layout.erb create mode 100644 middleman-core/fixtures/page-helper-layout-block-app/source/path/child.html.erb create mode 100644 middleman-core/fixtures/page-helper-layout-block-app/source/path/index.html.erb diff --git a/middleman-core/features/custom_layouts.feature b/middleman-core/features/custom_layouts.feature index 10f127ba..32feaa99 100644 --- a/middleman-core/features/custom_layouts.feature +++ b/middleman-core/features/custom_layouts.feature @@ -47,4 +47,18 @@ Feature: Custom layouts When I go to "/custom-layout-dir/" Then I should see "Custom Layout" When I go to "/custom-layout-dir/index.html" - Then I should see "Custom Layout" \ No newline at end of file + Then I should see "Custom Layout" + + Scenario: Setting layout inside a matching page block + Given the Server is running at "page-helper-layout-block-app" + When I go to "/index.html" + Then I should see "Hello" + And I should see "World" + When I go to "/path/child.html" + Then I should see "Alt" + And I should see "Child" + And I should not see "Hello" + When I go to "/path/index.html" + Then I should see "Alt" + And I should see "Monde" + And I should not see "Hello" \ No newline at end of file diff --git a/middleman-core/fixtures/page-helper-layout-block-app/config.rb b/middleman-core/fixtures/page-helper-layout-block-app/config.rb new file mode 100644 index 00000000..b7314013 --- /dev/null +++ b/middleman-core/fixtures/page-helper-layout-block-app/config.rb @@ -0,0 +1,6 @@ +page "/path/*", :layout => "alt" + +# Doesn't work, and shouldn't +# page "/path/*" do +# set :layout, "alt" +# end \ No newline at end of file diff --git a/middleman-core/fixtures/page-helper-layout-block-app/source/index.html.erb b/middleman-core/fixtures/page-helper-layout-block-app/source/index.html.erb new file mode 100644 index 00000000..beef906c --- /dev/null +++ b/middleman-core/fixtures/page-helper-layout-block-app/source/index.html.erb @@ -0,0 +1 @@ +World \ No newline at end of file diff --git a/middleman-core/fixtures/page-helper-layout-block-app/source/layouts/alt.erb b/middleman-core/fixtures/page-helper-layout-block-app/source/layouts/alt.erb new file mode 100644 index 00000000..d8d3733b --- /dev/null +++ b/middleman-core/fixtures/page-helper-layout-block-app/source/layouts/alt.erb @@ -0,0 +1,3 @@ +Alt + +<%= yield %> \ No newline at end of file diff --git a/middleman-core/fixtures/page-helper-layout-block-app/source/layouts/layout.erb b/middleman-core/fixtures/page-helper-layout-block-app/source/layouts/layout.erb new file mode 100644 index 00000000..ba127c2e --- /dev/null +++ b/middleman-core/fixtures/page-helper-layout-block-app/source/layouts/layout.erb @@ -0,0 +1,3 @@ +Hello + +<%= yield %> \ No newline at end of file diff --git a/middleman-core/fixtures/page-helper-layout-block-app/source/path/child.html.erb b/middleman-core/fixtures/page-helper-layout-block-app/source/path/child.html.erb new file mode 100644 index 00000000..c1a538c6 --- /dev/null +++ b/middleman-core/fixtures/page-helper-layout-block-app/source/path/child.html.erb @@ -0,0 +1 @@ +Child \ No newline at end of file diff --git a/middleman-core/fixtures/page-helper-layout-block-app/source/path/index.html.erb b/middleman-core/fixtures/page-helper-layout-block-app/source/path/index.html.erb new file mode 100644 index 00000000..4984d508 --- /dev/null +++ b/middleman-core/fixtures/page-helper-layout-block-app/source/path/index.html.erb @@ -0,0 +1 @@ +Monde \ No newline at end of file