diff --git a/app/views/legislation/annotations/_comments_box.html.erb b/app/views/legislation/annotations/_comments_box.html.erb index 2a543566c..3fa3e61c5 100644 --- a/app/views/legislation/annotations/_comments_box.html.erb +++ b/app/views/legislation/annotations/_comments_box.html.erb @@ -45,7 +45,7 @@ <% end %> <% if @process.open_phase?(:allegations) %> - Publicar comentario + <%= t('legislation.annotations.comments.publish_comment') %> <% end %> <% if @process.open_phase?(:allegations) %> diff --git a/spec/features/legislation/draft_versions_spec.rb b/spec/features/legislation/draft_versions_spec.rb index d0f303743..fc6a1b88f 100644 --- a/spec/features/legislation/draft_versions_spec.rb +++ b/spec/features/legislation/draft_versions_spec.rb @@ -171,7 +171,7 @@ feature 'Legislation Draft Versions' do expect(page).to have_content "this is my annotation" end - scenario 'Search' do + scenario 'View annotations and comments' do draft_version = create(:legislation_draft_version, :published, body: Faker::Lorem.paragraph) annotation1 = create(:legislation_annotation, draft_version: draft_version, text: "my annotation", ranges: [{"start"=>"/p[1]", "startOffset"=>5, "end"=>"/p[1]", "endOffset"=>10}]) annotation2 = create(:legislation_annotation, draft_version: draft_version, text: "my other annotation", ranges: [{"start"=>"/p[1]", "startOffset"=>12, "end"=>"/p[1]", "endOffset"=>19}]) @@ -185,6 +185,22 @@ feature 'Legislation Draft Versions' do all(".annotator-hl")[1].trigger('click') expect(page).to have_content "my other annotation" end + + scenario "Publish new comment for an annotation from comments box" do + draft_version = create(:legislation_draft_version, :published, body: Faker::Lorem.paragraph) + annotation = create(:legislation_annotation, draft_version: draft_version, text: "my annotation", ranges: [{"start"=>"/p[1]", "startOffset"=>5, "end"=>"/p[1]", "endOffset"=>10}]) + + visit legislation_process_draft_version_path(draft_version.process, draft_version) + + expect(page).to have_css ".annotator-hl" + first(:css, ".annotator-hl").click + expect(page).to have_content "my annotation" + + click_link "Publish Comment" + fill_in "comment[body]", with: "My interesting comment" + click_button "Publish comment" + expect(page).to have_content "My interesting comment" + end end context "Annotations page" do