Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Spone committed Jun 30, 2021
1 parent 901004c commit 178147f
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions spec/view_component/form/text_area_component_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# frozen_string_literal: true

RSpec.describe ViewComponent::Form::TextAreaComponent, type: :component do
let(:object) { OpenStruct.new }
let(:form) { form_with(object) }
let(:options) { {} }

let(:component) { render_inline(described_class.new(form, object_name, :bio, options)) }
let(:component_html_attributes) { component.css("textarea").first.attributes }

context "with simple args" do
it do
expect(component.to_html).to eq(
%(<textarea name="user[bio]" id="user_bio">\n</textarea>)
)
end
end

include_examples "component with custom html classes"
include_examples "component with custom data attributes"
end

0 comments on commit 178147f

Please sign in to comment.