ckeditor5 1.15.9 → 1.16.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -0
  3. data/lib/ckeditor5/rails/assets/webcomponents/components/context.mjs +23 -0
  4. data/lib/ckeditor5/rails/assets/webcomponents/components/editor.mjs +24 -0
  5. data/lib/ckeditor5/rails/assets/webcomponents/utils.mjs +33 -10
  6. data/lib/ckeditor5/rails/concerns/checksum.rb +15 -0
  7. data/lib/ckeditor5/rails/context/props.rb +17 -2
  8. data/lib/ckeditor5/rails/editor/props.rb +16 -3
  9. data/lib/ckeditor5/rails/editor/props_base_plugin.rb +19 -0
  10. data/lib/ckeditor5/rails/editor/props_inline_plugin.rb +6 -3
  11. data/lib/ckeditor5/rails/editor/props_plugin.rb +6 -4
  12. data/lib/ckeditor5/rails/engine.rb +3 -2
  13. data/lib/ckeditor5/rails/presets/plugins_builder.rb +9 -9
  14. data/lib/ckeditor5/rails/presets/preset_builder.rb +4 -6
  15. data/lib/ckeditor5/rails/version.rb +1 -1
  16. data/lib/ckeditor5/rails.rb +1 -0
  17. data/spec/e2e/features/editor_types_spec.rb +178 -0
  18. data/spec/e2e/features/form_integration_spec.rb +60 -0
  19. data/spec/e2e/spec_helper.rb +43 -0
  20. data/spec/e2e/support/eventually.rb +14 -0
  21. data/spec/e2e/support/form_helpers.rb +37 -0
  22. data/spec/lib/ckeditor5/rails/assets/asset_bundle_hml_serializer_spec.rb +7 -0
  23. data/spec/lib/ckeditor5/rails/cdn/helpers_spec.rb +19 -1
  24. data/spec/lib/ckeditor5/rails/concerns/checksum_spec.rb +50 -0
  25. data/spec/lib/ckeditor5/rails/context/props_spec.rb +7 -1
  26. data/spec/lib/ckeditor5/rails/editor/props_base_plugin_spec.rb +27 -0
  27. data/spec/lib/ckeditor5/rails/editor/props_spec.rb +2 -0
  28. data/spec/lib/ckeditor5/rails/engine_spec.rb +88 -0
  29. data/spec/lib/ckeditor5/rails/hooks/form_spec.rb +156 -0
  30. data/spec/lib/ckeditor5/rails/hooks/simple_form_spec.rb +100 -0
  31. data/spec/lib/ckeditor5/rails/presets/plugins_builder_spec.rb +10 -10
  32. data/spec/lib/ckeditor5/rails/presets/preset_builder_spec.rb +10 -0
  33. data/spec/spec_helper.rb +2 -2
  34. metadata +22 -2
@@ -3,8 +3,8 @@
3
3
  require 'spec_helper'
4
4
 
5
5
  RSpec.describe CKEditor5::Rails::Presets::PluginsBuilder do
6
- let(:plugins) { [] }
7
- let(:builder) { described_class.new(plugins) }
6
+ let(:items) { [] }
7
+ let(:builder) { described_class.new(items) }
8
8
 
9
9
  describe '.create_plugin' do
10
10
  context 'when name is a string' do
@@ -27,7 +27,7 @@ RSpec.describe CKEditor5::Rails::Presets::PluginsBuilder do
27
27
 
28
28
  describe '#remove' do
29
29
  before do
30
- plugins.push(
30
+ items.push(
31
31
  CKEditor5::Rails::Editor::PropsPlugin.new('Plugin1'),
32
32
  CKEditor5::Rails::Editor::PropsPlugin.new('Plugin2'),
33
33
  CKEditor5::Rails::Editor::PropsPlugin.new('Plugin3')
@@ -36,7 +36,7 @@ RSpec.describe CKEditor5::Rails::Presets::PluginsBuilder do
36
36
 
37
37
  it 'removes specified plugins' do
38
38
  builder.remove('Plugin1', 'Plugin3')
39
- expect(plugins.map(&:name)).to eq(['Plugin2'])
39
+ expect(items.map(&:name)).to eq(['Plugin2'])
40
40
  end
41
41
  end
42
42
 
@@ -44,20 +44,20 @@ RSpec.describe CKEditor5::Rails::Presets::PluginsBuilder do
44
44
  let(:existing_plugin) { CKEditor5::Rails::Editor::PropsPlugin.new('ExistingPlugin') }
45
45
 
46
46
  before do
47
- plugins.push(existing_plugin)
47
+ items.push(existing_plugin)
48
48
  end
49
49
 
50
50
  context 'without before option' do
51
51
  it 'adds plugins at the beginning' do
52
52
  builder.prepend('NewPlugin1', 'NewPlugin2')
53
- expect(plugins.map(&:name)).to eq(%w[NewPlugin1 NewPlugin2 ExistingPlugin])
53
+ expect(items.map(&:name)).to eq(%w[NewPlugin1 NewPlugin2 ExistingPlugin])
54
54
  end
55
55
  end
56
56
 
57
57
  context 'with before option' do
58
58
  it 'adds plugins before specified plugin' do
59
59
  builder.prepend('NewPlugin', before: 'ExistingPlugin')
60
- expect(plugins.map(&:name)).to eq(%w[NewPlugin ExistingPlugin])
60
+ expect(items.map(&:name)).to eq(%w[NewPlugin ExistingPlugin])
61
61
  end
62
62
 
63
63
  it 'raises error when target plugin not found' do
@@ -72,20 +72,20 @@ RSpec.describe CKEditor5::Rails::Presets::PluginsBuilder do
72
72
  let(:existing_plugin) { CKEditor5::Rails::Editor::PropsPlugin.new('ExistingPlugin') }
73
73
 
74
74
  before do
75
- plugins.push(existing_plugin)
75
+ items.push(existing_plugin)
76
76
  end
77
77
 
78
78
  context 'without after option' do
79
79
  it 'adds plugins at the end' do
80
80
  builder.append('NewPlugin1', 'NewPlugin2')
81
- expect(plugins.map(&:name)).to eq(%w[ExistingPlugin NewPlugin1 NewPlugin2])
81
+ expect(items.map(&:name)).to eq(%w[ExistingPlugin NewPlugin1 NewPlugin2])
82
82
  end
83
83
  end
84
84
 
85
85
  context 'with after option' do
86
86
  it 'adds plugins after specified plugin' do
87
87
  builder.append('NewPlugin', after: 'ExistingPlugin')
88
- expect(plugins.map(&:name)).to eq(%w[ExistingPlugin NewPlugin])
88
+ expect(items.map(&:name)).to eq(%w[ExistingPlugin NewPlugin])
89
89
  end
90
90
 
91
91
  it 'raises error when target plugin not found' do
@@ -1,6 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'spec_helper'
4
+ require_relative './plugins_builder_spec'
5
+ require_relative './toolbar_builder_spec'
4
6
 
5
7
  RSpec.describe CKEditor5::Rails::Presets::PresetBuilder do
6
8
  let(:builder) { described_class.new }
@@ -139,6 +141,10 @@ RSpec.describe CKEditor5::Rails::Presets::PresetBuilder do
139
141
  end
140
142
  expect(builder.config[:toolbar][:items]).to include(:bold, :italic, :undo)
141
143
  end
144
+
145
+ it 'returns ToolbarBuilder instance if no block provided' do
146
+ expect(builder.toolbar).to be_a(CKEditor5::Rails::Presets::ToolbarBuilder)
147
+ end
142
148
  end
143
149
 
144
150
  describe '#plugins' do
@@ -157,6 +163,10 @@ RSpec.describe CKEditor5::Rails::Presets::PresetBuilder do
157
163
  plugin_names = builder.config[:plugins].map { |p| p.name.to_s }
158
164
  expect(plugin_names).to eq(%w[Paragraph Essentials])
159
165
  end
166
+
167
+ it 'returns PluginsBuilder instance if no block provided' do
168
+ expect(builder.plugins).to be_a(CKEditor5::Rails::Presets::PluginsBuilder)
169
+ end
160
170
  end
161
171
 
162
172
  describe '#simple_upload_adapter' do
data/spec/spec_helper.rb CHANGED
@@ -14,7 +14,7 @@ SimpleCov.start do
14
14
 
15
15
  track_files 'lib/**/*.rb'
16
16
 
17
- minimum_coverage 98
17
+ minimum_coverage 100
18
18
 
19
19
  formatters = [
20
20
  SimpleCov::Formatter::HTMLFormatter,
@@ -36,7 +36,7 @@ require 'rspec-html-matchers'
36
36
 
37
37
  Dir[File.expand_path('support/**/*.rb', __dir__)].each { |f| require f }
38
38
 
39
- Rails.application.initialize!
39
+ Rails.application.initialize! unless Rails.application.initialized?
40
40
 
41
41
  RSpec.configure do |config|
42
42
  config.expect_with :rspec do |expectations|
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.15.9
4
+ version: 1.16.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mateusz Bagiński
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2024-11-21 00:00:00.000000000 Z
12
+ date: 2024-11-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -55,6 +55,7 @@ files:
55
55
  - lib/ckeditor5/rails/cdn/ckeditor_bundle.rb
56
56
  - lib/ckeditor5/rails/cdn/helpers.rb
57
57
  - lib/ckeditor5/rails/cdn/url_generator.rb
58
+ - lib/ckeditor5/rails/concerns/checksum.rb
58
59
  - lib/ckeditor5/rails/context/helpers.rb
59
60
  - lib/ckeditor5/rails/context/props.rb
60
61
  - lib/ckeditor5/rails/editor/editable_height_normalizer.rb
@@ -62,6 +63,7 @@ files:
62
63
  - lib/ckeditor5/rails/editor/helpers/config_helpers.rb
63
64
  - lib/ckeditor5/rails/editor/helpers/editor_helpers.rb
64
65
  - lib/ckeditor5/rails/editor/props.rb
66
+ - lib/ckeditor5/rails/editor/props_base_plugin.rb
65
67
  - lib/ckeditor5/rails/editor/props_inline_plugin.rb
66
68
  - lib/ckeditor5/rails/editor/props_plugin.rb
67
69
  - lib/ckeditor5/rails/engine.rb
@@ -76,21 +78,30 @@ files:
76
78
  - lib/ckeditor5/rails/semver.rb
77
79
  - lib/ckeditor5/rails/version.rb
78
80
  - lib/ckeditor5/rails/version_detector.rb
81
+ - spec/e2e/features/editor_types_spec.rb
82
+ - spec/e2e/features/form_integration_spec.rb
83
+ - spec/e2e/spec_helper.rb
84
+ - spec/e2e/support/eventually.rb
85
+ - spec/e2e/support/form_helpers.rb
79
86
  - spec/lib/ckeditor5/rails/assets/asset_bundle_hml_serializer_spec.rb
80
87
  - spec/lib/ckeditor5/rails/assets/assets_bundle_spec.rb
81
88
  - spec/lib/ckeditor5/rails/cdn/ckbox_bundle_spec.rb
82
89
  - spec/lib/ckeditor5/rails/cdn/ckeditor_bundle_spec.rb
83
90
  - spec/lib/ckeditor5/rails/cdn/helpers_spec.rb
84
91
  - spec/lib/ckeditor5/rails/cdn/url_generator_spec.rb
92
+ - spec/lib/ckeditor5/rails/concerns/checksum_spec.rb
85
93
  - spec/lib/ckeditor5/rails/context/helpers_spec.rb
86
94
  - spec/lib/ckeditor5/rails/context/props_spec.rb
87
95
  - spec/lib/ckeditor5/rails/editor/editable_height_normalizer_spec.rb
88
96
  - spec/lib/ckeditor5/rails/editor/helpers/config_helpers_spec.rb
89
97
  - spec/lib/ckeditor5/rails/editor/helpers/editor_helpers_spec.rb
98
+ - spec/lib/ckeditor5/rails/editor/props_base_plugin_spec.rb
90
99
  - spec/lib/ckeditor5/rails/editor/props_inline_plugin_spec.rb
91
100
  - spec/lib/ckeditor5/rails/editor/props_plugin_spec.rb
92
101
  - spec/lib/ckeditor5/rails/editor/props_spec.rb
102
+ - spec/lib/ckeditor5/rails/engine_spec.rb
93
103
  - spec/lib/ckeditor5/rails/hooks/form_spec.rb
104
+ - spec/lib/ckeditor5/rails/hooks/simple_form_spec.rb
94
105
  - spec/lib/ckeditor5/rails/presets/manager_spec.rb
95
106
  - spec/lib/ckeditor5/rails/presets/plugins_builder_spec.rb
96
107
  - spec/lib/ckeditor5/rails/presets/preset_builder_spec.rb
@@ -124,21 +135,30 @@ signing_key:
124
135
  specification_version: 4
125
136
  summary: CKEditor 5 for Rails
126
137
  test_files:
138
+ - spec/e2e/features/editor_types_spec.rb
139
+ - spec/e2e/features/form_integration_spec.rb
140
+ - spec/e2e/spec_helper.rb
141
+ - spec/e2e/support/eventually.rb
142
+ - spec/e2e/support/form_helpers.rb
127
143
  - spec/lib/ckeditor5/rails/assets/asset_bundle_hml_serializer_spec.rb
128
144
  - spec/lib/ckeditor5/rails/assets/assets_bundle_spec.rb
129
145
  - spec/lib/ckeditor5/rails/cdn/ckbox_bundle_spec.rb
130
146
  - spec/lib/ckeditor5/rails/cdn/ckeditor_bundle_spec.rb
131
147
  - spec/lib/ckeditor5/rails/cdn/helpers_spec.rb
132
148
  - spec/lib/ckeditor5/rails/cdn/url_generator_spec.rb
149
+ - spec/lib/ckeditor5/rails/concerns/checksum_spec.rb
133
150
  - spec/lib/ckeditor5/rails/context/helpers_spec.rb
134
151
  - spec/lib/ckeditor5/rails/context/props_spec.rb
135
152
  - spec/lib/ckeditor5/rails/editor/editable_height_normalizer_spec.rb
136
153
  - spec/lib/ckeditor5/rails/editor/helpers/config_helpers_spec.rb
137
154
  - spec/lib/ckeditor5/rails/editor/helpers/editor_helpers_spec.rb
155
+ - spec/lib/ckeditor5/rails/editor/props_base_plugin_spec.rb
138
156
  - spec/lib/ckeditor5/rails/editor/props_inline_plugin_spec.rb
139
157
  - spec/lib/ckeditor5/rails/editor/props_plugin_spec.rb
140
158
  - spec/lib/ckeditor5/rails/editor/props_spec.rb
159
+ - spec/lib/ckeditor5/rails/engine_spec.rb
141
160
  - spec/lib/ckeditor5/rails/hooks/form_spec.rb
161
+ - spec/lib/ckeditor5/rails/hooks/simple_form_spec.rb
142
162
  - spec/lib/ckeditor5/rails/presets/manager_spec.rb
143
163
  - spec/lib/ckeditor5/rails/presets/plugins_builder_spec.rb
144
164
  - spec/lib/ckeditor5/rails/presets/preset_builder_spec.rb