mirror of
https://github.com/heartcombo/simple_form.git
synced 2022-11-09 12:19:26 -05:00
1e1a2bb73f
This changes the default behavior of having a fixed "button" class on the buttons.
28 lines
776 B
Ruby
28 lines
776 B
Ruby
# encoding: UTF-8
|
|
require 'test_helper'
|
|
|
|
class ButtonTest < ActionView::TestCase
|
|
def with_button_for(object, *args)
|
|
with_concat_form_for(object) do |f|
|
|
f.button(*args)
|
|
end
|
|
end
|
|
|
|
test 'builder should create buttons' do
|
|
with_button_for :post, :submit
|
|
assert_select 'form input.button[type=submit][value=Save Post]'
|
|
end
|
|
|
|
test 'builder should create buttons for records' do
|
|
@user.new_record!
|
|
with_button_for @user, :submit
|
|
assert_select 'form input.button[type=submit][value=Create User]'
|
|
end
|
|
|
|
test "builder should use the default class from the configuration" do
|
|
swap SimpleForm, :button_class => 'btn' do
|
|
with_button_for :post, :submit
|
|
assert_select 'form input.btn[type=submit][value=Save Post]'
|
|
end
|
|
end
|
|
end
|