Sha256: 8796f37d85c7520acea2cbf3cecb1420c5071dc164de8e698d5708cda69e62da

Contents?: true

Size: 1.28 KB

Versions: 20

Compression:

Stored size: 1.28 KB

Contents

require 'rails_helper'

describe ActiveAdmin::Views::IndexAsTable::IndexTableFor do
  describe 'creating with the dsl' do
    let(:collection) do
      [Post.new(title: 'First Post', starred: true)]
    end
    let(:active_admin_config) do
      namespace = ActiveAdmin::Namespace.new(ActiveAdmin::Application.new, :admin)
      namespace.batch_actions = [ActiveAdmin::BatchAction.new(:flag, 'Flag') {}]
      namespace
    end

    let(:assigns) do
      {
        collection: collection,
        active_admin_config: active_admin_config
      }
    end
    let(:helpers) { mock_action_view }

    context 'when creating a selectable column' do
      let(:table) do
        render_arbre_component assigns, helpers do
          insert_tag(ActiveAdmin::Views::IndexAsTable::IndexTableFor, collection, {sortable: true}) do
            selectable_column
          end
        end
      end

      context 'creates a table header based on the selectable column' do
        let(:header) do
          table.find_by_tag('th').first
        end

        it 'with selectable column class name' do
          expect(header.attributes[:class]).to include 'col-selectable'
        end

        it 'not sortable' do
          expect(header.attributes[:class]).not_to include 'sortable'
        end
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 3 rubygems

Version Path
activeadmin_addons-1.1.2 vendor/bundle/ruby/2.3.0/bundler/gems/activeadmin-a5a53c3f2b8f/spec/unit/views/components/index_table_for_spec.rb
activeadmin_addons-1.1.1 vendor/bundle/ruby/2.2.0/bundler/gems/activeadmin-a5a53c3f2b8f/spec/unit/views/components/index_table_for_spec.rb
yousty-activeadmin-1.0.17.pre spec/unit/views/components/index_table_for_spec.rb
yousty-activeadmin-1.0.16.pre spec/unit/views/components/index_table_for_spec.rb
activeadmin_addons-1.1.0 vendor/bundle/ruby/2.2.0/bundler/gems/activeadmin-a5a53c3f2b8f/spec/unit/views/components/index_table_for_spec.rb
activeadmin_addons-1.0.1 vendor/bundle/ruby/2.2.0/bundler/gems/activeadmin-a5a53c3f2b8f/spec/unit/views/components/index_table_for_spec.rb
activeadmin_addons-1.0.0 vendor/bundle/ruby/2.2.0/bundler/gems/activeadmin-a5a53c3f2b8f/spec/unit/views/components/index_table_for_spec.rb
yousty-activeadmin-1.0.15.pre spec/unit/views/components/index_table_for_spec.rb
yousty-activeadmin-1.0.14.pre spec/unit/views/components/index_table_for_spec.rb
yousty-activeadmin-1.0.13.pre spec/unit/views/components/index_table_for_spec.rb
yousty-activeadmin-1.0.12.pre spec/unit/views/components/index_table_for_spec.rb
yousty-activeadmin-1.0.11.pre spec/unit/views/components/index_table_for_spec.rb
yousty-activeadmin-1.0.10.pre spec/unit/views/components/index_table_for_spec.rb
yousty-activeadmin-1.0.9.pre spec/unit/views/components/index_table_for_spec.rb
yousty-activeadmin-1.0.8.pre spec/unit/views/components/index_table_for_spec.rb
activeadmin-1.0.0.pre2 spec/unit/views/components/index_table_for_spec.rb
activeadmin-1.0.0.pre1 spec/unit/views/components/index_table_for_spec.rb
yousty-activeadmin-1.0.7.pre spec/unit/views/components/index_table_for_spec.rb
yousty-activeadmin-1.0.6.pre spec/unit/views/components/index_table_for_spec.rb
yousty-activeadmin-1.0.5.pre spec/unit/views/components/index_table_for_spec.rb