Test for issue 1709; parent relations with localized and non-localized sources
This commit is contained in:
parent
5684caeee6
commit
bdeb19059a
10 changed files with 101 additions and 0 deletions
38
middleman-core/features/i18n_mixed_sources.feature
Normal file
38
middleman-core/features/i18n_mixed_sources.feature
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
Feature: i18n merging path trees
|
||||||
|
|
||||||
|
Scenario: Mixing localized and non-localized sources and merging the path trees (see issue #1709)
|
||||||
|
Given a fixture app "i18n-test-app"
|
||||||
|
And a file named "config.rb" with:
|
||||||
|
"""
|
||||||
|
activate :i18n, mount_at_root: :en, langs: [:en, :es]
|
||||||
|
"""
|
||||||
|
Given the Server is running at "i18n-mixed-sources"
|
||||||
|
|
||||||
|
When I go to "/"
|
||||||
|
Then I should see "Current locale: en"
|
||||||
|
Then I should see "path: is-localized Home"
|
||||||
|
When I go to "/es"
|
||||||
|
Then I should see "Current locale: es"
|
||||||
|
Then I should see "path: is-localized Home"
|
||||||
|
|
||||||
|
When I go to "/a/"
|
||||||
|
Then I should see "Current locale: en"
|
||||||
|
Then I should see "path: is-localized Home # a/index.html.erb"
|
||||||
|
When I go to "/es/a/"
|
||||||
|
Then I should see "Current locale: es"
|
||||||
|
Then I should see "path: is-localized Home # a/index.html.erb"
|
||||||
|
|
||||||
|
When I go to "/b/"
|
||||||
|
Then I should see "Current locale: en"
|
||||||
|
Then I should see "path: is-localized Home # b/index.html.erb"
|
||||||
|
|
||||||
|
When I go to "/a/sub.html"
|
||||||
|
Then I should see "Current locale: en"
|
||||||
|
Then I should see "path: is-localized Home # a/index.html.erb # a/sub.html.erb"
|
||||||
|
|
||||||
|
When I go to "/b/sub.html"
|
||||||
|
Then I should see "Current locale: en"
|
||||||
|
Then I should see "path: is-localized Home # b/index.html.erb # b/sub.html.erb"
|
||||||
|
Then I should see "Current locale: es"
|
||||||
|
When I go to "/es/b/sub.html"
|
||||||
|
Then I should see "path: is-localized Home # b/index.html.erb # b/sub.html.erb"
|
1
middleman-core/fixtures/i18n-mixed-sources/config.rb
Normal file
1
middleman-core/fixtures/i18n-mixed-sources/config.rb
Normal file
|
@ -0,0 +1 @@
|
||||||
|
activate :i18n, mount_at_root: :en, langs: [:en, :es]
|
|
@ -0,0 +1,4 @@
|
||||||
|
---
|
||||||
|
en:
|
||||||
|
greetings: "Howdy"
|
||||||
|
hi: "Hello"
|
|
@ -0,0 +1,4 @@
|
||||||
|
---
|
||||||
|
es:
|
||||||
|
greetings: "Como Esta?"
|
||||||
|
hi: "Hola"
|
|
@ -0,0 +1,9 @@
|
||||||
|
---
|
||||||
|
title: a/sub.html.erb
|
||||||
|
---
|
||||||
|
Current locale: <%= I18n.locale %>
|
||||||
|
path: <%=
|
||||||
|
hierarchy = [current_page]
|
||||||
|
hierarchy.unshift hierarchy.first.parent while hierarchy.first.parent
|
||||||
|
hierarchy.collect {|page| page.data.title }.join(" # ")
|
||||||
|
%>
|
|
@ -0,0 +1,9 @@
|
||||||
|
---
|
||||||
|
title: b/index.html.erb
|
||||||
|
---
|
||||||
|
Current locale: <%= I18n.locale %>
|
||||||
|
path: <%=
|
||||||
|
hierarchy = [current_page]
|
||||||
|
hierarchy.unshift hierarchy.first.parent while hierarchy.first.parent
|
||||||
|
hierarchy.collect {|page| page.data.title }.join(" # ")
|
||||||
|
%>
|
|
@ -0,0 +1,9 @@
|
||||||
|
---
|
||||||
|
title: non-localized Home
|
||||||
|
---
|
||||||
|
Current locale: <%= I18n.locale %>
|
||||||
|
path: <%=
|
||||||
|
hierarchy = [current_page]
|
||||||
|
hierarchy.unshift hierarchy.first.parent while hierarchy.first.parent
|
||||||
|
hierarchy.collect {|page| page.data.title }.join(" # ")
|
||||||
|
%>
|
|
@ -0,0 +1,9 @@
|
||||||
|
---
|
||||||
|
title: a/index.html.erb
|
||||||
|
---
|
||||||
|
Current locale: <%= I18n.locale %>
|
||||||
|
path: <%=
|
||||||
|
hierarchy = [current_page]
|
||||||
|
hierarchy.unshift hierarchy.first.parent while hierarchy.first.parent
|
||||||
|
hierarchy.collect {|page| page.data.title }.join(" # ")
|
||||||
|
%>
|
|
@ -0,0 +1,9 @@
|
||||||
|
---
|
||||||
|
title: b/sub.html.erb
|
||||||
|
---
|
||||||
|
Current locale: <%= I18n.locale %>
|
||||||
|
path: <%=
|
||||||
|
hierarchy = [current_page]
|
||||||
|
hierarchy.unshift hierarchy.first.parent while hierarchy.first.parent
|
||||||
|
hierarchy.collect {|page| page.data.title }.join(" # ")
|
||||||
|
%>
|
|
@ -0,0 +1,9 @@
|
||||||
|
---
|
||||||
|
title: is-localized Home
|
||||||
|
---
|
||||||
|
Current locale: <%= I18n.locale %>
|
||||||
|
path: <%=
|
||||||
|
hierarchy = [current_page]
|
||||||
|
hierarchy.unshift hierarchy.first.parent while hierarchy.first.parent
|
||||||
|
hierarchy.collect {|page| page.data.title }.join(" # ")
|
||||||
|
%>
|
Loading…
Reference in a new issue