Feature: Helpers
Scenario: `path_list` helper
Given a fixture app "path-list-app"
When I run `middleman build --verbose`
Then the exit status should be 0
And the helper result "build/index.html" should contain '
No Path List
'
And the helper result "build/page/list/index.html" should contain:
"""
page:/page/
list:/page/list/
"""
Scenario: `breadcrumbs` helper
Given a fixture app "breadcrumbs-app"
When I run `middleman build --verbose`
Then the exit status should be 0
# /index.html
And the helper result "build/index.html" should contain ''
And the helper result "build/index.html" should contain '- Top
'
# /dir/page.html
And the helper result "build/dir/page.html" should contain:
"""
- Top
- dir
- page
"""
Scenario: `breadcrumbs` helper with params
Given a fixture app "breadcrumbs-params-app"
When I run `middleman build --verbose`
Then the exit status should be 0
# /index.html
And the helper result "build/index.html" should contain ''
And the helper result "build/index.html" should contain '- Home
'
Scenario: `breadcrumbs` helper with index page that has title Frontmatter
Given a fixture app "breadcrumbs-has-title-app"
When I run `middleman build --verbose`
Then the exit status should be 0
# /index.html
And the helper result "build/index.html" should contain ''
And the helper result "build/index.html" should contain '- Root Page
'
# /dir/page.html
And the helper result "build/dir/sub_dir/page.html" should contain:
"""
- Root Page
- Dir/Index Title
- sub_dir
- Dir/Page Title
"""
Scenario: `children_pages` helper
Given a fixture app "children-pages-app"
And a file named "source/templates/index.html.erb" with:
"""
<% children_pages.each do |page| %>
- <%= link_to(page_name(page), page_url(page)) %>
<% end %>
"""
When I run `middleman build --verbose`
Then the exit status should be 0
And the helper result "build/index.html" should contain:
"""
- dir1
- dir2
- Page1 Title
"""
And the helper result "build/dir1/index.html" should contain:
"""
- dir1/sub_dir1
- dir1/sub_dir2
- dir1/Page1 Title
- dir1/Page2 Title
- dir1/Page3 Title
- dir1/no-title-page
"""
Scenario: `children_pages` helper with "order_by = :desc" option
Given a fixture app "children-pages-app"
And a file named "source/templates/index.html.erb" with:
"""
<% children_pages(:date, :desc).each do |page| %>
- <%= link_to(page_name(page), page_url(page)) %>
<% end %>
"""
When I run `middleman build --verbose`
Then the exit status should be 0
And the helper result "build/index.html" should contain:
"""
- dir2
- dir1
- Page1 Title
"""
And the helper result "build/dir1/index.html" should contain:
"""
- dir1/sub_dir2
- dir1/sub_dir1
- dir1/no-title-page
- dir1/Page3 Title
- dir1/Page2 Title
- dir1/Page1 Title
"""
Scenario: `children_pages` helper with "key = :category" option
Given a fixture app "children-pages-with-category-app"
And a file named "source/templates/index.html.erb" with:
"""
<% children_pages(:category).each do |page| %>
- <%= link_to(page_name(page), page_url(page)) %>
<% end %>
"""
When I run `middleman build --verbose`
Then the exit status should be 0
And the helper result "build/dir1/index.html" should contain:
"""
- dir1/sub_dir1
- dir1/sub_dir2
- dir1/Page1 Title
- dir1/Page2 Title
- dir1/Page3 Title
- dir1/no-title-page
"""
Scenario: `children_pages` helper with "key = :category" and "order_by = :desc" option
Given a fixture app "children-pages-with-category-app"
And a file named "source/templates/index.html.erb" with:
"""
<% children_pages(:category, :desc).each do |page| %>
- <%= link_to(page_name(page), page_url(page)) %>
<% end %>
"""
When I run `middleman build --verbose`
Then the exit status should be 0
And the helper result "build/dir1/index.html" should contain:
"""
- dir1/sub_dir2
- dir1/sub_dir1
- dir1/no-title-page
- dir1/Page3 Title
- dir1/Page2 Title
- dir1/Page1 Title
"""
Scenario: `title` helper
Given a fixture app "title-app"
When I run `middleman build --verbose`
Then the exit status should be 0
And the helper result "build/index.html" should contain:
"""
Middleman-Tansu
"""
And the helper result "build/dir/index.html" should contain:
"""
dir/ - Middleman-Tansu
"""
And the helper result "build/dir/sub_dir/index.html" should contain:
"""
dir/sub_dir/ - Middleman-Tansu
"""
And the helper result "build/dir/sub_dir/page.html" should contain:
"""
Page Title - Middleman-Tansu
"""
Scenario: `title` helper with app.config.site_title option
Given a fixture app "title-app"
And a file named "config.rb" with:
"""
set :site_title, "TANSU"
activate :tansu
"""
When I run `middleman build --verbose`
Then the exit status should be 0
And the helper result "build/index.html" should contain:
"""
TANSU
"""
And the helper result "build/dir/index.html" should contain:
"""
dir/ - TANSU
"""
And the helper result "build/dir/sub_dir/page.html" should contain:
"""
Page Title - TANSU
"""
Scenario: `title` helper
Given a fixture app "title-has-title-app"
When I run `middleman build --verbose`
Then the exit status should be 0
And the helper result "build/index.html" should contain:
"""
Root Page - Middleman-Tansu
"""
And the helper result "build/dir/index.html" should contain:
"""
Dir/Index Title - Middleman-Tansu
"""
And the helper result "build/dir/sub_dir/page.html" should contain:
"""
dir/sub_dir/page - Middleman-Tansu
"""
Scenario: `heading` helper
Given a fixture app "title-app"
When I run `middleman build --verbose`
Then the exit status should be 0
And the helper result "build/index.html" should contain:
"""
Middleman-Tansu
"""
And the helper result "build/dir/index.html" should contain:
"""
dir/
"""
And the helper result "build/dir/sub_dir/index.html" should contain:
"""
dir/sub_dir/
"""
And the helper result "build/dir/sub_dir/page.html" should contain:
"""
Page Title
"""
Scenario: `heading` helper with app.config.site_title option
Given a fixture app "title-app"
And a file named "config.rb" with:
"""
set :site_title, "TANSU"
activate :tansu
"""
When I run `middleman build --verbose`
Then the exit status should be 0
And the helper result "build/index.html" should contain:
"""
TANSU
"""
And the helper result "build/dir/index.html" should contain:
"""
dir/
"""
And the helper result "build/dir/sub_dir/page.html" should contain:
"""
Page Title
"""
Scenario: `heading` helper
Given a fixture app "title-has-title-app"
When I run `middleman build --verbose`
Then the exit status should be 0
And the helper result "build/index.html" should contain:
"""
Root Page
"""
And the helper result "build/dir/index.html" should contain:
"""
Dir/Index Title
"""
And the helper result "build/dir/sub_dir/page.html" should contain:
"""
dir/sub_dir/page
"""
Scenario: `index?` helper
Given a fixture app "index-app"
When I run `middleman build --verbose`
Then the exit status should be 0
And the helper result "build/index.html" should contain:
"""
Index
"""
And the helper result "build/dir/index.html" should contain:
"""
Index
"""
And the helper result "build/dir/page.html" should contain:
"""
Page
"""