Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
Spone committed Oct 11, 2023
2 parents 2a875f5 + 53d7cb8 commit 8681de7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/components/view_component/form/field_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,13 @@ def label_text
end

def optional?(context: validation_context)
return nil if object.nil?
return false if object.nil?

!required?(context: context)
end

def required?(context: validation_context)
return nil if object.nil?
return false if object.nil?

validators(context: context).any?(ActiveModel::Validations::PresenceValidator)
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
end
let(:component_html_attributes) { component.css("select").last.attributes }

# rubocop:disable RSpec/ExampleLength
context "with simple args" do
it do
expect(component).to eq_html <<~HTML
Expand All @@ -50,6 +51,7 @@
HTML
end
end
# rubocop:enable RSpec/ExampleLength

include_examples "component with custom html classes", :html_options
include_examples "component with custom data attributes", :html_options
Expand Down

0 comments on commit 8681de7

Please sign in to comment.