votes: show votes when hovering over post score.

Make it so you can hover over a post's score to see the list of public
upvotes. Also show the upvote count, the downvote count, and the upvote
ratio.
This commit is contained in:
evazion
2021-11-18 01:05:24 -06:00
parent a9997d0d2b
commit 5585d1f7d6
20 changed files with 262 additions and 58 deletions

View File

@@ -10,8 +10,8 @@ class PostVotesControllerTest < ActionDispatch::IntegrationTest
context "index action" do
setup do
@user = create(:user, enable_private_favorites: true)
create(:post_vote, user: @user, score: 1)
create(:post_vote, user: @user, score: -1)
@upvote = create(:post_vote, user: @user, score: 1)
@downvote = create(:post_vote, user: @user, score: -1)
end
should "render" do
@@ -19,6 +19,16 @@ class PostVotesControllerTest < ActionDispatch::IntegrationTest
assert_response :success
end
should "render for a compact view" do
get post_votes_path(variant: "compact")
assert_response :success
end
should "render for a tooltip" do
get post_votes_path(search: { post_id: @upvote.post_id }, variant: "tooltip")
assert_response :success
end
context "as a user" do
should "show the user all their own votes" do
get_auth post_votes_path, @user