require_relative "../test_helper" class RadiosAndCheckboxessTest < ActionView::TestCase setup do @user = User.new @builder = BootstrapForm::FormBuilder.new(:user, @user, self, {}) end def test_checkbox actual = @builder.check_box(:test) expected = <<-HTML
HTML assert_xml_equal expected, actual end def test_checkbox_with_label actual = @builder.check_box(:test, bootstrap: {label: {text: "Custom"}}) expected = <<-HTML HTML assert_xml_equal expected, actual end def test_checkbox_with_help actual = @builder.check_box(:test, bootstrap: {help: "help me"}) expected = <<-HTML HTML assert_xml_equal expected, actual end def test_collection_check_boxes actual = @builder.collection_check_boxes(:test, ["a", "b"], :to_s, :titleize) expected = <<-HTML HTML assert_xml_equal expected, actual end def test_collection_checkboxes_without_hidden_field actual = @builder.collection_check_boxes(:test, ["a", "b"], :to_s, :titleize, include_hidden: false) expected = <<-HTML HTML assert_xml_equal expected, actual end def test_radio_buttons actual = @builder.collection_radio_buttons(:test, ["a", "b"], :to_s, :titleize) expected = <<-HTML HTML assert_xml_equal expected, actual end def test_radio_buttons_inline actual = @builder.collection_radio_buttons(:test, ["a", "b"], :to_s, :titleize, bootstrap: { inline: true }) expected = <<-HTML HTML assert_xml_equal expected, actual end def test_radio_buttons_custom_label actual = @builder.collection_radio_buttons(:test, ["a", "b"], :to_s, :titleize, bootstrap: { label: {text: "Custom"} }) expected = <<-HTML HTML assert_xml_equal expected, actual end def test_radio_buttons_no_label actual = @builder.collection_radio_buttons(:test, ["a", "b"], :to_s, :titleize, bootstrap: { label: {hide: true} }) expected = <<-HTML HTML assert_xml_equal expected, actual end def test_radio_buttons_with_help actual = @builder.collection_radio_buttons(:test, ["a", "b"], :to_s, :titleize, bootstrap: { help: "help me" }) expected = <<-HTML HTML assert_xml_equal expected, actual end def test_radio_buttons_with_inline_help actual = @builder.collection_radio_buttons(:test, ["a", "b"], :to_s, :titleize, bootstrap: { inline: true, help: "help me" }) expected = <<-HTML HTML assert_xml_equal expected, actual end end