<%= translations_form.text_area :description, class: "html-area",
maxlength: ActivePoll.description_max_length %>
diff --git a/app/views/admin/poll/questions/answers/_form.html.erb b/app/views/admin/poll/questions/answers/_form.html.erb
index 68114d2a6..53eceae17 100644
--- a/app/views/admin/poll/questions/answers/_form.html.erb
+++ b/app/views/admin/poll/questions/answers/_form.html.erb
@@ -14,7 +14,7 @@
+
<%= translations_form.text_area :description, maxlength: Poll::Question.description_max_length, class: "html-area" %>
<% end %>
diff --git a/app/views/admin/site_customization/pages/_form.html.erb b/app/views/admin/site_customization/pages/_form.html.erb
index 5a9475b03..b5a8b42c3 100644
--- a/app/views/admin/site_customization/pages/_form.html.erb
+++ b/app/views/admin/site_customization/pages/_form.html.erb
@@ -46,7 +46,7 @@
<%= translations_form.text_field :subtitle %>
-
+
<%= translations_form.text_area :content, class: "html-area admin" %>
<% end %>
diff --git a/app/views/budgets/investments/_form.html.erb b/app/views/budgets/investments/_form.html.erb
index 330931d59..3eff59f72 100644
--- a/app/views/budgets/investments/_form.html.erb
+++ b/app/views/budgets/investments/_form.html.erb
@@ -22,7 +22,7 @@
-
+
<%= translations_form.text_area :description,
maxlength: Budget::Investment.description_max_length,
class: "html-area" %>
diff --git a/app/views/dashboard/polls/_question_answer_fields.html.erb b/app/views/dashboard/polls/_question_answer_fields.html.erb
index b3e6d9e4e..3cf81e8ee 100644
--- a/app/views/dashboard/polls/_question_answer_fields.html.erb
+++ b/app/views/dashboard/polls/_question_answer_fields.html.erb
@@ -14,11 +14,9 @@
-
- <%= f.text_area :description,
- maxlength: Poll::Question.description_max_length,
- class: "html-area" %>
-
+ <%= f.text_area :description,
+ maxlength: Poll::Question.description_max_length,
+ class: "html-area" %>
diff --git a/app/views/debates/_form.html.erb b/app/views/debates/_form.html.erb
index 08b24eceb..155bb7da5 100644
--- a/app/views/debates/_form.html.erb
+++ b/app/views/debates/_form.html.erb
@@ -16,7 +16,7 @@
-
+
<%= translations_form.text_area :description,
maxlength: Debate.description_max_length,
class: "html-area" %>
diff --git a/app/views/legislation/proposals/_form.html.erb b/app/views/legislation/proposals/_form.html.erb
index e21a605f6..9985bfa03 100644
--- a/app/views/legislation/proposals/_form.html.erb
+++ b/app/views/legislation/proposals/_form.html.erb
@@ -15,7 +15,7 @@
hint: t("proposals.form.proposal_summary_note") %>
-
+
<%= f.text_area :description,
maxlength: Legislation::Proposal.description_max_length,
class: "html-area" %>
diff --git a/app/views/proposals/_form.html.erb b/app/views/proposals/_form.html.erb
index 86f86e918..eba35f60d 100644
--- a/app/views/proposals/_form.html.erb
+++ b/app/views/proposals/_form.html.erb
@@ -21,7 +21,7 @@
hint: t("proposals.form.proposal_summary_note") %>
-
+
<%= translations_form.text_area :description,
maxlength: Proposal.description_max_length,
class: "html-area" %>
diff --git a/spec/features/admin/site_customization/pages_spec.rb b/spec/features/admin/site_customization/pages_spec.rb
index 42042f028..3671ba64a 100644
--- a/spec/features/admin/site_customization/pages_spec.rb
+++ b/spec/features/admin/site_customization/pages_spec.rb
@@ -86,10 +86,9 @@ describe "Admin custom pages" do
scenario "Allows images in CKEditor", :js do
visit edit_admin_site_customization_page_path(custom_page)
+ fill_in_ckeditor "Content", with: "Will add an image"
- within(".ckeditor") do
- expect(page).to have_css(".cke_toolbar .cke_button__image_icon")
- end
+ expect(page).to have_css(".cke_toolbar .cke_button__image_icon")
end
end
diff --git a/spec/support/matchers/have_ckeditor.rb b/spec/support/matchers/have_ckeditor.rb
index 7e23245ec..8072ad511 100644
--- a/spec/support/matchers/have_ckeditor.rb
+++ b/spec/support/matchers/have_ckeditor.rb
@@ -1,15 +1,27 @@
RSpec::Matchers.define :have_ckeditor do |label, with:|
- match do
- return false unless has_css?(".ckeditor", text: label)
+ define_method :textarea_id do
+ find("label", text: label)[:for]
+ end
- page.within(".ckeditor", text: label) do
+ define_method :ckeditor_id do
+ "#cke_#{textarea_id}"
+ end
+
+ define_method :has_ckeditor? do
+ has_css?("label", text: label) && has_css?(ckeditor_id)
+ end
+
+ match do
+ return false unless has_ckeditor?
+
+ page.within(ckeditor_id) do
within_frame(0) { has_content?(with) }
end
end
failure_message do
- if has_css?(".ckeditor", text: label)
- text = page.within(".ckeditor", text: label) { within_frame(0) { page.text } }
+ if has_ckeditor?
+ text = page.within(ckeditor_id) { within_frame(0) { page.text } }
"expected to find visible CKEditor '#{label}' with '#{with}', but had '#{text}'"
else