Merge remote-tracking branch 'upstream/pull/5588'
This commit is contained in:
commit
5f7dd9d8b3
2 changed files with 8 additions and 3 deletions
|
@ -35,8 +35,8 @@ module SocialShareButtonHelper
|
||||||
|
|
||||||
def generate_share_url(site, title, url)
|
def generate_share_url(site, title, url)
|
||||||
site = site.to_sym
|
site = site.to_sym
|
||||||
title = URI.encode_www_form_component(title)
|
title = URI.encode_uri_component(title)
|
||||||
url = URI.encode_www_form_component(url)
|
url = URI.encode_uri_component(url)
|
||||||
|
|
||||||
case site
|
case site
|
||||||
when :email
|
when :email
|
||||||
|
|
|
@ -9,9 +9,14 @@ class SocialShareButtonHelperTest < ActionView::TestCase
|
||||||
|
|
||||||
SOCIAL_SHARE_CONFIG.each_value do |icon|
|
SOCIAL_SHARE_CONFIG.each_value do |icon|
|
||||||
assert_dom buttons_dom, "div:has(a img[src='/images/#{icon}'])", :count => 1 do
|
assert_dom buttons_dom, "div:has(a img[src='/images/#{icon}'])", :count => 1 do
|
||||||
assert_dom "a[href*='Test+Title']"
|
assert_dom "a[href*='Test%20Title']"
|
||||||
assert_dom "a[href*='https%3A%2F%2Fexample.com']"
|
assert_dom "a[href*='https%3A%2F%2Fexample.com']"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_generate_share_url_email
|
||||||
|
url = generate_share_url(:email, "Diary Entry Title", "https://osm.example.com/some/diary/entry")
|
||||||
|
assert_equal "mailto:?subject=Diary%20Entry%20Title&body=https%3A%2F%2Fosm.example.com%2Fsome%2Fdiary%2Fentry", url
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue