Sha256: f9848320f828385f3b33f5597db3512736a2c86d401f2650b6155dae47328e55

Contents?: true

Size: 1.42 KB

Versions: 23

Compression:

Stored size: 1.42 KB

Contents

require 'spec_helper'

describe 'Featured Pages Blocks', type: :feature, js: true do
  let(:exhibit) { FactoryGirl.create(:exhibit) }
  let!(:feature_page1) do
    FactoryGirl.create(
      :feature_page,
      title: 'FeaturePage1 Title',
      weight: 1,
      exhibit: exhibit
    )
  end
  let!(:feature_page2) do
    FactoryGirl.create(
      :feature_page,
      title: 'FeaturePage2 Title',
      weight: 0,
      exhibit: exhibit
    )
  end

  let(:exhibit_curator) { FactoryGirl.create(:exhibit_curator, exhibit: exhibit) }

  before do
    login_as exhibit_curator
  end

  it 'saves the selected exhibits' do
    visit spotlight.exhibit_home_page_path(exhibit, exhibit.home_page)

    click_link('Edit')

    add_widget 'featured_pages'

    fill_in_typeahead_field with: feature_page2.title

    save_page

    expect(page).to have_content feature_page2.title
  end

  it 'persists the user selected sort order' do
    visit spotlight.exhibit_home_page_path(exhibit, exhibit.home_page)

    click_link('Edit')

    add_widget 'featured_pages'

    fill_in_typeahead_field with: feature_page1.title
    fill_in_typeahead_field with: feature_page2.title

    save_page

    feature_page1_position = page.body =~ /<p class="category-title">\s+#{feature_page1.title}/
    feature_page2_position = page.body =~ /<p class="category-title">\s+#{feature_page2.title}/

    expect(feature_page1_position).to be < feature_page2_position
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
blacklight-spotlight-0.19.0 spec/features/javascript/blocks/featured_pages_block_spec.rb
blacklight-spotlight-0.18.0 spec/features/javascript/blocks/featured_pages_block_spec.rb
blacklight-spotlight-0.17.1 spec/features/javascript/blocks/featured_pages_block_spec.rb
blacklight-spotlight-0.17.0 spec/features/javascript/blocks/featured_pages_block_spec.rb
blacklight-spotlight-0.16.0 spec/features/javascript/blocks/featured_pages_block_spec.rb
blacklight-spotlight-0.15.0 spec/features/javascript/blocks/featured_pages_block_spec.rb
blacklight-spotlight-0.14.2 spec/features/javascript/blocks/featured_pages_block_spec.rb
blacklight-spotlight-0.14.1 spec/features/javascript/blocks/featured_pages_block_spec.rb
blacklight-spotlight-0.14.0 spec/features/javascript/blocks/featured_pages_block_spec.rb
blacklight-spotlight-0.13.0 spec/features/javascript/blocks/featured_pages_block_spec.rb
blacklight-spotlight-0.12.1 spec/features/javascript/blocks/featured_pages_block_spec.rb
blacklight-spotlight-0.12.0 spec/features/javascript/blocks/featured_pages_block_spec.rb
blacklight-spotlight-0.11.0 spec/features/javascript/blocks/featured_pages_block_spec.rb
blacklight-spotlight-0.10.3 spec/features/javascript/blocks/featured_pages_block_spec.rb
blacklight-spotlight-0.10.2 spec/features/javascript/blocks/featured_pages_block_spec.rb
blacklight-spotlight-0.10.1 spec/features/javascript/blocks/featured_pages_block_spec.rb
blacklight-spotlight-0.10.0 spec/features/javascript/blocks/featured_pages_block_spec.rb
blacklight-spotlight-0.9.2 spec/features/javascript/blocks/featured_pages_block_spec.rb
blacklight-spotlight-0.9.1 spec/features/javascript/blocks/featured_pages_block_spec.rb
blacklight-spotlight-0.9.0 spec/features/javascript/blocks/featured_pages_block_spec.rb