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.7.21 test/dummy/test/components/command_button_test.rb
express_admin-1.7.20 test/dummy/test/components/command_button_test.rb
express_admin-1.7.19 test/dummy/test/components/command_button_test.rb
express_admin-1.7.18 test/dummy/test/components/command_button_test.rb
express_admin-1.7.17 test/dummy/test/components/command_button_test.rb
express_admin-1.7.16 test/dummy/test/components/command_button_test.rb
express_admin-1.7.16.pre1 test/dummy/test/components/command_button_test.rb
express_admin-1.7.15 test/dummy/test/components/command_button_test.rb
express_admin-1.7.14 test/dummy/test/components/command_button_test.rb
express_admin-1.7.13 test/dummy/test/components/command_button_test.rb
express_admin-1.7.12 test/dummy/test/components/command_button_test.rb
express_admin-1.7.5 test/dummy/test/components/command_button_test.rb
express_admin-1.7.4 test/dummy/test/components/command_button_test.rb
express_admin-1.7.3 test/dummy/test/components/command_button_test.rb
express_admin-1.7.2 test/dummy/test/components/command_button_test.rb
express_admin-1.7.1 test/dummy/test/components/command_button_test.rb
express_admin-1.6.13 test/dummy/test/components/command_button_test.rb
express_admin-1.6.12 test/dummy/test/components/command_button_test.rb
express_admin-1.6.11 test/dummy/test/components/command_button_test.rb
express_admin-1.6.10 test/dummy/test/components/command_button_test.rb