diff --git a/Gemfile.lock b/Gemfile.lock index c93d4dc..62f6162 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -2,7 +2,6 @@ PATH remote: . specs: view_component-form (0.1.0) - actiontext (>= 6.0.0, < 7.0) actionview (>= 6.0.0, < 7.0) activesupport (>= 6.0.0, < 7.0) view_component (>= 2.34.0, < 3.0) @@ -17,33 +16,12 @@ GEM rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.2.0) - actiontext (6.1.4.1) - actionpack (= 6.1.4.1) - activerecord (= 6.1.4.1) - activestorage (= 6.1.4.1) - activesupport (= 6.1.4.1) - nokogiri (>= 1.8.5) actionview (6.1.4.1) activesupport (= 6.1.4.1) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.1, >= 1.2.0) - activejob (6.1.4.1) - activesupport (= 6.1.4.1) - globalid (>= 0.3.6) - activemodel (6.1.4.1) - activesupport (= 6.1.4.1) - activerecord (6.1.4.1) - activemodel (= 6.1.4.1) - activesupport (= 6.1.4.1) - activestorage (6.1.4.1) - actionpack (= 6.1.4.1) - activejob (= 6.1.4.1) - activerecord (= 6.1.4.1) - activesupport (= 6.1.4.1) - marcel (~> 1.0.0) - mini_mime (>= 1.1.0) activesupport (6.1.4.1) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 1.6, < 2) @@ -74,14 +52,11 @@ GEM crass (1.0.6) diff-lcs (1.4.4) erubi (1.10.0) - globalid (0.5.2) - activesupport (>= 5.0) i18n (1.8.10) concurrent-ruby (~> 1.0) loofah (2.12.0) crass (~> 1.0.2) nokogiri (>= 1.5.9) - marcel (1.0.1) method_source (1.0.0) mini_mime (1.1.0) mini_portile2 (2.6.1) diff --git a/gemfiles/rails_6.0.x.gemfile.lock b/gemfiles/rails_6.0.x.gemfile.lock deleted file mode 100644 index 38394e6..0000000 --- a/gemfiles/rails_6.0.x.gemfile.lock +++ /dev/null @@ -1,213 +0,0 @@ -PATH - remote: .. - specs: - view_component-form (0.1.0) - actionview (>= 6.0.0, < 7.0) - activesupport (>= 6.0.0, < 7.0) - view_component (>= 2.34.0, < 3.0) - -GEM - remote: https://rubygems.org/ - specs: - actioncable (6.0.4) - actionpack (= 6.0.4) - nio4r (~> 2.0) - websocket-driver (>= 0.6.1) - actionmailbox (6.0.4) - actionpack (= 6.0.4) - activejob (= 6.0.4) - activerecord (= 6.0.4) - activestorage (= 6.0.4) - activesupport (= 6.0.4) - mail (>= 2.7.1) - actionmailer (6.0.4) - actionpack (= 6.0.4) - actionview (= 6.0.4) - activejob (= 6.0.4) - mail (~> 2.5, >= 2.5.4) - rails-dom-testing (~> 2.0) - actionpack (6.0.4) - actionview (= 6.0.4) - activesupport (= 6.0.4) - rack (~> 2.0, >= 2.0.8) - rack-test (>= 0.6.3) - rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.0, >= 1.2.0) - actiontext (6.0.4) - actionpack (= 6.0.4) - activerecord (= 6.0.4) - activestorage (= 6.0.4) - activesupport (= 6.0.4) - nokogiri (>= 1.8.5) - actionview (6.0.4) - activesupport (= 6.0.4) - builder (~> 3.1) - erubi (~> 1.4) - rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.1, >= 1.2.0) - activejob (6.0.4) - activesupport (= 6.0.4) - globalid (>= 0.3.6) - activemodel (6.0.4) - activesupport (= 6.0.4) - activerecord (6.0.4) - activemodel (= 6.0.4) - activesupport (= 6.0.4) - activestorage (6.0.4) - actionpack (= 6.0.4) - activejob (= 6.0.4) - activerecord (= 6.0.4) - marcel (~> 1.0.0) - activesupport (6.0.4) - concurrent-ruby (~> 1.0, >= 1.0.2) - i18n (>= 0.7, < 2) - minitest (~> 5.1) - tzinfo (~> 1.1) - zeitwerk (~> 2.2, >= 2.2.2) - addressable (2.7.0) - public_suffix (>= 2.0.2, < 5.0) - appraisal (2.4.0) - bundler - rake - thor (>= 0.14.0) - ast (2.4.2) - builder (3.2.4) - capybara (3.35.3) - addressable - mini_mime (>= 0.1.3) - nokogiri (~> 1.8) - rack (>= 1.6.0) - rack-test (>= 0.6.3) - regexp_parser (>= 1.5, < 3.0) - xpath (~> 3.2) - combustion (1.3.1) - activesupport (>= 3.0.0) - railties (>= 3.0.0) - thor (>= 0.14.6) - concurrent-ruby (1.1.9) - crass (1.0.6) - diff-lcs (1.4.4) - erubi (1.10.0) - globalid (0.4.2) - activesupport (>= 4.2.0) - i18n (1.8.10) - concurrent-ruby (~> 1.0) - loofah (2.10.0) - crass (~> 1.0.2) - nokogiri (>= 1.5.9) - mail (2.7.1) - mini_mime (>= 0.1.1) - marcel (1.0.1) - method_source (1.0.0) - mini_mime (1.1.0) - minitest (5.14.4) - nio4r (2.5.7) - nokogiri (1.11.7-x86_64-linux) - racc (~> 1.4) - parallel (1.20.1) - parser (3.0.1.1) - ast (~> 2.4.1) - public_suffix (4.0.6) - racc (1.5.2) - rack (2.2.3) - rack-test (1.1.0) - rack (>= 1.0, < 3) - rails (6.0.4) - actioncable (= 6.0.4) - actionmailbox (= 6.0.4) - actionmailer (= 6.0.4) - actionpack (= 6.0.4) - actiontext (= 6.0.4) - actionview (= 6.0.4) - activejob (= 6.0.4) - activemodel (= 6.0.4) - activerecord (= 6.0.4) - activestorage (= 6.0.4) - activesupport (= 6.0.4) - bundler (>= 1.3.0) - railties (= 6.0.4) - sprockets-rails (>= 2.0.0) - rails-dom-testing (2.0.3) - activesupport (>= 4.2.0) - nokogiri (>= 1.6) - rails-html-sanitizer (1.3.0) - loofah (~> 2.3) - railties (6.0.4) - actionpack (= 6.0.4) - activesupport (= 6.0.4) - method_source - rake (>= 0.8.7) - thor (>= 0.20.3, < 2.0) - rainbow (3.0.0) - rake (13.0.3) - regexp_parser (2.1.1) - rexml (3.2.5) - rspec (3.10.0) - rspec-core (~> 3.10.0) - rspec-expectations (~> 3.10.0) - rspec-mocks (~> 3.10.0) - rspec-core (3.10.1) - rspec-support (~> 3.10.0) - rspec-expectations (3.10.1) - diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.10.0) - rspec-mocks (3.10.2) - diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.10.0) - rspec-support (3.10.2) - rubocop (1.17.0) - parallel (~> 1.10) - parser (>= 3.0.0.0) - rainbow (>= 2.2.2, < 4.0) - regexp_parser (>= 1.8, < 3.0) - rexml - rubocop-ast (>= 1.7.0, < 2.0) - ruby-progressbar (~> 1.7) - unicode-display_width (>= 1.4.0, < 3.0) - rubocop-ast (1.7.0) - parser (>= 3.0.1.1) - rubocop-performance (1.11.3) - rubocop (>= 1.7.0, < 2.0) - rubocop-ast (>= 0.4.0) - rubocop-rspec (2.4.0) - rubocop (~> 1.0) - rubocop-ast (>= 1.1.0) - ruby-progressbar (1.11.0) - sprockets (4.0.2) - concurrent-ruby (~> 1.0) - rack (> 1, < 3) - sprockets-rails (3.2.2) - actionpack (>= 4.0) - activesupport (>= 4.0) - sprockets (>= 3.0.0) - thor (1.1.0) - thread_safe (0.3.6) - tzinfo (1.2.9) - thread_safe (~> 0.1) - unicode-display_width (2.0.0) - view_component (2.34.0) - activesupport (>= 5.0.0, < 7.0) - websocket-driver (0.7.5) - websocket-extensions (>= 0.1.0) - websocket-extensions (0.1.5) - xpath (3.2.0) - nokogiri (~> 1.8) - zeitwerk (2.4.2) - -PLATFORMS - x86_64-linux - -DEPENDENCIES - appraisal - capybara - combustion - rails (~> 6.0.0) - rake (~> 13.0) - rspec (~> 3.0) - rubocop - rubocop-performance - rubocop-rspec - view_component-form! - -BUNDLED WITH - 2.2.9 diff --git a/gemfiles/rails_6.1.x.gemfile.lock b/gemfiles/rails_6.1.x.gemfile.lock deleted file mode 100644 index 48ffd09..0000000 --- a/gemfiles/rails_6.1.x.gemfile.lock +++ /dev/null @@ -1,216 +0,0 @@ -PATH - remote: .. - specs: - view_component-form (0.1.0) - actionview (>= 6.0.0, < 7.0) - activesupport (>= 6.0.0, < 7.0) - view_component (>= 2.34.0, < 3.0) - -GEM - remote: https://rubygems.org/ - specs: - actioncable (6.1.4) - actionpack (= 6.1.4) - activesupport (= 6.1.4) - nio4r (~> 2.0) - websocket-driver (>= 0.6.1) - actionmailbox (6.1.4) - actionpack (= 6.1.4) - activejob (= 6.1.4) - activerecord (= 6.1.4) - activestorage (= 6.1.4) - activesupport (= 6.1.4) - mail (>= 2.7.1) - actionmailer (6.1.4) - actionpack (= 6.1.4) - actionview (= 6.1.4) - activejob (= 6.1.4) - activesupport (= 6.1.4) - mail (~> 2.5, >= 2.5.4) - rails-dom-testing (~> 2.0) - actionpack (6.1.4) - actionview (= 6.1.4) - activesupport (= 6.1.4) - rack (~> 2.0, >= 2.0.9) - rack-test (>= 0.6.3) - rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.0, >= 1.2.0) - actiontext (6.1.4) - actionpack (= 6.1.4) - activerecord (= 6.1.4) - activestorage (= 6.1.4) - activesupport (= 6.1.4) - nokogiri (>= 1.8.5) - actionview (6.1.4) - activesupport (= 6.1.4) - builder (~> 3.1) - erubi (~> 1.4) - rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.1, >= 1.2.0) - activejob (6.1.4) - activesupport (= 6.1.4) - globalid (>= 0.3.6) - activemodel (6.1.4) - activesupport (= 6.1.4) - activerecord (6.1.4) - activemodel (= 6.1.4) - activesupport (= 6.1.4) - activestorage (6.1.4) - actionpack (= 6.1.4) - activejob (= 6.1.4) - activerecord (= 6.1.4) - activesupport (= 6.1.4) - marcel (~> 1.0.0) - mini_mime (>= 1.1.0) - activesupport (6.1.4) - concurrent-ruby (~> 1.0, >= 1.0.2) - i18n (>= 1.6, < 2) - minitest (>= 5.1) - tzinfo (~> 2.0) - zeitwerk (~> 2.3) - addressable (2.7.0) - public_suffix (>= 2.0.2, < 5.0) - appraisal (2.4.0) - bundler - rake - thor (>= 0.14.0) - ast (2.4.2) - builder (3.2.4) - capybara (3.35.3) - addressable - mini_mime (>= 0.1.3) - nokogiri (~> 1.8) - rack (>= 1.6.0) - rack-test (>= 0.6.3) - regexp_parser (>= 1.5, < 3.0) - xpath (~> 3.2) - combustion (1.3.1) - activesupport (>= 3.0.0) - railties (>= 3.0.0) - thor (>= 0.14.6) - concurrent-ruby (1.1.9) - crass (1.0.6) - diff-lcs (1.4.4) - erubi (1.10.0) - globalid (0.4.2) - activesupport (>= 4.2.0) - i18n (1.8.10) - concurrent-ruby (~> 1.0) - loofah (2.10.0) - crass (~> 1.0.2) - nokogiri (>= 1.5.9) - mail (2.7.1) - mini_mime (>= 0.1.1) - marcel (1.0.1) - method_source (1.0.0) - mini_mime (1.1.0) - minitest (5.14.4) - nio4r (2.5.7) - nokogiri (1.11.7-x86_64-linux) - racc (~> 1.4) - parallel (1.20.1) - parser (3.0.1.1) - ast (~> 2.4.1) - public_suffix (4.0.6) - racc (1.5.2) - rack (2.2.3) - rack-test (1.1.0) - rack (>= 1.0, < 3) - rails (6.1.4) - actioncable (= 6.1.4) - actionmailbox (= 6.1.4) - actionmailer (= 6.1.4) - actionpack (= 6.1.4) - actiontext (= 6.1.4) - actionview (= 6.1.4) - activejob (= 6.1.4) - activemodel (= 6.1.4) - activerecord (= 6.1.4) - activestorage (= 6.1.4) - activesupport (= 6.1.4) - bundler (>= 1.15.0) - railties (= 6.1.4) - sprockets-rails (>= 2.0.0) - rails-dom-testing (2.0.3) - activesupport (>= 4.2.0) - nokogiri (>= 1.6) - rails-html-sanitizer (1.3.0) - loofah (~> 2.3) - railties (6.1.4) - actionpack (= 6.1.4) - activesupport (= 6.1.4) - method_source - rake (>= 0.13) - thor (~> 1.0) - rainbow (3.0.0) - rake (13.0.3) - regexp_parser (2.1.1) - rexml (3.2.5) - rspec (3.10.0) - rspec-core (~> 3.10.0) - rspec-expectations (~> 3.10.0) - rspec-mocks (~> 3.10.0) - rspec-core (3.10.1) - rspec-support (~> 3.10.0) - rspec-expectations (3.10.1) - diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.10.0) - rspec-mocks (3.10.2) - diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.10.0) - rspec-support (3.10.2) - rubocop (1.17.0) - parallel (~> 1.10) - parser (>= 3.0.0.0) - rainbow (>= 2.2.2, < 4.0) - regexp_parser (>= 1.8, < 3.0) - rexml - rubocop-ast (>= 1.7.0, < 2.0) - ruby-progressbar (~> 1.7) - unicode-display_width (>= 1.4.0, < 3.0) - rubocop-ast (1.7.0) - parser (>= 3.0.1.1) - rubocop-performance (1.11.3) - rubocop (>= 1.7.0, < 2.0) - rubocop-ast (>= 0.4.0) - rubocop-rspec (2.4.0) - rubocop (~> 1.0) - rubocop-ast (>= 1.1.0) - ruby-progressbar (1.11.0) - sprockets (4.0.2) - concurrent-ruby (~> 1.0) - rack (> 1, < 3) - sprockets-rails (3.2.2) - actionpack (>= 4.0) - activesupport (>= 4.0) - sprockets (>= 3.0.0) - thor (1.1.0) - tzinfo (2.0.4) - concurrent-ruby (~> 1.0) - unicode-display_width (2.0.0) - view_component (2.34.0) - activesupport (>= 5.0.0, < 7.0) - websocket-driver (0.7.5) - websocket-extensions (>= 0.1.0) - websocket-extensions (0.1.5) - xpath (3.2.0) - nokogiri (~> 1.8) - zeitwerk (2.4.2) - -PLATFORMS - x86_64-linux - -DEPENDENCIES - appraisal - capybara - combustion - rails (~> 6.1.0) - rake (~> 13.0) - rspec (~> 3.0) - rubocop - rubocop-performance - rubocop-rspec - view_component-form! - -BUNDLED WITH - 2.2.9 diff --git a/lib/view_component/form/builder.rb b/lib/view_component/form/builder.rb index c3e1587..05ac5a6 100644 --- a/lib/view_component/form/builder.rb +++ b/lib/view_component/form/builder.rb @@ -156,8 +156,10 @@ def time_zone_select(method, options = {}, html_options = {}) ) end - def rich_text_area(method, options = {}) - render_component(:rich_text_area, self, @object_name, method, objectify_options(options)) + if defined?(ActionView::Helpers::Tags::ActionText) + def rich_text_area(method, options = {}) + render_component(:rich_text_area, self, @object_name, method, objectify_options(options)) + end end private diff --git a/spec/view_component/form/rich_text_area_component_spec.rb b/spec/view_component/form/rich_text_area_component_spec.rb index 7c7d0e4..8299e41 100644 --- a/spec/view_component/form/rich_text_area_component_spec.rb +++ b/spec/view_component/form/rich_text_area_component_spec.rb @@ -6,12 +6,15 @@ let(:options) { {} } let(:component) { render_inline(described_class.new(form, object_name, :bio, options)) } - let(:component_html_attributes) { component.css("textarea").first.attributes } + let(:component_html_attributes) { component.css("trix-editor").first.attributes } context "with simple args" do - it do - expect(component.to_html).to eq( - %() + it do # rubocop:disable RSpec/ExampleLength + expect(component.to_html).to start_with( + "" \ + "= 2.7.0") - spec.add_dependency "actiontext", [">= 6.0.0", "< 7.0"] spec.add_dependency "actionview", [">= 6.0.0", "< 7.0"] spec.add_dependency "activesupport", [">= 6.0.0", "< 7.0"] spec.add_dependency "view_component", [">= 2.34.0", "< 3.0"]