Sha256: 45ceaede16ebed7534d8a8c4f0db2651e4ed6bed524b125e4b8a3756ed094c61

Contents?: true

Size: 776 Bytes

Versions: 1

Compression:

Stored size: 776 Bytes

Contents

# 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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
simple_form-2.0.0.rc test/form_builder/button_test.rb