FEATURE: Load translation overrides without JS eval

This commit is contained in:
Gerhard Schlager
2019-11-05 02:15:44 +01:00
parent ca6adfbdd6
commit 61b1f9c36b
14 changed files with 181 additions and 87 deletions

View File

@ -204,26 +204,5 @@ describe "translate accelerator" do
override_translation('en', 'fish', 'fake fish')
expect(Fish.model_name.human).to eq('Fish')
end
describe "client json" do
it "is empty by default" do
expect(I18n.client_overrides_json('en')).to eq('{}')
end
it "doesn't return server overrides" do
override_translation('en', 'foo', 'bar')
expect(I18n.client_overrides_json('en')).to eq('{}')
end
it "returns client overrides" do
override_translation('en', 'js.foo', 'bar')
override_translation('en', 'admin_js.beep', 'boop')
json = ::JSON.parse(I18n.client_overrides_json('en'))
expect(json).to be_present
expect(json['js.foo']).to eq('bar')
expect(json['admin_js.beep']).to eq('boop')
end
end
end
end