Skip to content

Commit

Permalink
Removed strip_heredoc from specs
Browse files Browse the repository at this point in the history
  • Loading branch information
shivam091 committed May 25, 2023
1 parent 2a1087c commit 54c824b
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 22 deletions.
2 changes: 1 addition & 1 deletion spec/install_generator_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
it "matches the content of initializer file" do
assert_file("config/initializers/rails_bootstrap_form.rb") do |content|
assert_includes(content,
<<-STRING.strip_heredoc
<<~STRING
RailsBootstrapForm.configure do |config|
# to make forms non-compliant with W3C.
config.default_form_attributes = {role: "form", novalidate: true}
Expand Down
4 changes: 2 additions & 2 deletions spec/rails_bootstrap_form/bootstrap_form_layout_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

RSpec.describe RailsBootstrapForm::BootstrapFormBuilder do
it "checks markup of vertical form" do
expected = <<~HTML.strip_heredoc
expected = <<~HTML
<form role="form" novalidate="novalidate" action="/test" accept-charset="UTF-8" method="post">
<div class="mb-3">
<label class="form-label required" for="user_name">Name</label>
Expand Down Expand Up @@ -58,7 +58,7 @@
end

it "checks markup of horizontal form" do
expected = <<~HTML.strip_heredoc
expected = <<~HTML
<form role="form" novalidate="novalidate" action="/test" accept-charset="UTF-8" method="post">
<div class="row mb-3">
<label class="col-form-label col-sm-2 required" for="user_name">Name</label>
Expand Down
38 changes: 19 additions & 19 deletions spec/rails_bootstrap_form/inputs/text_field_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
RSpec.describe RailsBootstrapForm::Inputs::TextField do
describe "#text_field" do
it "renders text field correctly in vertical layout" do
expected = <<~HTML.strip_heredoc
expected = <<~HTML
<div class="mb-3">
<label class="form-label required" for="user_name">Name</label>
<input class="form-control" aria-required="true" required="required" type="text" name="user[name]" id="user_name" />
Expand All @@ -22,7 +22,7 @@
end

it "renders text field correctly in horizontal layout" do
expected = <<~HTML.strip_heredoc
expected = <<~HTML
<div class="row mb-3">
<label class="col-form-label col-sm-2 required" for="user_name">Name</label>
<div class="col-sm-10">
Expand All @@ -37,7 +37,7 @@
end

it "supports floating labels in vertical layout" do
expected = <<~HTML.strip_heredoc
expected = <<~HTML
<div class="mb-3">
<div class="form-floating">
<input class="form-control" aria-required="true" required="required" placeholder="Name" type="text" name="user[name]" id="user_name" />
Expand All @@ -52,7 +52,7 @@
end

it "does not support floating labels for horizontal layout" do
expected = <<~HTML.strip_heredoc
expected = <<~HTML
<div class="row mb-3">
<label class="col-form-label col-sm-2 required" for="user_name">Name</label>
<div class="col-sm-10">
Expand All @@ -67,7 +67,7 @@
end

it "skips label of the field" do
expected = <<~HTML.strip_heredoc
expected = <<~HTML
<div class="mb-3">
<input class="form-control" aria-required="true" required="required" type="text" name="user[name]" id="user_name" />
</div>
Expand All @@ -79,7 +79,7 @@
end

it "hides label of the field" do
expected = <<~HTML.strip_heredoc
expected = <<~HTML
<div class="mb-3">
<label class="form-label visually-hidden required" for="user_name">Name</label>
<input class="form-control" aria-required="true" required="required" type="text" name="user[name]" id="user_name" />
Expand All @@ -92,7 +92,7 @@
end

it "adds additional css class to the field" do
expected = <<~HTML.strip_heredoc
expected = <<~HTML
<div class="mb-3">
<label class="form-label required" for="user_name">Name</label>
<input class="form-control custom-class" aria-required="true" required="required" type="text" name="user[name]" id="user_name" />
Expand All @@ -105,7 +105,7 @@
end

it "adds additional css class to a label of the field" do
expected = <<~HTML.strip_heredoc
expected = <<~HTML
<div class="mb-3">
<label class="form-label custom-class required" for="user_name">Name</label>
<input class="form-control" aria-required="true" required="required" type="text" name="user[name]" id="user_name" />
Expand All @@ -118,7 +118,7 @@
end

it "changes css class of the field" do
expected = <<~HTML.strip_heredoc
expected = <<~HTML
<div class="mb-3">
<label class="form-label required" for="user_name">Name</label>
<input class="custom-form-control" aria-required="true" required="required" type="text" name="user[name]" id="user_name" />
Expand All @@ -131,7 +131,7 @@
end

it "changes css class of the label" do
expected = <<~HTML.strip_heredoc
expected = <<~HTML
<div class="mb-3">
<label class="custom-form-label required" for="user_name">Name</label>
<input class="form-control" aria-required="true" required="required" type="text" name="user[name]" id="user_name" />
Expand All @@ -144,7 +144,7 @@
end

it "adds help text to the field" do
expected = <<~HTML.strip_heredoc
expected = <<~HTML
<div class="mb-3">
<label class="form-label required" for="user_name">Name</label>
<input class="form-control" aria-required="true" required="required" type="text" name="user[name]" id="user_name" />
Expand All @@ -158,7 +158,7 @@
end

it "displays help text from locale file" do
expected = <<~HTML.strip_heredoc
expected = <<~HTML
<div class="mb-3">
<label class="form-label required" for="user_email">Email address</label>
<input class="form-control" aria-required="true" required="required" type="text" name="user[email]" id="user_email" />
Expand All @@ -172,7 +172,7 @@
end

it "sets customize label text" do
expected = <<~HTML.strip_heredoc
expected = <<~HTML
<div class="mb-3">
<label class="form-label required" for="user_name">Full name</label>
<input class="form-control" aria-required="true" required="required" type="text" name="user[name]" id="user_name" />
Expand All @@ -185,7 +185,7 @@
end

it "adds additional wrapper options" do
expected = <<~HTML.strip_heredoc
expected = <<~HTML
<div class="mb-3" data-controller="hello">
<label class="form-label required" for="user_name">Name</label>
<input class="form-control" aria-required="true" required="required" type="text" name="user[name]" id="user_name" />
Expand All @@ -198,7 +198,7 @@
end

it "supports input group" do
expected = <<~HTML.strip_heredoc
expected = <<~HTML
<div class="mb-3">
<label class="form-label required" for="user_name">Name</label>
<div class="input-group">
Expand All @@ -215,7 +215,7 @@
end

it "supports button in input group" do
expected = <<~HTML.strip_heredoc
expected = <<~HTML
<div class="mb-3">
<label class="form-label required" for="user_name">Name</label>
<div class="input-group">
Expand All @@ -231,7 +231,7 @@
end

it "supports multiple addons in input group" do
expected = <<~HTML.strip_heredoc
expected = <<~HTML
<div class="mb-3">
<label class="form-label required" for="user_name">Name</label>
<div class="input-group">
Expand All @@ -249,7 +249,7 @@
end

it "supports input group with floating labels" do
expected = <<~HTML.strip_heredoc
expected = <<~HTML
<div class="mb-3">
<div class="input-group">
<span class="input-group-text">$</span>
Expand All @@ -268,7 +268,7 @@
end

it "changes size of the field" do
expected = <<~HTML.strip_heredoc
expected = <<~HTML
<div class="mb-3">
<label class="form-label required" for="user_name">Name</label>
<input class="form-control form-control-sm" aria-required="true" required="required" type="text" name="user[name]" id="user_name">
Expand Down

0 comments on commit 54c824b

Please sign in to comment.