From a0c11df4cca8a052ee7c25186aa0c01aaa573240 Mon Sep 17 00:00:00 2001 From: cwebbdesign Date: Fri, 27 Jul 2012 10:55:30 +0200 Subject: [PATCH 1/2] Adding tests for overriding layouts using frontmatter --- .../features/frontmatter_page_settings.feature | 12 +++++++++++- .../fixtures/frontmatter-settings-app/config.rb | 4 +++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/middleman-core/features/frontmatter_page_settings.feature b/middleman-core/features/frontmatter_page_settings.feature index f9f3ec94..0e71bd9b 100644 --- a/middleman-core/features/frontmatter_page_settings.feature +++ b/middleman-core/features/frontmatter_page_settings.feature @@ -6,7 +6,7 @@ Feature: Setting page settings through frontmatter And the file "build/alternate_layout.html" should contain "Alternate layout" And the following files should not exist: | build/ignored.html | - + Scenario: Setting layout, ignoring, and disabling directory indexes through frontmatter (preview) Given the Server is running at "frontmatter-settings-app" When I go to "/alternate_layout.html" @@ -31,3 +31,13 @@ Feature: Setting page settings through frontmatter """ When I go to "/ignored.html" Then I should see "This file is no longer ignored." + + Scenario: Overriding layout through frontmatter + Given the Server is running at "frontmatter-settings-app" + When I go to "/override_layout.html" + Then I should see "Layout in use: Override" + + Scenario: Setting layout through frontmatter even if page is mentioned in config + Given the Server is running at "frontmatter-settings-app" + When I go to "/page_mentioned.html" + Then I should see "Layout in use: Override" diff --git a/middleman-core/fixtures/frontmatter-settings-app/config.rb b/middleman-core/fixtures/frontmatter-settings-app/config.rb index 6ec38e93..d5008000 100644 --- a/middleman-core/fixtures/frontmatter-settings-app/config.rb +++ b/middleman-core/fixtures/frontmatter-settings-app/config.rb @@ -1,2 +1,4 @@ # Proxy ignored.html, which should ignore itself through a frontmatter -page 'proxied.html', :proxy => 'ignored.html' \ No newline at end of file +page 'proxied.html', :proxy => 'ignored.html' +page 'override_layout.html', :layout => :alternate +page 'page_mentioned.html' \ No newline at end of file From d0a36f0879f4733ad4a943dff505da4d00333964 Mon Sep 17 00:00:00 2001 From: cwebbdesign Date: Fri, 27 Jul 2012 10:57:48 +0200 Subject: [PATCH 2/2] Adding tests for using front matter to override layout set in config --- .../frontmatter-settings-app/source/layouts/override.erb | 2 ++ .../frontmatter-settings-app/source/override_layout.html.erb | 4 ++++ .../frontmatter-settings-app/source/page_mentioned.html.erb | 4 ++++ 3 files changed, 10 insertions(+) create mode 100644 middleman-core/fixtures/frontmatter-settings-app/source/layouts/override.erb create mode 100644 middleman-core/fixtures/frontmatter-settings-app/source/override_layout.html.erb create mode 100644 middleman-core/fixtures/frontmatter-settings-app/source/page_mentioned.html.erb diff --git a/middleman-core/fixtures/frontmatter-settings-app/source/layouts/override.erb b/middleman-core/fixtures/frontmatter-settings-app/source/layouts/override.erb new file mode 100644 index 00000000..fcf39dc0 --- /dev/null +++ b/middleman-core/fixtures/frontmatter-settings-app/source/layouts/override.erb @@ -0,0 +1,2 @@ +<%= yield %> + Override. \ No newline at end of file diff --git a/middleman-core/fixtures/frontmatter-settings-app/source/override_layout.html.erb b/middleman-core/fixtures/frontmatter-settings-app/source/override_layout.html.erb new file mode 100644 index 00000000..a3f3e5ac --- /dev/null +++ b/middleman-core/fixtures/frontmatter-settings-app/source/override_layout.html.erb @@ -0,0 +1,4 @@ +--- +layout: override +--- +Layout in use: \ No newline at end of file diff --git a/middleman-core/fixtures/frontmatter-settings-app/source/page_mentioned.html.erb b/middleman-core/fixtures/frontmatter-settings-app/source/page_mentioned.html.erb new file mode 100644 index 00000000..a3f3e5ac --- /dev/null +++ b/middleman-core/fixtures/frontmatter-settings-app/source/page_mentioned.html.erb @@ -0,0 +1,4 @@ +--- +layout: override +--- +Layout in use: \ No newline at end of file