Skip to content

Commit

Permalink
Fix conference view to allow images from admin and spec file (#110)
Browse files Browse the repository at this point in the history
* Fix conference view to allow images from admin and spec file

* fix quotations to satisfy rspec

* Fix rspec require in factories

* visit_component has component to visit

* Create short_description to host the img tag

* include manifest name as conferences

* :conferences as manifest_name

* Fix some problems in the spec

* WIP: Remove img

* Fix test

---------

Co-authored-by: Francisco Bolívar <[email protected]>
  • Loading branch information
HHassig and fblupi authored Aug 12, 2024
1 parent 391a091 commit 8d1dbba
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/views/decidim/conferences/conferences/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ edit_link(
<div class="columns mediumlarge-12">
<section class="section">
<h3 class="section-heading"><%= t("conferences.show.introduction", scope: "decidim") %></h3>
<%= decidim_sanitize translated_attribute(current_participatory_space.short_description) %>
<%= decidim_sanitize_editor_admin translated_attribute(current_participatory_space.short_description) %>
</section>
<hr class="reset mt-none mb-m">
<section class="section">
<h3 class="section-heading"><%= t("conferences.show.details", scope: "decidim") %></h3>
<%= decidim_sanitize translated_attribute(current_participatory_space.description) %>
<%= decidim_sanitize_editor_admin translated_attribute(current_participatory_space.description) %>
<div class="row mt-l mb-l">
<div class="column medium-9 medium-centered">
<% if current_participatory_space.registrations_enabled? %>
Expand Down
1 change: 1 addition & 0 deletions spec/factories.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
require "decidim/core/test/factories"
require "decidim/proposals/test/factories"
require "decidim/decidim_awesome/test/factories"
require "decidim/conferences/test/factories"
20 changes: 20 additions & 0 deletions spec/system/conferences_with_image_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# frozen_string_literal: true

require "rails_helper"

describe "Conference with images", type: :system do
let(:organization) { create :organization }
let(:short_description) { { en: "<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p><img src=\"/favicon.ico\">" } }
let!(:conference) { create :conference, organization: organization, short_description: short_description }

before do
switch_to_host(organization.host)
page.visit "/conferences/#{conference.slug}"
end

it "shows the image" do
within "#content" do
expect(page).to have_xpath("//img[contains(@src,'favicon.ico')]")
end
end
end

0 comments on commit 8d1dbba

Please sign in to comment.