]> git.openstreetmap.org Git - rails.git/blob - test/helpers/social_share_button_helper_test.rb
Merge remote-tracking branch 'upstream/pull/5434'
[rails.git] / test / helpers / social_share_button_helper_test.rb
1 require "test_helper"
2
3 class SocialShareButtonHelperTest < ActionView::TestCase
4   include SocialShareButtonHelper
5
6   def test_social_share_buttons
7     buttons = social_share_buttons(:title => "Test Title", :url => "https://example.com")
8     buttons_dom = Rails::Dom::Testing.html_document_fragment.parse(buttons)
9
10     SOCIAL_SHARE_CONFIG.each_value do |icon|
11       assert_dom buttons_dom, "div:has(a img[src='/images/#{icon}'])", :count => 1 do
12         assert_dom "a[href*='Test+Title']"
13         assert_dom "a[href*='https%3A%2F%2Fexample.com']"
14       end
15     end
16   end
17 end