From c9557184f1daa5b257a4881ce6b36886fb233235 Mon Sep 17 00:00:00 2001 From: Eben English Date: Thu, 10 Sep 2015 12:49:59 -0400 Subject: [PATCH] feature specs and coveralls setup --- README.md | 2 + .../modify_constraints.js | 2 +- .../commonwealth-vlr-engine/index.scss | 13 +------ config/locales/commonwealth-vlr-engine.en.yml | 4 ++ spec/features/collections/_az_links_spec.rb | 27 +++++++++++++ spec/features/image_viewer_spec.rb | 28 ++++++++++++++ spec/features/institutions/map_view_spec.rb | 38 +++++++++++++++++++ spec/fixtures/sample_solr_documents.yml | 18 +++++++++ spec/spec_helper.rb | 3 +- 9 files changed, 121 insertions(+), 14 deletions(-) create mode 100644 spec/features/collections/_az_links_spec.rb create mode 100644 spec/features/image_viewer_spec.rb create mode 100644 spec/features/institutions/map_view_spec.rb diff --git a/README.md b/README.md index 47a9aa1a..1afe14bf 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # CommonwealthVlrEngine +[![Coverage Status](https://coveralls.io/repos/boston-library/Commonwealth-public-interface/badge.svg?branch=master&service=github)](https://coveralls.io/github/boston-library/Commonwealth-public-interface?branch=master) + A plugin for Blacklight that provides base functionality for virtual local repositories (VLRs) pulling content from the main [Digital Commonwealth](http://digitalcommonwealth.org) repository managed by the Boston Public Library. More documentation coming soon. This project is currently in high development and in a very beta state. diff --git a/app/assets/javascripts/commonwealth-vlr-engine/modify_constraints.js b/app/assets/javascripts/commonwealth-vlr-engine/modify_constraints.js index ac000a25..228e7061 100644 --- a/app/assets/javascripts/commonwealth-vlr-engine/modify_constraints.js +++ b/app/assets/javascripts/commonwealth-vlr-engine/modify_constraints.js @@ -5,7 +5,7 @@ $(document).ready(function() { $('#appliedParams').find('a').attr('href', function(index,previousValue) { - return previousValue.replace(/search/,'institutions'); + return previousValue.replace(/search\?/,'institutions?'); }); }); \ No newline at end of file diff --git a/app/assets/stylesheets/commonwealth-vlr-engine/index.scss b/app/assets/stylesheets/commonwealth-vlr-engine/index.scss index 3b5edb0f..d7d33f2d 100644 --- a/app/assets/stylesheets/commonwealth-vlr-engine/index.scss +++ b/app/assets/stylesheets/commonwealth-vlr-engine/index.scss @@ -39,17 +39,8 @@ body.blacklight-catalog-index { background-color: #E2EDFE; } - /* need to use background image here rather than CSS 'content' - /* which doesn't work in iOS */ - .filterName { - background: asset-url('blacklight/separator.gif') no-repeat right center; - padding-right:14px; - - &:after { - content: none; - padding-left: 2px; - } - + .filterName:after { + padding-left: 2px; } } diff --git a/config/locales/commonwealth-vlr-engine.en.yml b/config/locales/commonwealth-vlr-engine.en.yml index 0e951e92..340d0ae3 100644 --- a/config/locales/commonwealth-vlr-engine.en.yml +++ b/config/locales/commonwealth-vlr-engine.en.yml @@ -230,6 +230,10 @@ en: nav: 'Institutions' title: 'Institutions' + maps: + interactions: + institutions_search: 'View institutions from this location' + metadata_display: date_range_connector: '–' fields: diff --git a/spec/features/collections/_az_links_spec.rb b/spec/features/collections/_az_links_spec.rb new file mode 100644 index 00000000..39056cdc --- /dev/null +++ b/spec/features/collections/_az_links_spec.rb @@ -0,0 +1,27 @@ +require 'spec_helper' + +include CommonwealthVlrEngine::CollectionsHelperBehavior + +# set this helper to return true so AZ links are rendered +def should_render_col_az? + true +end + +describe 'collections a-z links' do + + it 'should show the a-z links' do + visit collections_path + within ('#collection_az_links') do + expect(page).to have_selector('.col_a-z_link') + end + end + + it 'should show correct results after clicking a letter link' do + visit collections_path + within ('#collection_az_links') do + click_link('C') + end + expect(page).to have_selector('.document-title-heading', :text => 'Carte de Visite Collection') + end + +end \ No newline at end of file diff --git a/spec/features/image_viewer_spec.rb b/spec/features/image_viewer_spec.rb new file mode 100644 index 00000000..e9800876 --- /dev/null +++ b/spec/features/image_viewer_spec.rb @@ -0,0 +1,28 @@ +require 'spec_helper' + +describe 'openseadragon image viewer modal' do + + it 'should display the OSd viewer modal when the image is clicked', :js => true do + visit solr_document_path(:id => 'bpl-dev:h702q6403') + click_link('img_viewer_link') + expect(page).to have_selector('.openseadragon-container') + end + +end + +describe 'multi image viewer' do + + before(:each) do + visit solr_document_path(:id => 'bpl-dev:h702q6403') + click_link('carousel-nav_next') + end + + it 'should display the next image when a prev-next link is clicked' do + expect(find('.img_show')['src']).to match /bpl-dev:h702q642n/ + end + + it 'should update the thumbnail in the #thumbnail_list' do + expect(all('#thumbnail_list li').last).to have_selector('.in_viewer') + end + +end \ No newline at end of file diff --git a/spec/features/institutions/map_view_spec.rb b/spec/features/institutions/map_view_spec.rb new file mode 100644 index 00000000..76f65272 --- /dev/null +++ b/spec/features/institutions/map_view_spec.rb @@ -0,0 +1,38 @@ +require 'spec_helper' + +describe 'Institutions#index map view', js: true do + + before { visit institutions_path(:view => 'maps') } + + it 'should show map marker' do + within ('#institutions-index-map') do + expect(page).to have_selector('.leaflet-marker-icon') + end + end + + describe 'click marker cluster' do + + before { find('div.leaflet-marker-icon').click } + + it 'should show the search_form_institution content' do + within ('div.leaflet-popup-content') do + expect(page.text).to include('institution') + end + end + + describe 'constraints links' do + + before { find('div.leaflet-popup-content a').click } + + it 'should have .constraints > a.remove that links to instititions#index' do + within ('#appliedParams') do + expect(page.html).to include('/institutions?') + end + + end + + end + + end + +end \ No newline at end of file diff --git a/spec/fixtures/sample_solr_documents.yml b/spec/fixtures/sample_solr_documents.yml index 10f0833f..9c15a8d3 100644 --- a/spec/fixtures/sample_solr_documents.yml +++ b/spec/fixtures/sample_solr_documents.yml @@ -152,6 +152,8 @@ - "Ancillary maps and insets: Principal motor routes in and out of Boston -- Do Not Turn -- Eaxtracts from \"City of Boston Street Traffic Regulations.\"" title_info_primary_tsi: - Boston traffic map showing one way streets and parking spaces + title_info_primary_ssort: + - Boston traffic map showing one way streets and parking spaces workflow_state_ssi: - published processing_state_ssi: @@ -358,6 +360,8 @@ - Date supplied by cataloger. title_info_primary_tsi: - Beauregard + title_info_primary_ssort: + - Beauregard workflow_state_ssi: - published processing_state_ssi: @@ -560,6 +564,8 @@ - Gift of the family of William L. Garrison, August 31, 1899. title_info_primary_tsi: - George Thompson + title_info_primary_ssort: + - George Thompson workflow_state_ssi: - published processing_state_ssi: @@ -764,6 +770,8 @@ - New standard index map of Boston title_info_primary_tsi: - Guide map of Boston + title_info_primary_ssort: + - Guide map of Boston title_info_alternative_label_ssm: - Cover title workflow_state_ssi: @@ -845,6 +853,8 @@ - Collection title_info_primary_tsi: - Norman B. Leventhal Map Center Collection + title_info_primary_ssort: + - Norman B. Leventhal Map Center Collection workflow_state_ssi: - published abstract_tsim: @@ -896,6 +906,8 @@ - Collection title_info_primary_tsi: - Carte de Visite Collection + title_info_primary_ssort: + - Carte de Visite Collection workflow_state_ssi: - published abstract_tsim: @@ -947,6 +959,8 @@ - Collection title_info_primary_tsi: - Anti-Slavery Collection + title_info_primary_ssort: + - Anti-Slavery Collection workflow_state_ssi: - published physical_location_ssim: @@ -996,6 +1010,8 @@ - Collection title_info_primary_tsi: - Cased Photographs + title_info_primary_ssort: + - Cased Photographs workflow_state_ssi: - published physical_location_ssim: @@ -1038,6 +1054,8 @@ - Institution title_info_primary_tsi: - Boston Public Library + title_info_primary_ssort: + - Boston Public Library workflow_state_ssi: - published abstract_tsim: diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 1c326779..6be68439 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -10,9 +10,8 @@ Capybara.register_driver :poltergeist do |app| options = {} - + options[:js_errors] = false options[:timeout] = 120 if RUBY_PLATFORM == "java" - Capybara::Poltergeist::Driver.new(app, options) end