parent
bf45faa513
commit
48f5f04a11
@ -0,0 +1,9 @@ |
||||
defmodule ExplorerWeb.SocialMedia do |
||||
@moduledoc """ |
||||
This module provides social media links |
||||
""" |
||||
|
||||
def links do |
||||
Application.get_env(:explorer_web, __MODULE__, []) |
||||
end |
||||
end |
@ -1,3 +1,9 @@ |
||||
defmodule ExplorerWeb.LayoutView do |
||||
use ExplorerWeb, :view |
||||
|
||||
alias ExplorerWeb.SocialMedia |
||||
|
||||
def configured_social_media_services do |
||||
SocialMedia.links() |
||||
end |
||||
end |
||||
|
@ -0,0 +1,21 @@ |
||||
defmodule ExplorerWeb.SocialMediaLinksTest do |
||||
use ExplorerWeb.FeatureCase, async: true |
||||
|
||||
import Wallaby.Query |
||||
|
||||
test "it shows twitter when twitter is configured", %{session: session} do |
||||
Application.put_env(:explorer_web, ExplorerWeb.SocialMedia, twitter: "https://twitter.com/twitter") |
||||
|
||||
session |
||||
|> visit("/") |
||||
|> assert_has(css("[data-test='twitter_link']")) |
||||
end |
||||
|
||||
test "it hides twitter when twitter is not configured", %{session: session} do |
||||
Application.put_env(:explorer_web, ExplorerWeb.SocialMedia, facebook: "https://facebook.com/") |
||||
|
||||
session |
||||
|> visit("/") |
||||
|> refute_has(css("[data-test='twitter_link']")) |
||||
end |
||||
end |
Loading…
Reference in new issue