Skip to content

Commit

Permalink
adding failing test
Browse files Browse the repository at this point in the history
  • Loading branch information
GBH committed Mar 17, 2017
1 parent 40f6a0f commit d95e45e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/active_link_to/active_link_to.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def active_link_to(*args, &block)

wrap_tag = active_options[:wrap_tag].present? ? active_options[:wrap_tag] : nil
link_options[:class] = css_class if css_class.present?
link_options["aria-current"] = "page" if is_active_link?(url, active_options[:active])
link_options['aria-current'] = 'page' if is_active_link?(url, active_options[:active])

link = if active_options[:active_disable] === true && is_active_link?(url, active_options[:active])
content_tag(:span, name, link_options)
Expand Down
14 changes: 10 additions & 4 deletions test/active_link_to_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ def test_should_not_modify_passed_params
assert_equal ({class: 'testing', active: :inclusive }), params
end

def test_no_empty_class_attribute
def test_active_link_to_wrap_tag_class
set_fullpath('/root')
link = active_link_to('label', '/root', wrap_tag: :li)
assert_html link, 'li.active a.active[href="/root"]', 'label'
Expand All @@ -199,9 +199,15 @@ def test_no_empty_class_attribute
assert_html link, 'li a[href="/other"]', 'label'
end

def test_active_link_to_with_url
def test_active_link_to_with_aria
set_fullpath('/root')
link = active_link_to('label', 'http://example.com/root')
assert_html link, 'a.active[href="http://example.com/root"][aria-current="page"]', 'label'
link = active_link_to('label', '/root')
assert_html link, 'a.active[href="/root"][aria-current="page"]', 'label'
end

def test_active_link_to_with_utf8
set_fullpath('/äöü')
link = active_link_to('label', '/äöü')
assert_html link, 'a.active[href="/äöü"]', 'label'
end
end

0 comments on commit d95e45e

Please sign in to comment.