Merge pull request #4077 from consul/fix_orbit

Fix poll answer images not being displayed
This commit is contained in:
Javier Martín
2020-08-13 18:27:57 +02:00
committed by GitHub
3 changed files with 29 additions and 1 deletions

View File

@@ -1772,6 +1772,7 @@
.orbit-slide {
max-height: none !important;
position: relative;
}
.orbit-caption {

View File

@@ -1,4 +1,4 @@
<div class="orbit margin-bottom" role="region" aria-label="<%= answer.title %>" data-orbit data-auto-play="false">
<div class="orbit margin-bottom" role="region" aria-label="<%= answer.title %>" data-orbit data-auto-play="false" data-use-m-u-i="false">
<a data-toggle="answer_<%= answer.id %> zoom_<%= answer.id %>" class="zoom-link hide-for-small-only">
<span id="zoom_<%= answer.id %>" class="icon-search-plus" data-toggler="icon-search-plus icon-search-minus"></span>
<span class="show-for-sr"><%= t("polls.show.zoom_plus") %></span>

View File

@@ -190,6 +190,33 @@ describe "Polls" do
end
end
scenario "Answer images are shown", :js do
question = create(:poll_question, :yes_no, poll: poll)
create(:image, imageable: question.question_answers.first, title: "The yes movement")
visit poll_path(poll)
expect(page).to have_css "img[alt='The yes movement']"
end
scenario "Buttons to slide through images work back and forth", :js do
question = create(:poll_question, :yes_no, poll: poll)
create(:image, imageable: question.question_answers.last, title: "The no movement")
create(:image, imageable: question.question_answers.last, title: "No movement planning")
visit poll_path(poll)
within(".orbit-bullets") do
find("[data-slide='1']").click
expect(page).to have_css ".is-active[data-slide='1']"
find("[data-slide='0']").click
expect(page).to have_css ".is-active[data-slide='0']"
end
end
scenario "Non-logged in users" do
create(:poll_question, :yes_no, poll: poll)