Sha256: d734ebbc9dd856729c7df6827914de7a6fead3bfcc79937b519261505f191f2b

Contents?: true

Size: 1.52 KB

Versions: 5

Compression:

Stored size: 1.52 KB

Contents

# encoding: utf-8
require 'acceptance_helper'

describe 'On the page /custom_ordering_with_proc with custom_ordering in controler with Procs WiceGrid', type: :request, js: true do
  context 'when "statuses.name" => ->(column_name) { params[:sort_by_length] ? "length(#{column_name})" : column_name }' do
    context 'with no special param' do
      before :each do
        visit '/custom_ordering_with_proc'
      end

      it 'sorts alphabetically' do
        within 'div#grid.wice-grid-container table.wice-grid tbody tr:first-child td.sorted' do
          expect(page).to have_content('Assigned')
        end

        within 'div#grid.wice-grid-container table.wice-grid thead' do
          click_on 'Status Name'
        end

        within 'div#grid.wice-grid-container table.wice-grid tbody tr:first-child td.sorted' do
          expect(page).to have_content('Verified')
        end
      end
    end

    context 'with the :sort_by_length param' do
      before :each do
        visit '/custom_ordering_with_proc?sort_by_length=1'
      end

      it 'sorts by length of the #name' do
        within 'div#grid.wice-grid-container table.wice-grid tbody tr:first-child td.sorted' do
          expect(page).to have_content('New')
        end

        within 'div#grid.wice-grid-container table.wice-grid thead' do
          click_on 'Status Name'
        end

        within 'div#grid.wice-grid-container table.wice-grid tbody tr:first-child td.sorted' do
          expect(page).to have_content('Duplicate')
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
wice_grid-7.1.4 spec/features/custom_ordering_with_proc_request_spec.rb
wice_grid-7.1.3 spec/features/custom_ordering_with_proc_request_spec.rb
wice_grid-7.1.2 spec/features/custom_ordering_with_proc_request_spec.rb
wice_grid-7.1.1 spec/features/custom_ordering_with_proc_request_spec.rb
wice_grid-7.1.0 spec/features/custom_ordering_with_proc_request_spec.rb