require 'test_helper' class Bootstrap4FormBuilderTest < ActionView::TestCase def setup @builder = Bootstrap4FormBuilder::FormBuilder::BootstrapBuilder.new(:user, nil, self, {}) @inline_builder = Bootstrap4FormBuilder::FormBuilder::BootstrapBuilder.new(:user, nil, self, {layout: :inline}) @gridded_builder = Bootstrap4FormBuilder::FormBuilder::BootstrapBuilder.new(:user, nil, self, {label_col: 'col-sm-2', control_col: 'col-sm-8'}) end test "color_field is wrapped correctly" do expected = %{
} assert_equal expected, @builder.color_field(:color) end test "date_field is wrapped correctly" do expected = %{
} assert_equal expected, @builder.color_field(:birthdate) end test "datetime_local_field is wrapped correctly" do expected = %{
} assert_equal expected, @builder.datetime_local_field(:birthdate) end test "email_field is wrapped correctly" do expected = %{
} assert_equal expected, @builder.email_field(:email) end test "month_field is wrapped correctly" do expected = %{
} assert_equal expected, @builder.month_field(:month) end test "number_field is wrapped correctly" do expected = %{
} assert_equal expected, @builder.number_field(:number) end test "password_field is wrapped correctly" do expected = %{
} assert_equal expected, @builder.password_field(:password) end test "phone_field is wrapped correctly" do expected = %{
} assert_equal expected, @builder.phone_field(:phone) end test "range_field is wrapped correctly" do expected = %{
} assert_equal expected, @builder.range_field(:range) end test "search_field is wrapped correctly" do expected = %{
} assert_equal expected, @builder.search_field(:search) end test "telephone_field is wrapped correctly" do expected = %{
} assert_equal expected, @builder.telephone_field(:phone) end test "text_field is wrapped correctly" do expected = %{
} assert_equal expected, @builder.text_field(:name) end test "text_area is wrapped correctly" do expected = %{
} assert_equal expected, @builder.text_area(:comments) end test "time_field is wrapped correctly" do expected = %{
} assert_equal expected, @builder.time_field(:time) end test "url_field is wrapped correctly" do expected = %{
} assert_equal expected, @builder.url_field(:url) end test "week_field is wrapped correctly" do expected = %{
} assert_equal expected, @builder.week_field(:week) end test "inline text_field is wrapped correctly" do expected = %{
} assert_equal expected, @inline_builder.text_field(:name, placeholder: "Name") end test "gridded form field is wrapped correctly" do expected = %{
} assert_equal expected, @gridded_builder.text_field(:name) end test "submit is classed correctly" do expected = %{} assert_equal expected, @builder.submit("Register") end test "primary is classed correctly" do expected = %{} assert_equal expected, @builder.primary("Register") end test "custom label text is included" do expected = %{
} assert_equal expected, @builder.text_field(:name, label: "Full Name") end test "custom label class is included" do expected = %{
} assert_equal expected, @builder.text_field(:name, label_class: "custom-label") end test "label is hidden when requested" do expected = %{
} assert_equal expected, @builder.text_field(:name, hide_label: true) end test "custom container class is include" do expected = %{
} assert_equal expected, @builder.text_field(:name, container_class: "custom-class") end end