Replace link with buttons in follow button
This commit is contained in:
@@ -1,17 +1,17 @@
|
||||
<div class="js-follow">
|
||||
<span class="followable-content">
|
||||
<% if follow.followable.followed_by?(current_user) %>
|
||||
<%= link_to t("shared.following"),
|
||||
<%= button_to t("shared.following"),
|
||||
follow_path(follow),
|
||||
method: :delete, remote: true,
|
||||
title: unfollow_text(follow.followable),
|
||||
class: "button expanded" %>
|
||||
|
||||
<% else %>
|
||||
<%= link_to follow_text(follow.followable),
|
||||
<%= button_to follow_text(follow.followable),
|
||||
follows_path(followable_id: follow.followable.id,
|
||||
followable_type: follow.followable.class.name),
|
||||
method: :post, remote: true,
|
||||
remote: true,
|
||||
title: follow_text(follow.followable),
|
||||
class: "button hollow expanded" %>
|
||||
<% end %>
|
||||
|
||||
@@ -17,7 +17,7 @@ shared_examples "followable" do |followable_class_name, followable_path, followa
|
||||
visit send(followable_path, arguments)
|
||||
|
||||
within "##{dom_id(followable)}" do
|
||||
expect(page).not_to have_link("Follow")
|
||||
expect(page).not_to have_button("Follow")
|
||||
end
|
||||
end
|
||||
|
||||
@@ -28,7 +28,7 @@ shared_examples "followable" do |followable_class_name, followable_path, followa
|
||||
visit send(followable_path, arguments)
|
||||
|
||||
within "##{dom_id(followable)}" do
|
||||
expect(page).to have_link("Follow #{followable.model_name.human.downcase}")
|
||||
expect(page).to have_button("Follow #{followable.model_name.human.downcase}")
|
||||
end
|
||||
end
|
||||
|
||||
@@ -37,7 +37,7 @@ shared_examples "followable" do |followable_class_name, followable_path, followa
|
||||
login_as(user)
|
||||
|
||||
visit send(followable_path, arguments)
|
||||
expect(page).to have_link("Follow #{followable.model_name.human.downcase}")
|
||||
expect(page).to have_button("Follow #{followable.model_name.human.downcase}")
|
||||
end
|
||||
|
||||
scenario "Should display unfollow after user clicks on follow button" do
|
||||
@@ -46,10 +46,10 @@ shared_examples "followable" do |followable_class_name, followable_path, followa
|
||||
|
||||
visit send(followable_path, arguments)
|
||||
within "##{dom_id(followable)}" do
|
||||
click_link("Follow #{followable.model_name.human.downcase}")
|
||||
click_button("Follow #{followable.model_name.human.downcase}")
|
||||
|
||||
expect(page).not_to have_link("Follow")
|
||||
expect(page).to have_link("Following")
|
||||
expect(page).not_to have_button("Follow")
|
||||
expect(page).to have_button("Following")
|
||||
end
|
||||
end
|
||||
|
||||
@@ -59,7 +59,7 @@ shared_examples "followable" do |followable_class_name, followable_path, followa
|
||||
|
||||
visit send(followable_path, arguments)
|
||||
within "##{dom_id(followable)}" do
|
||||
click_link("Follow #{followable.model_name.human.downcase}")
|
||||
click_button("Follow #{followable.model_name.human.downcase}")
|
||||
end
|
||||
|
||||
expect(page).to have_content "We will notify you of changes as they occur"
|
||||
@@ -71,7 +71,7 @@ shared_examples "followable" do |followable_class_name, followable_path, followa
|
||||
|
||||
visit send(followable_path, arguments)
|
||||
|
||||
expect(page).to have_link("Following")
|
||||
expect(page).to have_button("Following")
|
||||
end
|
||||
|
||||
scenario "Updates follow button & show destroy notice after unfollow button is clicked" do
|
||||
@@ -80,10 +80,10 @@ shared_examples "followable" do |followable_class_name, followable_path, followa
|
||||
|
||||
visit send(followable_path, arguments)
|
||||
within "##{dom_id(followable)}" do
|
||||
click_link("Unfollow #{followable.model_name.human.downcase}")
|
||||
click_button("Unfollow #{followable.model_name.human.downcase}")
|
||||
|
||||
expect(page).not_to have_link("Unfollow")
|
||||
expect(page).to have_link("Follow #{followable.model_name.human.downcase}")
|
||||
expect(page).not_to have_button("Unfollow")
|
||||
expect(page).to have_button("Follow #{followable.model_name.human.downcase}")
|
||||
end
|
||||
end
|
||||
|
||||
@@ -93,7 +93,7 @@ shared_examples "followable" do |followable_class_name, followable_path, followa
|
||||
|
||||
visit send(followable_path, arguments)
|
||||
within "##{dom_id(followable)}" do
|
||||
click_link("Unfollow #{followable.model_name.human.downcase}")
|
||||
click_button("Unfollow #{followable.model_name.human.downcase}")
|
||||
end
|
||||
|
||||
expect(page).to have_content "You will no longer receive notifications"
|
||||
|
||||
Reference in New Issue
Block a user