Merge pull request #3699 from consul/upgrade_turbolinks

Bump turbolinks to 5.2.1
This commit is contained in:
Javier Martín
2020-08-12 14:34:19 +02:00
committed by GitHub
48 changed files with 529 additions and 116 deletions

View File

@@ -190,6 +190,34 @@ describe "Admin banners magement" do
expect(page).to have_field "Post started at", with: "22/02/2002"
end
scenario "when date picker is opened and click on browser history back datepicker is closed", :js do
banner = create(:banner)
visit admin_banners_path(banner)
click_link "Edit banner"
find_field("Post started at").click
expect(page).to have_css "#ui-datepicker-div"
go_back
expect(page).to have_content("Banners")
expect(page).not_to have_css "#ui-datepicker-div"
end
scenario "date picker works after using the browser back button", :js do
banner = create(:banner)
visit edit_admin_banner_path(banner)
click_link "Manage banners"
expect(page).to have_link "Edit banner"
go_back
find_field("Post started at").click
expect(page).to have_css "#ui-datepicker-div"
end
scenario "Delete a banner" do
create(:banner, title: "Ugly banner",
description: "Bad text",

View File

@@ -1877,5 +1877,27 @@ describe "Admin budget investments" do
expect(page).not_to have_content "Don't display me, please!"
end
end
scenario "When restoring the page from browser history renders columns selectors only once", :js do
visit admin_budget_budget_investments_path(budget)
click_link "Proposals"
expect(page).to have_content("There are no proposals.")
go_back
within("#js-columns-selector") do
find("strong", text: "Columns").click
end
within("#js-columns-selector-wrapper") do
selectable_columns.each do |column|
check_text = I18n.t("admin.budget_investments.index.list.#{column}")
expect(page).to have_content(check_text, count: 1)
end
end
end
end
end

View File

@@ -83,18 +83,74 @@ describe "Admin legislation draft versions" do
click_link "Version 1"
fill_in "Version title", with: "Version 1b"
click_link "Launch text editor"
fill_in "Text", with: "# Version 1 body\r\n\r\nParagraph\r\n\r\n>Quote"
within(".fullscreen") do
click_link "Close text editor"
end
fill_in_markdown_editor "Text", with: "# Version 1 body\r\n\r\nParagraph\r\n\r\n>Quote"
click_button "Save changes"
expect(page).to have_content "Version 1b"
end
end
context "Changing content with the markdown editor", :js do
let(:prompt) { "You've edited the text without saving it. Do you confirm to leave the page?" }
let(:version) { create(:legislation_draft_version, body: "Version 1") }
let(:path) do
edit_admin_legislation_process_draft_version_path(version.process, version)
end
scenario "asks for confimation when the content is modified" do
visit path
fill_in_markdown_editor "Text", with: "Version 1b"
expect(page).to have_content "You've edited the text"
dismiss_confirm(prompt) do
click_link "Proposals", match: :first
end
expect(page).to have_current_path(path)
end
scenario "asks for confimation after the page is restored from browser history" do
visit path
fill_in_markdown_editor "Text", with: "Version 1b"
accept_confirm(prompt) do
click_link "Proposals", match: :first
end
expect(page).to have_css("h2", text: "Proposals")
go_back
expect(page).to have_content version.process.title
accept_confirm(prompt) do
click_link "Proposals", match: :first
end
expect(page).to have_css("h2", text: "Proposals")
end
scenario "does not ask for confirmation when restoring the original content" do
visit path
fill_in_markdown_editor "Text", with: "Version 1b"
accept_confirm(prompt) do
click_link "Proposals", match: :first
end
expect(page).to have_css("h2", text: "Proposals")
go_back
fill_in_markdown_editor "Text", with: "Version 1"
expect(page).not_to have_content "You've edited the text"
click_link "Proposals", match: :first
expect(page).to have_css("h2", text: "Proposals")
end
end
end