Update site customization pages translatable fields

This commit is contained in:
Javi Martín
2018-10-10 18:12:12 +02:00
committed by decabeza
parent e9a5f03089
commit e400cb8eae
7 changed files with 38 additions and 145 deletions

View File

@@ -137,123 +137,4 @@ feature "Custom Pages" do
end
end
end
context "Translation" do
let(:custom_page) { create(:site_customization_page, :published,
slug: "example-page",
title_en: "Title in English",
title_es: "Titulo en Español",
subtitle_en: "Subtitle in English",
subtitle_es: "Subtitulo en Español",
content_en: "Content in English",
content_es: "Contenido en Español"
) }
background do
admin = create(:administrator)
login_as(admin.user)
end
before do
@edit_page_url = edit_admin_site_customization_page_path(custom_page)
end
scenario "Add a translation in Português", :js do
visit @edit_page_url
select "Português brasileiro", from: "translation_locale"
fill_in 'site_customization_page_title_pt_br', with: 'Titulo em Português'
click_button 'Update Custom page'
expect(page).to have_content "Page updated successfully"
visit @edit_page_url
expect(page).to have_field('site_customization_page_title_en', with: 'Title in English')
click_link "Español"
expect(page).to have_field('site_customization_page_title_es', with: 'Titulo en Español')
click_link "Português brasileiro"
expect(page).to have_field('site_customization_page_title_pt_br', with: 'Titulo em Português')
end
scenario "Update a translation", :js do
visit @edit_page_url
click_link "Español"
fill_in 'site_customization_page_title_es', with: 'Titulo correcta en Español'
click_button 'Update Custom page'
expect(page).to have_content "Page updated successfully"
visit custom_page.url
select('English', from: 'locale-switcher')
expect(page).to have_content("Title in English")
select('Español', from: 'locale-switcher')
expect(page).to have_content("Titulo correcta en Español")
end
scenario "Remove a translation", :js do
visit @edit_page_url
click_link "Español"
click_link "Remove language"
expect(page).not_to have_link "Español"
click_button "Update Custom page"
visit @edit_page_url
expect(page).not_to have_link "Español"
end
context "Globalize javascript interface" do
scenario "Highlight current locale", :js do
visit @edit_page_url
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
visit @edit_page_url
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
visit @edit_page_url
expect(page).to have_field('site_customization_page_title_en', with: 'Title in English')
click_link "Español"
expect(page).to have_field('site_customization_page_title_es', with: 'Titulo en Español')
end
scenario "Select a locale and add it to the milestone form", :js do
visit @edit_page_url
select "Français", from: "translation_locale"
expect(page).to have_link "Français"
click_link "Français"
expect(page).to have_field('site_customization_page_title_fr')
end
end
end
end