actions/_share: add telegram

This commit is contained in:
Georg Gadinger 2023-02-19 21:15:56 +01:00
parent 4ee2b46b32
commit 0451e2fedd
3 changed files with 33 additions and 0 deletions

View File

@ -5,5 +5,8 @@
%a.dropdown-item{ href: tumblr_share_url(answer), target: "_blank" }
%i.fa.fa-fw.fa-tumblr
= t(".tumblr")
%a.dropdown-item{ href: telegram_share_url(answer), target: "_blank" }
%i.fa.fa-fw.fa-telegram
= t(".telegram")
%a.dropdown-item{ href: "#", name: "ab-share" }
= t(".other")

View File

@ -81,6 +81,7 @@ en:
share:
twitter: "Share on Twitter"
tumblr: "Share on Tumblr"
telegram: "Share on Telegram"
other: "Share on other apps..."
admin:
announcement:

View File

@ -0,0 +1,29 @@
# frozen_string_literal: true
require "rails_helper"
describe "actions/_share.html.haml", type: :view do
let(:answer) { FactoryBot.create(:answer, user: FactoryBot.create(:user)) }
subject(:rendered) do
render partial: "actions/share", locals: {
answer:,
}
end
it "has a dropdown item to share to twitter" do
expect(rendered).to have_css(%(a.dropdown-item[href^="https://twitter.com/"][target="_blank"]))
end
it "has a dropdown item to share to tumblr" do
expect(rendered).to have_css(%(a.dropdown-item[href^="https://www.tumblr.com/"][target="_blank"]))
end
it "has a dropdown item to share to telegram" do
expect(rendered).to have_css(%(a.dropdown-item[href^="https://t.me/"][target="_blank"]))
end
it "has a dropdown item to share to anywhere else" do
expect(rendered).to have_css(%(a.dropdown-item[name="ab-share"]))
end
end