diff --git a/app/assets/javascripts/app/controllers/translation.coffee b/app/assets/javascripts/app/controllers/translation.coffee index f3e6adf2f..70900c430 100644 --- a/app/assets/javascripts/app/controllers/translation.coffee +++ b/app/assets/javascripts/app/controllers/translation.coffee @@ -175,7 +175,7 @@ class Index extends App.ControllerSubContent success: => loader.update(locale.name, false) locale = locales.shift() - if _.isEmpty(locales) + if !locale hide() return @_syncChanges(locale, locales, loader, hide) diff --git a/spec/system/system/translations_spec.rb b/spec/system/system/translations_spec.rb new file mode 100644 index 000000000..5f9ac1c63 --- /dev/null +++ b/spec/system/system/translations_spec.rb @@ -0,0 +1,18 @@ +require 'rails_helper' + +RSpec.describe 'System > Translations', type: :system do + prepend_before do + Locale.where.not(locale: %w[en-us de-de]).destroy_all # remove all but 2 locales for quicker test + end + + it 'when clicking "Get latest translations" fetches all translations' do + visit 'system/translation' + + expect(Translation).to receive(:load).with('de-de').and_return(true) + expect(Translation).to receive(:load).with('en-us').and_return(true) + + click '.js-syncChanges' + + modal_ready && modal_disappear # make sure test is not terminated while modal is visible + end +end