Merge branch 'master' into feature/1-nav-content-blocks

This commit is contained in:
Alberto
2018-09-05 12:41:07 +02:00
committed by GitHub
192 changed files with 2816 additions and 1581 deletions

View File

@@ -88,7 +88,7 @@ feature "Admin custom content blocks" do
expect(page).to have_content("#{block.name} (#{block.locale})")
expect(page).to have_content(block.body)
click_button "Delete block"
click_link "Delete block"
expect(page).not_to have_content("#{block.name} (#{block.locale})")
expect(page).not_to have_content(block.body)
@@ -98,7 +98,7 @@ feature "Admin custom content blocks" do
block = create(:site_customization_content_block)
visit edit_admin_site_customization_content_block_path(block)
click_button "Delete block"
click_link "Delete block"
expect(page).not_to have_content("#{block.name} (#{block.locale})")
expect(page).not_to have_content(block.body)

View File

@@ -11,7 +11,7 @@ feature "Admin custom images" do
visit admin_root_path
within("#side_menu") do
click_link "Custom Images"
click_link "Custom images"
end
within("tr.logo_header") do
@@ -27,7 +27,7 @@ feature "Admin custom images" do
visit admin_root_path
within("#side_menu") do
click_link "Custom Images"
click_link "Custom images"
end
within("tr.icon_home") do
@@ -43,7 +43,7 @@ feature "Admin custom images" do
visit admin_root_path
within("#side_menu") do
click_link "Custom Images"
click_link "Custom images"
end
within("tr.social_media_icon") do

View File

@@ -0,0 +1,172 @@
require 'rails_helper'
feature "Admin custom information texts" do
background do
admin = create(:administrator)
login_as(admin.user)
end
scenario 'page is correctly loaded' do
visit admin_site_customization_information_texts_path
click_link 'Debates'
expect(page).to have_content 'Help about debates'
click_link 'Community'
expect(page).to have_content 'Access the community'
click_link 'Proposals'
expect(page).to have_content 'Create proposal'
within "#information-texts-tabs" do
click_link "Polls"
end
expect(page).to have_content 'Results'
click_link 'Layouts'
expect(page).to have_content 'Accessibility'
click_link 'Emails'
expect(page).to have_content 'Confirm your email'
within "#information-texts-tabs" do
click_link "Management"
end
expect(page).to have_content 'This user account is already verified.'
click_link 'Guides'
expect(page).to have_content 'Choose what you want to create'
click_link 'Welcome'
expect(page).to have_content 'See all debates'
end
context "Globalization" do
scenario "Add a translation", :js do
key = "debates.form.debate_title"
visit admin_site_customization_information_texts_path
select "Français", from: "translation_locale"
fill_in "contents_content_#{key}values_value_fr", with: 'Titre personalise du débat'
click_button "Save"
expect(page).to have_content 'Translation updated successfully'
select "Français", from: "translation_locale"
expect(page).to have_content 'Titre personalise du débat'
expect(page).not_to have_content 'Titre du débat'
end
scenario "Update a translation", :js do
key = "debates.form.debate_title"
content = create(:i18n_content, key: key, value_fr: 'Titre personalise du débat')
visit admin_site_customization_information_texts_path
select "Français", from: "translation_locale"
fill_in "contents_content_#{key}values_value_fr", with: 'Titre personalise again du débat'
click_button 'Save'
expect(page).to have_content 'Translation updated successfully'
click_link 'Français'
expect(page).to have_content 'Titre personalise again du débat'
expect(page).not_to have_content 'Titre personalise du débat'
end
scenario "Remove a translation", :js do
first_key = "debates.form.debate_title"
debate_title = create(:i18n_content, key: first_key,
value_en: 'Custom debate title',
value_es: 'Título personalizado de debate')
second_key = "debates.form.debate_text"
debate_text = create(:i18n_content, key: second_key,
value_en: 'Custom debate text',
value_es: 'Texto personalizado de debate')
visit admin_site_customization_information_texts_path
click_link "Español"
click_link "Remove language"
click_button "Save"
expect(page).not_to have_link "Español"
click_link 'English'
expect(page).to have_content 'Custom debate text'
expect(page).to have_content 'Custom debate title'
debate_title.reload
debate_text.reload
expect(debate_text.value_es).to be(nil)
expect(debate_title.value_es).to be(nil)
expect(debate_text.value_en).to eq('Custom debate text')
expect(debate_title.value_en).to eq('Custom debate title')
end
context "Javascript interface" do
scenario "Highlight current locale", :js do
visit admin_site_customization_information_texts_path
expect(find("a.js-globalize-locale-link.is-active")).to have_content "English"
select('Español', from: 'locale-switcher')
expect(find("a.js-globalize-locale-link.is-active")).to have_content "Español"
end
scenario "Highlight selected locale", :js do
key = "debates.form.debate_title"
content = create(:i18n_content, key: key, value_es: 'Título')
visit admin_site_customization_information_texts_path
expect(find("a.js-globalize-locale-link.is-active")).to have_content "English"
click_link "Español"
expect(find("a.js-globalize-locale-link.is-active")).to have_content "Español"
end
scenario "Show selected locale form", :js do
key = "debates.form.debate_title"
content = create(:i18n_content, key: key,
value_en: 'Title',
value_es: 'Título')
visit admin_site_customization_information_texts_path
expect(page).to have_field("contents_content_#{key}values_value_en", with: 'Title')
click_link "Español"
expect(page).to have_field("contents_content_#{key}values_value_es", with: 'Título')
end
scenario "Select a locale and add it to the form", :js do
key = "debates.form.debate_title"
visit admin_site_customization_information_texts_path
select "Français", from: "translation_locale"
expect(page).to have_link "Français"
click_link "Français"
expect(page).to have_field("contents_content_#{key}values_value_fr")
end
end
end
end

View File

@@ -19,7 +19,7 @@ feature "Admin custom pages" do
visit admin_root_path
within("#side_menu") do
click_link "Custom Pages"
click_link "Custom pages"
end
expect(page).not_to have_content "An example custom page"
@@ -44,7 +44,7 @@ feature "Admin custom pages" do
visit admin_root_path
within("#side_menu") do
click_link "Custom Pages"
click_link "Custom pages"
end
click_link "An example custom page"
@@ -63,7 +63,7 @@ feature "Admin custom pages" do
custom_page = create(:site_customization_page, title: "An example custom page")
visit edit_admin_site_customization_page_path(custom_page)
click_button "Delete page"
click_link "Delete page"
expect(page).not_to have_content("An example custom page")
end