Skip to content

Commit

Permalink
rename :preceding_text option to :prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigomanhaes committed Aug 18, 2012
1 parent 3a803f0 commit acb6ca1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions lib/simple_navigation/rendering/renderer/breadcrumbs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class Breadcrumbs < SimpleNavigation::Renderer::Base
def render(item_container)
content = a_tags(item_container).join(join_with)
content_tag(:div,
preceding_text_for(content) + content,
prefix_for(content) + content,
{:id => item_container.dom_id, :class => item_container.dom_class})
end

Expand All @@ -39,8 +39,8 @@ def suppress_link?(item)
super || (options[:static_leaf] && item.active_leaf_class)
end

def preceding_text_for(content)
content.empty? ? '' : options[:preceding_text] || ''
def prefix_for(content)
content.empty? ? '' : options[:prefix] || ''
end

# Extracts the options relevant for the generated link
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,17 @@ def render(current_nav=nil, options={:level => :all})
end
end

context 'with preceding_text option' do
it 'should render preceding text before breadcrumbs' do
selection = HTML::Selector.new('div').select(render(:subnav1, :level => :all, :preceding_text => 'You are here: '))
context 'with prefix option' do
it 'should render prefix before breadcrumbs' do
selection = HTML::Selector.new('div').select(render(:subnav1, :level => :all, :prefix => 'You are here: '))
raise unless selection.count == 1
tag = selection.first
tag.to_s.should =~ /^\<div.+\>You are here\: /
end

it 'should not render preceding text if there is no available breadcrumb' do
it 'should not render prefix if there is no available breadcrumb' do
allow_message_expectations_on_nil
selection = HTML::Selector.new('div').select(render('', :preceding_text => 'You are here: '))
selection = HTML::Selector.new('div').select(render('', :prefix => 'You are here: '))
tag = selection.first
tag.to_s.should =~ /^\<div.+\>\<\/div\>/
end
Expand Down

0 comments on commit acb6ca1

Please sign in to comment.