Sha256: a2006bd0c1b8e03fe196814a2b57c14b24a3046d46fcad449c90dfe4f03d9b42

Contents?: true

Size: 1.06 KB

Versions: 28

Compression:

Stored size: 1.06 KB

Contents

require 'test_helper'

module Components

  class CommandButtonTest < ActiveSupport::TestCase

    def assigns
      {}
    end

    def helpers
      mock_action_view do
        def twiddle_widget_path(id)
          "/widgets/#{id}/twiddle"
        end
      end
    end

    def command_button(*args)
      arbre(widget: widgets(:one)) {
        command_button(*args)
      }
    end

    test "command button creates a form with a submit button having the correct name" do
      assert_match /form.*action="\/widgets\/\d+\/twiddle"/, command_button(:twiddle, resource_name: :widget)
      assert_match /input type="submit" value="Twiddle"/, command_button(:twiddle, resource_name: :widget)
    end

    def command_button_list(*args)
      arbre(widget: widgets(:one)) {
        command_button_list(*args)
      }
    end

    test "command_button_list creates a list of command buttons" do
      assert_match /ul class="command-button-list"/, command_button_list(:widget)
      assert_match /li.*<form.*\<\/li>/, command_button_list(:widget).split("\n").join
    end

  end

end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
express_admin-1.6.9 test/dummy/test/components/command_button_test.rb
express_admin-1.6.8 test/dummy/test/components/command_button_test.rb
express_admin-1.6.7 test/dummy/test/components/command_button_test.rb
express_admin-1.6.4 test/dummy/test/components/command_button_test.rb
express_admin-1.6.3 test/dummy/test/components/command_button_test.rb
express_admin-1.6.2 test/dummy/test/components/command_button_test.rb
express_admin-1.6.1 test/dummy/test/components/command_button_test.rb
express_admin-1.6.0 test/dummy/test/components/command_button_test.rb