Add spec for publishing a comment from the comments box for a draft
This commit is contained in:
@@ -45,7 +45,7 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% if @process.open_phase?(:allegations) %>
|
<% if @process.open_phase?(:allegations) %>
|
||||||
<a class="button strong publish-comment" title="Publicar comentario" href="#">Publicar comentario</a>
|
<a class="button strong publish-comment" href="#"><%= t('legislation.annotations.comments.publish_comment') %></a>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% if @process.open_phase?(:allegations) %>
|
<% if @process.open_phase?(:allegations) %>
|
||||||
|
|||||||
@@ -171,7 +171,7 @@ feature 'Legislation Draft Versions' do
|
|||||||
expect(page).to have_content "this is my annotation"
|
expect(page).to have_content "this is my annotation"
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario 'Search' do
|
scenario 'View annotations and comments' do
|
||||||
draft_version = create(:legislation_draft_version, :published, body: Faker::Lorem.paragraph)
|
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}])
|
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}])
|
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')
|
all(".annotator-hl")[1].trigger('click')
|
||||||
expect(page).to have_content "my other annotation"
|
expect(page).to have_content "my other annotation"
|
||||||
end
|
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
|
end
|
||||||
|
|
||||||
context "Annotations page" do
|
context "Annotations page" do
|
||||||
|
|||||||
Reference in New Issue
Block a user