diff --git a/app/assets/stylesheets/in_favor_against.scss b/app/assets/stylesheets/in_favor_against.scss index 1fb29b0a4..dc8d60127 100644 --- a/app/assets/stylesheets/in_favor_against.scss +++ b/app/assets/stylesheets/in_favor_against.scss @@ -1,5 +1,11 @@ .in-favor-against { - display: inline-block; + + &, + .in-favor, + .against, + form { + display: inline-block; + } .icon-like, .icon-unlike { @@ -41,23 +47,22 @@ .like, .unlike { - line-height: rem-calc(48); vertical-align: super; text-decoration: none; + } - .percentage { - color: $text; - display: inline-block; - font-size: $small-font-size; - line-height: $line-height * 2; - padding-right: $line-height / 2; - vertical-align: top; + .percentage { + color: $text; + display: inline-block; + font-size: $small-font-size; + line-height: $line-height * 2; + padding-right: $line-height / 2; + vertical-align: top; - @include breakpoint(medium) { - display: block; - line-height: $line-height; - padding-right: 0; - } + @include breakpoint(medium) { + display: block; + line-height: $line-height; + padding-right: 0; } } diff --git a/app/components/shared/in_favor_against_component.html.erb b/app/components/shared/in_favor_against_component.html.erb index 87c3bc381..9742fe918 100644 --- a/app/components/shared/in_favor_against_component.html.erb +++ b/app/components/shared/in_favor_against_component.html.erb @@ -1,5 +1,5 @@
-
+
<%= button_to polymorphic_path(votable, action: :vote, value: "yes"), class: "like #{voted_classes[:in_favor]}", title: t("votes.agree"), @@ -10,13 +10,13 @@ <%= t("votes.agree") %> - <%= votes_percentage("likes", votable) %> <% end %> + <%= votes_percentage("likes", votable) %>
-
+
<%= button_to polymorphic_path(votable, action: :vote, value: "no"), class: "unlike #{voted_classes[:against]}", title: t("votes.disagree"), @@ -27,7 +27,7 @@ <%= t("votes.disagree") %> - <%= votes_percentage("dislikes", votable) %> <% end %> + <%= votes_percentage("dislikes", votable) %>
diff --git a/spec/components/debates/votes_component_spec.rb b/spec/components/debates/votes_component_spec.rb index 1eac4c86d..f21ef797d 100644 --- a/spec/components/debates/votes_component_spec.rb +++ b/spec/components/debates/votes_component_spec.rb @@ -25,5 +25,19 @@ describe Debates::VotesComponent do expect(page).to have_button "I don't agree with What about the 2030 agenda?" expect(page).not_to have_content "You must sign in or sign up to continue." end + + it "does not include result percentages" do + create(:vote, votable: debate) + sign_in(create(:user)) + + render_inline component + + expect(page).to have_button count: 2 + expect(page).to have_button "I agree" + expect(page).to have_button "I disagree" + expect(page).not_to have_button text: "%" + expect(page).not_to have_button text: "100" + expect(page).not_to have_button text: "0" + end end end diff --git a/spec/components/legislation/proposals/votes_component_spec.rb b/spec/components/legislation/proposals/votes_component_spec.rb index b4131c52e..b832fc51f 100644 --- a/spec/components/legislation/proposals/votes_component_spec.rb +++ b/spec/components/legislation/proposals/votes_component_spec.rb @@ -38,5 +38,19 @@ describe Legislation::Proposals::VotesComponent do expect(page).to have_button "I don't agree with Require wearing masks at home" expect(page).not_to have_content "You must sign in or sign up to continue." end + + it "does not include result percentages" do + create(:vote, votable: proposal) + sign_in(create(:user)) + + render_inline component + + expect(page).to have_button count: 2 + expect(page).to have_button "I agree" + expect(page).to have_button "I disagree" + expect(page).not_to have_button text: "%" + expect(page).not_to have_button text: "100" + expect(page).not_to have_button text: "0" + end end end