Skip to content

Commit

Permalink
add button
Browse files Browse the repository at this point in the history
  • Loading branch information
antopalidi committed Oct 30, 2023
1 parent 8db6669 commit b537345
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<h2 class="card-title flex--sbc">
<%= translated_attribute(current_component.name) %>
<%= render "title", button: :back %>
<div class="flex--cc flex-gap--1"><%= preview_sections_btn %></div>
</h2>
</div>
<div class="card-section pdf-viewer-container">
Expand Down
63 changes: 42 additions & 21 deletions spec/system/admin/admin_manages_participatory_documents_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -191,34 +191,55 @@ def upload_file
expect(page).to have_link("Preview and publish sections")
end

it "goes to the preview page" do
click_link "Preview and publish sections"
expect(page).to have_content("you are previewing the participatory sections of the document")
end
context "when in the editor" do
before do
click_link "Edit participatory areas"
end

it "shows the preview button" do
expect(page).to have_link("Preview and publish sections")
end

it "can edit sections after previewing" do
click_link "Preview and publish sections"
click_link "Go back to edit participatory sections"
expect(page).to have_selector("a[href='#{manage_component_path(component)}'][title='Back']")
it "goes to the preview page" do
click_link "Preview and publish sections"
expect(page).to have_content("you are previewing the participatory sections of the document")
end
end

it "can publish sections after previewing" do
click_link "Preview and publish sections"
click_link "Publish participatory sections"
expect(page).to have_content("are you sure?")
context "when previewing the document" do
before do
click_link "Preview and publish sections"
end

click_link "OK"
expect(page).to have_content("Sections have been successfully published")
it "displays the preview content" do
expect(page).to have_content("you are previewing the participatory sections of the document")
end

it "can edit sections after previewing" do
click_link "Go back to edit participatory sections"
expect(page).to have_selector("a[href='#{manage_component_path(component)}'][title='Back']")
end

it "can publish sections" do
click_link "Publish participatory sections"
expect(page).to have_content("are you sure?")
click_link "OK"
expect(page).to have_content("Sections have been successfully published")
end
end

it "can't edit sections after publishing" do
click_link "Preview and publish sections"
click_link "Publish participatory sections"
click_link "OK"
context "when the document has been published" do
before do
click_link "Preview and publish sections"
click_link "Publish participatory sections"
click_link "OK"
end

expect(page).not_to have_content("Edit/upload document")
expect(page).not_to have_content("Edit participatory areas")
expect(page).not_to have_content("Preview and publish sections")
it "restricts editing sections" do
expect(page).not_to have_content("Edit/upload document")
expect(page).not_to have_content("Edit participatory areas")
expect(page).not_to have_content("Preview and publish sections")
end
end
end
end

0 comments on commit b537345

Please sign in to comment.