Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions test/bootstrap_checkbox_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ def setup
assert_equivalent_xml expected, @builder.check_box(:terms, label: 'I agree to the terms')
end

test "check_box is wrapped correctly with custom id" do
expected = %{<div class="checkbox"><label for="custom_id"><input name="user[terms]" type="hidden" value="0" /><input id="custom_id" name="user[terms]" type="checkbox" value="1" /> I agree to the terms</label></div>}
assert_equivalent_xml expected, @builder.check_box(:terms, label: 'I agree to the terms', id: :custom_id)
end

test "disabled check_box has proper wrapper classes" do
expected = %{<div class="checkbox disabled"><label for="user_terms"><input disabled="disabled" name="user[terms]" type="hidden" value="0" /><input disabled="disabled" id="user_terms" name="user[terms]" type="checkbox" value="1" /> I agree to the terms</label></div>}
assert_equivalent_xml expected, @builder.check_box(:terms, label: 'I agree to the terms', disabled: true)
Expand Down
5 changes: 5 additions & 0 deletions test/bootstrap_radio_button_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ def setup
assert_equivalent_xml expected, @builder.radio_button(:misc, '1', label: 'This is a radio button')
end

test "radio_button is wrapped correctly with custom id" do
expected = %{<div class="radio"><label for="custom_id"><input id="custom_id" name="user[misc]" type="radio" value="1" /> This is a radio button</label></div>}
assert_equivalent_xml expected, @builder.radio_button(:misc, '1', label: 'This is a radio button', id: "custom_id")
end

test "radio_button disabled label is set correctly" do
expected = %{<div class="radio disabled"><label for="user_misc_1"><input disabled="disabled" id="user_misc_1" name="user[misc]" type="radio" value="1" /> This is a radio button</label></div>}
assert_equivalent_xml expected, @builder.radio_button(:misc, '1', label: 'This is a radio button', disabled: true)
Expand Down
8 changes: 4 additions & 4 deletions test/dummy/db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
t.string "city"
t.string "state"
t.string "zip_code"
t.datetime "created_at"
t.datetime "updated_at"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end

create_table "users", force: :cascade do |t|
Expand All @@ -28,8 +28,8 @@
t.text "comments"
t.string "status"
t.string "misc"
t.datetime "created_at"
t.datetime "updated_at"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.text "preferences"
t.boolean "terms", default: false
t.string "type"
Expand Down