Add languages in use description

New interface now shows a description to ensure the user
knows how many languages are currently in use.
This commit is contained in:
Senén Rodero Rodríguez
2019-05-31 19:17:55 +02:00
parent db70594fca
commit 9fd77d4042
6 changed files with 125 additions and 13 deletions

View File

@@ -335,6 +335,30 @@ shared_examples "edit_translatable" do |factory_name, path_name, input_fields, t
expect_page_to_have_translatable_field fields.sample, :fr, with: ""
end
context "Languages in use" do
scenario "Show default description" do
visit path
expect(page).to have_content "2 languages in use"
end
scenario "Increase description count after add new language", :js do
visit path
select "Français", from: :add_language
expect(page).to have_content "3 languages in use"
end
scenario "Decrease description count after remove a language", :js do
visit path
click_link "Remove language"
expect(page).to have_content "1 language in use"
end
end
end
end

View File

@@ -154,6 +154,30 @@ shared_examples "new_translatable" do |factory_name, path_name, input_fields, te
expect(page).not_to have_link "English"
end
context "Languages in use" do
scenario "Show default description" do
visit new_translatable_path
expect(page).to have_content "1 language in use"
end
scenario "Increase description count after add new language", :js do
visit new_translatable_path
select "Español", from: :add_language
expect(page).to have_content "2 languages in use"
end
scenario "Decrease description count after remove a language", :js do
visit new_translatable_path
click_link "Remove language"
expect(page).to have_content "0 languages in use"
end
end
end
end