ckeditor5 1.17.2 → 1.17.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 789a4ca2ac0428fa31866a6fd99433577137e9ccbe64e321e86c20126814dc80
4
- data.tar.gz: f4d3bc6f16777dd8dc03c4e62aada4c772021fc72bc99eeecbc668ac0dcc39b6
3
+ metadata.gz: fe514f6683b41d1fff1a64788a8ab4a608a567563fb904c7af684c9d24f94fe9
4
+ data.tar.gz: 411ce73542f83467ae713fbf8bd2976a3597b82f2df4b7cc8ee19ab93cc65ea2
5
5
  SHA512:
6
- metadata.gz: '02238ab74fc9982f48177b33bc20b59332ca58f9cb594868649e72ec5e504760d41e5a0ce4afee0cbeb5463335e34fb4303e5e30fd6b21abd96968a017ba715f'
7
- data.tar.gz: f4a331e7b9afca50f1063626a73c083ed521521333e7492eaf252bd30a360b435459fe5a8d321c4b5a4355c291272c2ee352a01bbd15d8c916434222fbdaa804
6
+ metadata.gz: b3420f1f381e795d37416b0038dba3c60980a2038d959a267ab6c70cbaf883af7e12ee3bcdd9a3f80c2ff27edb38d01c2da1a98133aa08cd6736e01e8d6d25db
7
+ data.tar.gz: 2a1102d9f90cf10f41a28b8d644d1d51c88a1b90553d3b65c8c8d486180282a9bcb61a3d5f5975333616711da7e3129632f0cb50bc835c43e131102beed62918
@@ -43,7 +43,9 @@ module CKEditor5::Rails
43
43
  end
44
44
 
45
45
  def translations_js_url_imports
46
- translations.map do |lang|
46
+ translations.filter_map do |lang|
47
+ next if lang == :en
48
+
47
49
  url = create_cdn_url(import_name, version, "translations/#{lang}.js")
48
50
 
49
51
  Assets::JSUrlImportMeta.new(
@@ -2,7 +2,7 @@
2
2
 
3
3
  module CKEditor5
4
4
  module Rails
5
- VERSION = '1.17.2'
5
+ VERSION = '1.17.3'
6
6
 
7
7
  DEFAULT_CKEDITOR_VERSION = '43.3.1'
8
8
  end
@@ -2,46 +2,53 @@
2
2
 
3
3
  require 'e2e/spec_helper'
4
4
 
5
+ TRANSLATIONS = {
6
+ 'en' => { 'Edit' => 'Edit', 'Insert' => 'Insert', 'Format' => 'Format' },
7
+ 'pl' => { 'Edit' => 'Zmiana', 'Insert' => 'Wstaw', 'Format' => 'Format' },
8
+ 'es' => { 'Edit' => 'Editar', 'Insert' => 'Insertar', 'Format' => 'Formato' },
9
+ 'ru' => { 'Edit' => 'Редактировать', 'Insert' => 'Вставить', 'Format' => 'Формат' },
10
+ 'de' => { 'Edit' => 'Bearbeiten', 'Insert' => 'Einfügen', 'Format' => 'Format' }
11
+ }.freeze
12
+
5
13
  RSpec.describe 'Editor localization', type: :system do
6
- describe 'setting locale via assets' do
7
- it 'displays menubar in Polish' do
8
- visit '/locale_via_assets'
14
+ shared_examples 'localized editor' do |locale|
15
+ it "displays menubar in #{locale}" do
16
+ visit path
9
17
 
10
18
  expect(page).to have_css('.ck-editor__main')
11
19
 
12
20
  within('.ck-menu-bar') do
13
- expect(page).to have_content('Zmiana')
14
- expect(page).to have_content('Wstaw')
15
- expect(page).to have_content('Format')
21
+ TRANSLATIONS[locale].each_value do |translation|
22
+ expect(page).to have_content(translation)
23
+ end
16
24
  end
17
25
  end
18
26
  end
19
27
 
20
- describe 'setting locale via editor prop' do
21
- it 'displays menubar in Spanish' do
22
- visit '/locale_via_editor'
23
-
24
- expect(page).to have_css('.ck-editor__main')
28
+ describe 'setting locale via assets' do
29
+ let(:path) { '/locale_via_assets' }
30
+ it_behaves_like 'localized editor', 'pl'
31
+ end
25
32
 
26
- within('.ck-menu-bar') do
27
- expect(page).to have_content('Editar')
28
- expect(page).to have_content('Insertar')
29
- expect(page).to have_content('Formato')
30
- end
31
- end
33
+ describe 'setting locale via editor prop' do
34
+ let(:path) { '/locale_via_editor' }
35
+ it_behaves_like 'localized editor', 'es'
32
36
  end
33
37
 
34
38
  describe 'setting locale via preset' do
35
- it 'displays menubar in Russian' do
36
- visit '/locale_via_preset'
39
+ let(:path) { '/locale_via_preset' }
40
+ it_behaves_like 'localized editor', 'ru'
41
+ end
37
42
 
38
- expect(page).to have_css('.ck-editor__main')
43
+ describe 'setting locale via Rails I18n' do
44
+ context 'using default I18n.locale' do
45
+ let(:path) { '/locale_via_rails_i18n' }
46
+ it_behaves_like 'localized editor', 'en'
47
+ end
39
48
 
40
- within('.ck-menu-bar') do
41
- expect(page).to have_content('Редактировать')
42
- expect(page).to have_content('Вставить')
43
- expect(page).to have_content('Формат')
44
- end
49
+ context 'using custom I18n.locale' do
50
+ let(:path) { '/locale_via_rails_i18n?locale=de' }
51
+ it_behaves_like 'localized editor', 'de'
45
52
  end
46
53
  end
47
54
  end
@@ -58,6 +58,28 @@ RSpec.describe CKEditor5::Rails::Cdn::CKEditorBundle do
58
58
  "#{cdn}/npm/#{import_name}@#{version}/build/translations/de.js"
59
59
  )
60
60
  end
61
+
62
+ context 'when handling English translation' do
63
+ before { bundle.translations << :en }
64
+
65
+ it 'excludes English translation file' do
66
+ translation_urls = bundle.scripts.select(&:translation?).map(&:url)
67
+ expect(translation_urls).not_to include(
68
+ "#{cdn}/npm/#{import_name}@#{version}/build/translations/en.js"
69
+ )
70
+ end
71
+ end
72
+
73
+ context 'when adding additional translations' do
74
+ before { bundle.translations << :ru }
75
+
76
+ it 'includes new non-English translations' do
77
+ translation_urls = bundle.scripts.select(&:translation?).map(&:url)
78
+ expect(translation_urls).to include(
79
+ "#{cdn}/npm/#{import_name}@#{version}/build/translations/ru.js"
80
+ )
81
+ end
82
+ end
61
83
  end
62
84
 
63
85
  describe '#stylesheets' do
@@ -22,7 +22,7 @@ RSpec.describe CKEditor5::Rails::Hooks::Form do
22
22
  name: 'post[content]',
23
23
  id: 'post_content',
24
24
  type: 'ClassicEditor',
25
- translations: '[{"import_name":"ckeditor5/translations/en.js"}]',
25
+ translations: '[]',
26
26
  watchdog: 'true'
27
27
  }
28
28
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ckeditor5
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.17.2
4
+ version: 1.17.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mateusz Bagiński