Files

23 lines
767 B
Ruby

# frozen_string_literal: true
require "rails_helper"
RSpec.describe FormElements::FieldsetComponent, type: :component do
it "renders a div with flex gap-x-1 for vertical positioning" do
rendered = render_inline(described_class.new(title: "Username")) do
"<input type='text' name='username' />".html_safe
end
expect(rendered.css("label.block > div.flex.gap-x-1")).to be_present
expect(rendered.css("label.block > p.flex")).not_to be_present
end
it "renders a div for horizontal positioning" do
rendered = render_inline(described_class.new(positioning: :horizontal, title: "Enable notifications")) do
"<input type='checkbox' />".html_safe
end
expect(rendered.css("label.block > div.relative")).to be_present
end
end