geoblacklight 0.12.1 → 1.0.0.pre1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.hound.yml +8 -0
- data/.jshintignore +2 -0
- data/.jshintrc +67 -0
- data/.rubocop.yml +29 -3
- data/Gemfile +20 -16
- data/README.md +1 -0
- data/Rakefile +3 -2
- data/app/assets/javascripts/geoblacklight/basemaps.js +0 -9
- data/app/assets/javascripts/geoblacklight/controls.js +1 -0
- data/app/assets/javascripts/geoblacklight/controls/opacity.js +8 -0
- data/app/assets/javascripts/geoblacklight/geoblacklight.js +3 -2
- data/app/assets/javascripts/geoblacklight/viewers.js +1 -1
- data/app/assets/javascripts/geoblacklight/viewers/esri.js +2 -3
- data/app/assets/javascripts/geoblacklight/viewers/esri/dynamic_map_layer.js +2 -2
- data/app/assets/javascripts/geoblacklight/viewers/esri/feature_layer.js +1 -5
- data/app/assets/javascripts/geoblacklight/viewers/iiif.js +1 -1
- data/app/assets/javascripts/geoblacklight/viewers/map.js +1 -9
- data/app/assets/javascripts/geoblacklight/viewers/viewer.js +42 -1
- data/app/assets/javascripts/geoblacklight/viewers/wms.js +1 -1
- data/app/assets/stylesheets/geoblacklight/modules/toolbar.scss +4 -0
- data/app/helpers/geoblacklight_helper.rb +28 -14
- data/app/models/concerns/geoblacklight/solr_document.rb +20 -11
- data/{lib/geoblacklight/search_builder.rb → app/models/concerns/geoblacklight/spatial_search_behavior.rb} +6 -8
- data/app/presenters/geoblacklight/document_presenter.rb +14 -7
- data/app/views/catalog/_document_split.html.erb +1 -1
- data/app/views/catalog/_downloads.html.erb +46 -38
- data/app/views/catalog/_facet_tag_item.html.erb +1 -1
- data/app/views/catalog/_facet_tag_layout.html.erb +1 -1
- data/app/views/catalog/_header_icons.html.erb +3 -0
- data/app/views/catalog/_home_text.html.erb +5 -5
- data/app/views/catalog/_index_split_default.html.erb +5 -7
- data/app/views/catalog/_search_form_no_navbar.html.erb +2 -2
- data/app/views/catalog/_show_default_viewer_container.html.erb +2 -2
- data/app/views/catalog/_show_header_default.html.erb +1 -3
- data/app/views/catalog/_web_services_wfs.html.erb +1 -1
- data/app/views/catalog/_web_services_wms.html.erb +1 -1
- data/config/jetty.yml +1 -1
- data/config/locales/geoblacklight.en.yml +1 -0
- data/geoblacklight.gemspec +4 -4
- data/lib/generators/geoblacklight/install_generator.rb +34 -3
- data/lib/generators/geoblacklight/templates/catalog_controller.rb +36 -31
- data/lib/generators/geoblacklight/templates/config/jetty.yml +1 -1
- data/lib/generators/geoblacklight/templates/geoblacklight.js +1 -0
- data/lib/generators/geoblacklight/templates/{geoblacklight.css.scss → geoblacklight.scss} +0 -0
- data/lib/generators/geoblacklight/templates/settings.yml +42 -2
- data/lib/geoblacklight.rb +1 -2
- data/lib/geoblacklight/constants.rb +1 -1
- data/lib/geoblacklight/download.rb +8 -7
- data/lib/geoblacklight/download/geojson_download.rb +1 -1
- data/lib/geoblacklight/download/geotiff_download.rb +1 -1
- data/lib/geoblacklight/download/kmz_download.rb +1 -1
- data/lib/geoblacklight/download/shapefile_download.rb +1 -1
- data/lib/geoblacklight/geoblacklight_helper_behavior.rb +4 -10
- data/lib/geoblacklight/metadata.rb +3 -6
- data/lib/geoblacklight/references.rb +2 -2
- data/lib/geoblacklight/routes.rb +3 -17
- data/lib/geoblacklight/routes/downloadable.rb +14 -0
- data/lib/geoblacklight/routes/exportable.rb +16 -0
- data/lib/geoblacklight/routes/wms.rb +13 -0
- data/lib/geoblacklight/version.rb +1 -1
- data/spec/controllers/catalog_controller_spec.rb +1 -1
- data/spec/controllers/download_controller_spec.rb +7 -1
- data/spec/features/bookmarks_spec.rb +1 -1
- data/spec/features/configurable_basemap_spec.rb +9 -8
- data/spec/features/download_layer_spec.rb +33 -15
- data/spec/features/esri_viewer_spec.rb +9 -8
- data/spec/features/exports_spec.rb +3 -3
- data/spec/features/home_page_spec.rb +1 -1
- data/spec/features/iiif_viewer_spec.rb +1 -1
- data/spec/features/layer_inspection_spec.rb +2 -2
- data/spec/features/layer_opacity_spec.rb +7 -2
- data/spec/features/layer_preview_spec.rb +2 -2
- data/spec/features/metadata_panel_spec.rb +3 -3
- data/spec/features/saved_searches_spec.rb +1 -1
- data/spec/features/search_bar_spec.rb +2 -2
- data/spec/features/show_page_metadata_spec.rb +1 -1
- data/spec/features/split_view.html.erb_spec.rb +6 -5
- data/spec/features/web_services_modal_spec.rb +3 -3
- data/spec/helpers/geoblacklight_helpers_spec.rb +71 -3
- data/spec/lib/geoblacklight/document_presenter_spec.rb +41 -13
- data/spec/lib/geoblacklight/download_spec.rb +9 -1
- data/spec/lib/geoblacklight/geoblacklight_helper_behavior_spec.rb +12 -9
- data/spec/lib/geoblacklight/item_viewer_spec.rb +4 -3
- data/spec/lib/geoblacklight/references_spec.rb +22 -18
- data/spec/lib/geoblacklight/view_helper_override_spec.rb +1 -1
- data/spec/lib/geoblacklight/wms_layer/feature_info_response_spec.rb +1 -1
- data/spec/lib/geoblacklight/wms_layer_spec.rb +1 -1
- data/spec/models/concerns/geoblacklight/solr_document/carto_db_spec.rb +7 -1
- data/spec/models/concerns/geoblacklight/solr_document_spec.rb +34 -11
- data/spec/{lib/geoblacklight/search_builder_spec.rb → models/concerns/geoblacklight/spatial_search_behavior_spec.rb} +10 -15
- data/spec/spec_helper.rb +6 -6
- data/spec/test_app_templates/lib/generators/test_app_generator.rb +1 -1
- metadata +25 -22
@@ -5,7 +5,7 @@ describe CatalogController, type: :controller do
|
|
5
5
|
it 'returns a document based off an id' do
|
6
6
|
get :web_services, id: 'mit-us-ma-e25zcta5dct-2000'
|
7
7
|
expect(response.status).to eq 200
|
8
|
-
expect(assigns(:document)).
|
8
|
+
expect(assigns(:document)).not_to be_nil
|
9
9
|
end
|
10
10
|
end
|
11
11
|
end
|
@@ -32,8 +32,14 @@ describe Geoblacklight::DownloadController, type: :controller do
|
|
32
32
|
end
|
33
33
|
end
|
34
34
|
describe '#hgl' do
|
35
|
+
let(:hgl_download) { instance_double(Geoblacklight::HglDownload) }
|
36
|
+
|
37
|
+
before do
|
38
|
+
allow(Geoblacklight::HglDownload).to receive(:new).and_return(hgl_download)
|
39
|
+
end
|
40
|
+
|
35
41
|
it 'requests file' do
|
36
|
-
|
42
|
+
allow(hgl_download).to receive(:get).and_return('success')
|
37
43
|
get :hgl, id: 'harvard-g7064-s2-1834-k3', email: 'foo@example.com'
|
38
44
|
expect(response.status).to eq 200
|
39
45
|
end
|
@@ -2,7 +2,7 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
feature 'Blacklight Bookmarks' do
|
4
4
|
scenario 'index has created bookmarks' do
|
5
|
-
visit
|
5
|
+
visit solr_document_path 'columbia-columbia-landinfo-global-aet'
|
6
6
|
click_button 'Bookmark'
|
7
7
|
visit bookmarks_path
|
8
8
|
expect(page).to have_css '.document', count: 1
|
@@ -1,26 +1,27 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
feature 'Configurable basemap', js: true do
|
4
|
-
scenario 'defaults to
|
4
|
+
scenario 'defaults to positron' do
|
5
5
|
visit root_path
|
6
|
-
expect(page).to have_css "img[src*='
|
6
|
+
expect(page).to have_css "img[src*='cartodb']"
|
7
7
|
end
|
8
8
|
feature 'without provided basemap config' do
|
9
9
|
before do
|
10
10
|
CatalogController.blacklight_config.basemap_provider = nil
|
11
11
|
end
|
12
|
-
scenario 'has
|
12
|
+
scenario 'has CartoDB map' do
|
13
13
|
visit root_path
|
14
|
-
expect(page).to have_css "img[src*='
|
14
|
+
expect(page).to have_css "img[src*='cartodb']"
|
15
15
|
end
|
16
16
|
end
|
17
|
-
feature 'using
|
17
|
+
feature 'using darkMatter' do
|
18
18
|
before do
|
19
|
-
CatalogController.blacklight_config.basemap_provider = '
|
19
|
+
CatalogController.blacklight_config.basemap_provider = 'darkMatter'
|
20
20
|
end
|
21
|
-
scenario 'has
|
21
|
+
scenario 'has darkMatter map' do
|
22
|
+
puts CatalogController.blacklight_config.basemap_provider
|
22
23
|
visit root_path
|
23
|
-
expect(page).to have_css "img[src*='
|
24
|
+
expect(page).to have_css "img[src*='dark_all']"
|
24
25
|
end
|
25
26
|
end
|
26
27
|
end
|
@@ -1,47 +1,65 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
feature 'Download layer' do
|
4
|
+
let(:shapefile_download) { instance_double(Geoblacklight::ShapefileDownload) }
|
5
|
+
let(:kmz_download) { instance_double(Geoblacklight::KmzDownload) }
|
6
|
+
let(:hgl_download) { instance_double(Geoblacklight::HglDownload) }
|
7
|
+
|
8
|
+
before do
|
9
|
+
allow(Geoblacklight::ShapefileDownload).to receive(:new).and_return(shapefile_download)
|
10
|
+
allow(Geoblacklight::KmzDownload).to receive(:new).and_return(kmz_download)
|
11
|
+
allow(Geoblacklight::HglDownload).to receive(:new).and_return(hgl_download)
|
12
|
+
end
|
13
|
+
|
4
14
|
scenario 'clicking initial shapefile download button should trigger download', js: true do
|
5
|
-
|
6
|
-
visit
|
15
|
+
expect(shapefile_download).to receive(:get).and_return('mit-us-ma-e25zcta5dct-2000-shapefile.zip')
|
16
|
+
visit solr_document_path('mit-us-ma-e25zcta5dct-2000')
|
7
17
|
find('a', text: 'Download Shapefile').click
|
8
18
|
expect(page).to have_css('a', text: 'Your file mit-us-ma-e25zcta5dct-2000-shapefile.zip is ready for download')
|
9
19
|
end
|
10
20
|
scenario 'failed download should return message with link to layer', js: true do
|
11
|
-
|
12
|
-
visit
|
21
|
+
expect(shapefile_download).to receive(:get).and_raise(Geoblacklight::Exceptions::ExternalDownloadFailed.new(message: 'Failed', url: 'http://www.example.com/failed'))
|
22
|
+
visit solr_document_path('mit-us-ma-e25zcta5dct-2000')
|
13
23
|
find('a', text: 'Download Shapefile', match: :first).click
|
14
24
|
expect(page).to have_css 'div.alert.alert-danger', text: 'Sorry, the requested file could not be downloaded, try downloading it directly from:'
|
15
25
|
expect(page).to have_css 'a', text: 'http://www.example.com/failed'
|
16
26
|
end
|
17
27
|
scenario 'clicking kmz download button should trigger download', js: true do
|
18
|
-
|
19
|
-
visit
|
28
|
+
expect(kmz_download).to receive(:get).and_return('mit-us-ma-e25zcta5dct-2000-kmz.kmz')
|
29
|
+
visit solr_document_path('mit-us-ma-e25zcta5dct-2000')
|
20
30
|
find('button.download-dropdown-toggle').click
|
21
31
|
find('a', text: 'Download KMZ').click
|
22
32
|
expect(page).to have_css('a', text: 'Your file mit-us-ma-e25zcta5dct-2000-kmz.kmz is ready for download')
|
23
33
|
end
|
34
|
+
scenario 'jpg download option should be present under toggle' do
|
35
|
+
visit solr_document_path('princeton-02870w62c')
|
36
|
+
expect(page).to have_css('li a', text: 'Download JPG')
|
37
|
+
end
|
38
|
+
scenario 'clicking jpg download button should redirect to external image' do
|
39
|
+
visit solr_document_path('princeton-02870w62c')
|
40
|
+
expect(page).to have_css("a.btn.btn-default[href='http://libimages.princeton.edu/loris2/pudl0076%2Fmap_pownall%2F00000001.jp2/full/full/0/default.jpg']", text: 'Download JPG')
|
41
|
+
end
|
24
42
|
scenario 'options should be available under toggle' do
|
25
|
-
visit
|
43
|
+
visit solr_document_path('mit-us-ma-e25zcta5dct-2000')
|
26
44
|
find('button.download-dropdown-toggle').click
|
27
45
|
expect(page).to have_css('li a', text: 'Download Shapefile')
|
28
46
|
expect(page).to have_css('li a', text: 'Download KMZ')
|
29
47
|
end
|
30
48
|
scenario 'restricted layer should not have download available to non logged in user' do
|
31
|
-
visit
|
49
|
+
visit solr_document_path('stanford-cg357zz0321')
|
32
50
|
expect(page).to have_css 'a', text: 'Login to view and download'
|
33
|
-
expect(page).
|
51
|
+
expect(page).not_to have_css 'button', text: 'Download Shapefile'
|
34
52
|
end
|
35
53
|
scenario 'restricted layer should have download available to logged in user' do
|
36
54
|
sign_in
|
37
|
-
visit
|
38
|
-
expect(page).
|
55
|
+
visit solr_document_path('stanford-cg357zz0321')
|
56
|
+
expect(page).not_to have_css 'a', text: 'Login to view and download'
|
39
57
|
expect(page).to have_css 'a', text: 'Download Shapefile'
|
40
58
|
expect(page).to have_css 'button.download-dropdown-toggle'
|
41
59
|
end
|
42
60
|
scenario 'layer with direct download and wms/wfs should include all download types' do
|
43
61
|
sign_in
|
44
|
-
visit
|
62
|
+
visit solr_document_path('stanford-cg357zz0321')
|
45
63
|
expect(page).to have_css 'a', text: 'Download Shapefile'
|
46
64
|
find('button.download-dropdown-toggle').click
|
47
65
|
expect(page).to have_css 'li.dropdown-header', text: 'Original'
|
@@ -50,13 +68,13 @@ feature 'Download layer' do
|
|
50
68
|
expect(page).to have_css 'li a', text: 'Download KMZ'
|
51
69
|
end
|
52
70
|
scenario 'clicking GeoTIFF button for Harvard layer should show email form', js: true do
|
53
|
-
visit
|
71
|
+
visit solr_document_path('harvard-g7064-s2-1834-k3')
|
54
72
|
find('a', text: 'Download GeoTIFF').click
|
55
73
|
expect(page).to have_css('#hglRequest')
|
56
74
|
end
|
57
75
|
scenario 'submitting email form should trigger HGL request', js: true do
|
58
|
-
|
59
|
-
visit
|
76
|
+
expect(hgl_download).to receive(:get).and_return('success')
|
77
|
+
visit solr_document_path('harvard-g7064-s2-1834-k3')
|
60
78
|
find('a', text: 'Download GeoTIFF').click
|
61
79
|
within '#hglRequest' do
|
62
80
|
fill_in('Email', with: 'foo@example.com')
|
@@ -2,38 +2,39 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
feature 'feature_layer reference', js: true do
|
4
4
|
scenario 'displays image map layer' do
|
5
|
-
visit
|
5
|
+
visit solr_document_path 'minnesota-test-oregon-naip-2011'
|
6
6
|
expect(page).to have_css '.leaflet-control-zoom', visible: true
|
7
7
|
expect(page).to have_css 'img.leaflet-image-layer', visible: true
|
8
8
|
end
|
9
9
|
scenario 'displays dynamic layer (all layers)' do
|
10
|
-
visit
|
10
|
+
visit solr_document_path 'illinois-f14ff4-1359-4beb-b931-5cb41d20ab90'
|
11
11
|
expect(page).to have_css '.leaflet-control-zoom', visible: true
|
12
12
|
expect(page).to have_css 'img.leaflet-image-layer', visible: true
|
13
13
|
end
|
14
14
|
scenario 'displays dynamic layer (single layer)' do
|
15
|
-
visit
|
15
|
+
visit solr_document_path 'maryland-fc5cd2-732d-4559-a9c7-df38dd683aec'
|
16
16
|
expect(page).to have_css '.leaflet-control-zoom', visible: true
|
17
17
|
expect(page).to have_css 'img.leaflet-image-layer', visible: true
|
18
18
|
end
|
19
19
|
scenario 'displays feature layer' do
|
20
|
-
visit catalog_path 'minnesota-772ebcaf2ec0405ea1b156b5937593e7_0'
|
21
|
-
expect(page).to have_css '.leaflet-control-zoom', visible: true
|
22
20
|
pending 'cannot currently test for svg feature'
|
21
|
+
visit solr_document_path 'minnesota-772ebcaf2ec0405ea1b156b5937593e7_0'
|
22
|
+
expect(page).to have_css '.leaflet-control-zoom', visible: true
|
23
23
|
expect(Nokogiri::HTML.parse(page.body).css('g').length).to eq 23
|
24
|
+
fail
|
24
25
|
end
|
25
26
|
scenario 'displays image map layer' do
|
26
|
-
visit
|
27
|
+
visit solr_document_path 'minnesota-test-oregon-naip-2011'
|
27
28
|
expect(page).to have_css '.leaflet-control-zoom', visible: true
|
28
29
|
expect(page).to have_css 'img.leaflet-image-layer', visible: true
|
29
30
|
end
|
30
31
|
scenario 'displays tiled map layer' do
|
31
|
-
visit
|
32
|
+
visit solr_document_path 'minnesota-test-soil-survey-map'
|
32
33
|
expect(page).to have_css '.leaflet-control-zoom', visible: true
|
33
34
|
expect(page).to have_css 'img.leaflet-tile.leaflet-tile-loaded', visible: true
|
34
35
|
end
|
35
36
|
scenario 'displays Esri WMS layer' do
|
36
|
-
visit
|
37
|
+
visit solr_document_path 'psu-32ef9f-0762-445c-8250-f4a5e220a46d'
|
37
38
|
expect(page).to have_css '.leaflet-control-zoom', visible: true
|
38
39
|
expect(page).to have_css 'img.leaflet-tile.leaflet-tile-loaded', visible: true
|
39
40
|
end
|
@@ -4,7 +4,7 @@ feature 'Export features' do
|
|
4
4
|
feature 'when item is public and wfs is available' do
|
5
5
|
feature 'Open in CartoDB' do
|
6
6
|
scenario 'shows up in tools' do
|
7
|
-
visit
|
7
|
+
visit solr_document_path 'tufts-cambridgegrid100-04'
|
8
8
|
expect(page).to have_css 'li.exports a', text: 'Open in CartoDB'
|
9
9
|
click_link 'Open in CartoDB'
|
10
10
|
end
|
@@ -12,8 +12,8 @@ feature 'Export features' do
|
|
12
12
|
end
|
13
13
|
feature 'when restricted or no wfs' do
|
14
14
|
scenario 'is not in tools' do
|
15
|
-
visit
|
16
|
-
expect(page).
|
15
|
+
visit solr_document_path 'princeton-02870w62c'
|
16
|
+
expect(page).not_to have_css 'li.exports a', text: 'Open in CartoDB'
|
17
17
|
end
|
18
18
|
end
|
19
19
|
end
|
@@ -5,7 +5,7 @@ feature 'Home page', js: true do # use js: true for tests which require js, but
|
|
5
5
|
visit root_path
|
6
6
|
end
|
7
7
|
scenario 'search bar' do
|
8
|
-
expect(page).
|
8
|
+
expect(page).not_to have_css '#search-navbar'
|
9
9
|
within '.jumbotron' do
|
10
10
|
expect(page).to have_css 'h2', text: 'Explore and discover...'
|
11
11
|
expect(page).to have_css 'h3', text: 'Find the maps and data you need'
|
@@ -2,7 +2,7 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
feature 'iiif reference' do
|
4
4
|
scenario 'displays leaflet viewer', js: true do
|
5
|
-
visit
|
5
|
+
visit solr_document_path('princeton-02870w62c')
|
6
6
|
expect(page).to have_css '.leaflet-control-zoom', visible: true
|
7
7
|
end
|
8
8
|
end
|
@@ -2,9 +2,9 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
feature 'Layer inspection', js: true do
|
4
4
|
scenario 'clicking map should trigger inspection' do
|
5
|
-
visit
|
5
|
+
visit solr_document_path('mit-us-ma-e25zcta5dct-2000')
|
6
6
|
expect(page).to have_css('th', text: 'Attribute')
|
7
7
|
find('#map').trigger('click')
|
8
|
-
expect(page).
|
8
|
+
expect(page).not_to have_css('td.default-text')
|
9
9
|
end
|
10
10
|
end
|
@@ -2,14 +2,19 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
feature 'Layer opacity', js: true do
|
4
4
|
scenario 'WMS layer should have opacity control' do
|
5
|
-
visit
|
5
|
+
visit solr_document_path('mit-us-ma-e25zcta5dct-2000')
|
6
6
|
expect(page).to have_css('div.opacity-text', text: '75%')
|
7
7
|
expect(page.all('div.leaflet-layer')[1][:style]).to match(/opacity: 0.75;/)
|
8
8
|
end
|
9
9
|
|
10
10
|
scenario 'ESRI image service layer should have opacity control' do
|
11
|
-
visit
|
11
|
+
visit solr_document_path('minnesota-test-oregon-naip-2011')
|
12
12
|
expect(page).to have_css('div.opacity-text', text: '75%')
|
13
13
|
expect(page.find('img.leaflet-image-layer', match: :first)[:style]).to match(/opacity: 0.75;/)
|
14
14
|
end
|
15
|
+
|
16
|
+
scenario 'IIIF layer should not have opacity control' do
|
17
|
+
visit solr_document_path('princeton-02870w62c')
|
18
|
+
expect(page).not_to have_css('div.opacity-text', text: '75%')
|
19
|
+
end
|
15
20
|
end
|
@@ -2,12 +2,12 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
feature 'Layer preview', js: true do
|
4
4
|
scenario 'Restricted layer should show bounding box' do
|
5
|
-
visit
|
5
|
+
visit solr_document_path('stanford-cg357zz0321')
|
6
6
|
expect(Nokogiri::HTML.parse(page.body).css('path').length).to eq 1
|
7
7
|
end
|
8
8
|
|
9
9
|
scenario 'Public layer should show wms layer not bounding box' do
|
10
|
-
visit
|
10
|
+
visit solr_document_path('mit-us-ma-e25zcta5dct-2000')
|
11
11
|
expect(Nokogiri::HTML.parse(page.body).css('path').length).to eq 0
|
12
12
|
within '.leaflet-tile-pane' do
|
13
13
|
expect(page).to have_css('.leaflet-layer', count: 2)
|
@@ -3,7 +3,7 @@ require 'spec_helper'
|
|
3
3
|
feature 'Metadata tools' do
|
4
4
|
feature 'when metadata references are available', js: :true do
|
5
5
|
scenario 'shows up in tools' do
|
6
|
-
visit
|
6
|
+
visit solr_document_path 'stanford-cg357zz0321'
|
7
7
|
expect(page).to have_css 'li.metadata a', text: 'Metadata'
|
8
8
|
click_link 'Metadata'
|
9
9
|
using_wait_time 15 do
|
@@ -17,8 +17,8 @@ feature 'Metadata tools' do
|
|
17
17
|
end
|
18
18
|
feature 'when metadata references are not available' do
|
19
19
|
scenario 'is not in tools' do
|
20
|
-
visit
|
21
|
-
expect(page).
|
20
|
+
visit solr_document_path 'mit-us-ma-e25zcta5dct-2000'
|
21
|
+
expect(page).not_to have_css 'li.metadata a', text: 'Metadata'
|
22
22
|
end
|
23
23
|
end
|
24
24
|
end
|
@@ -2,11 +2,11 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
feature 'search bar' do
|
4
4
|
scenario 'present on a spatial search' do
|
5
|
-
visit
|
5
|
+
visit search_catalog_path(bbox: '25 3 75 35')
|
6
6
|
expect(page).to have_css '#search-navbar'
|
7
7
|
end
|
8
8
|
scenario 'present on a text search' do
|
9
|
-
visit
|
9
|
+
visit search_catalog_path(q: 'test')
|
10
10
|
expect(page).to have_css '#search-navbar'
|
11
11
|
end
|
12
12
|
end
|
@@ -2,7 +2,7 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
feature 'Metadata display on show page' do
|
4
4
|
scenario 'with default CatalogController specified fields' do
|
5
|
-
visit
|
5
|
+
visit solr_document_path 'stanford-dp018hs9766'
|
6
6
|
within '.geoblacklight-view-panel' do
|
7
7
|
expect(page).to have_css 'dt', count: 8
|
8
8
|
expect(page).to have_css 'dd', count: 8
|
@@ -1,12 +1,13 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
feature 'Index view', js: true do
|
4
|
+
let(:subject_field) { Settings.FIELDS.SUBJECT }
|
4
5
|
before do
|
5
|
-
visit
|
6
|
+
visit search_catalog_path(q: '*')
|
6
7
|
end
|
7
8
|
|
8
9
|
scenario 'should have documents and map on page' do
|
9
|
-
visit
|
10
|
+
visit search_catalog_path(f: { Settings.FIELDS.PROVENANCE => ['Stanford'] })
|
10
11
|
expect(page).to have_css('#documents')
|
11
12
|
expect(page).to have_css('.document', count: 3)
|
12
13
|
expect(page).to have_css('#map')
|
@@ -31,7 +32,7 @@ feature 'Index view', js: true do
|
|
31
32
|
|
32
33
|
scenario 'hover on record should produce bounding box on map' do
|
33
34
|
# Needed to find an svg element on the page
|
34
|
-
visit
|
35
|
+
visit search_catalog_path(f: { Settings.FIELDS.PROVENANCE => ['Stanford'] })
|
35
36
|
expect(Nokogiri::HTML.parse(page.body).css('path').length).to eq 0
|
36
37
|
find('.documentHeader', match: :first).trigger(:mouseover)
|
37
38
|
expect(Nokogiri::HTML.parse(page.body).css('path').length).to eq 1
|
@@ -39,7 +40,7 @@ feature 'Index view', js: true do
|
|
39
40
|
|
40
41
|
scenario 'click on a record area to expand collapse' do
|
41
42
|
within('.documentHeader', match: :first) do
|
42
|
-
expect(page).
|
43
|
+
expect(page).not_to have_css('.collapse')
|
43
44
|
find('.status-icons').trigger('click')
|
44
45
|
expect(page).to have_css('.collapse', visible: true)
|
45
46
|
end
|
@@ -52,7 +53,7 @@ feature 'Index view', js: true do
|
|
52
53
|
end
|
53
54
|
|
54
55
|
scenario 'clicking map search should retain current search parameters' do
|
55
|
-
visit
|
56
|
+
visit "/?f[#{subject_field}][]=polygon&f[#{subject_field}][]=boundaries"
|
56
57
|
find('#map').double_click
|
57
58
|
within '#appliedParams' do
|
58
59
|
expect(page).to have_content('Subject polygon')
|
@@ -3,7 +3,7 @@ require 'spec_helper'
|
|
3
3
|
feature 'web services tools' do
|
4
4
|
feature 'when wms/wfs are provided', js: true do
|
5
5
|
scenario 'shows up in tools' do
|
6
|
-
visit
|
6
|
+
visit solr_document_path 'stanford-cg357zz0321'
|
7
7
|
expect(page).to have_css 'li.web_services a', text: 'Web services'
|
8
8
|
click_link 'Web services'
|
9
9
|
within '.modal-body' do
|
@@ -20,8 +20,8 @@ feature 'web services tools' do
|
|
20
20
|
end
|
21
21
|
feature 'no wms or wfs provided' do
|
22
22
|
scenario 'does not show up in tools' do
|
23
|
-
visit
|
24
|
-
expect(page).
|
23
|
+
visit solr_document_path 'mit-001145244'
|
24
|
+
expect(page).not_to have_css 'li.web_services a', text: 'Web services'
|
25
25
|
end
|
26
26
|
end
|
27
27
|
end
|
@@ -4,9 +4,10 @@ describe GeoblacklightHelper, type: :helper do
|
|
4
4
|
include ActionView::Helpers::UrlHelper
|
5
5
|
include ActionView::Helpers::TranslationHelper
|
6
6
|
describe '#render_facet_links' do
|
7
|
+
let(:subject_field) { Settings.FIELDS.SUBJECT }
|
7
8
|
it 'contains unique links' do
|
8
|
-
expect(self).to receive(:
|
9
|
-
html = Capybara.string(render_facet_links(
|
9
|
+
expect(self).to receive(:search_catalog_path).exactly(3).times.and_return("http://example.com/catalog?f[#{subject_field}][]=category")
|
10
|
+
html = Capybara.string(render_facet_links(subject_field, %w(Test Test Earth Science)))
|
10
11
|
expect(html).to have_css 'a', count: 3
|
11
12
|
expect(html).to have_css 'a', text: 'Test', count: 1
|
12
13
|
expect(html).to have_css 'a', text: 'Earth', count: 1
|
@@ -37,13 +38,74 @@ describe GeoblacklightHelper, type: :helper do
|
|
37
38
|
let(:blacklight_config) { double }
|
38
39
|
it 'without configuration' do
|
39
40
|
expect(blacklight_config).to receive(:basemap_provider).and_return(nil)
|
40
|
-
expect(geoblacklight_basemap).to eq '
|
41
|
+
expect(geoblacklight_basemap).to eq 'positron'
|
41
42
|
end
|
42
43
|
it 'with custom configuration' do
|
43
44
|
expect(blacklight_config).to receive(:basemap_provider).and_return('positron')
|
44
45
|
expect(geoblacklight_basemap).to eq 'positron'
|
45
46
|
end
|
46
47
|
end
|
48
|
+
|
49
|
+
describe '#iiif_jpg_url' do
|
50
|
+
let(:document) { SolrDocument.new(document_attributes) }
|
51
|
+
let(:references_field) { Settings.FIELDS.REFERENCES }
|
52
|
+
let(:document_attributes) do
|
53
|
+
{
|
54
|
+
references_field => {
|
55
|
+
'http://iiif.io/api/image' => 'https://example.edu/image/info.json'
|
56
|
+
}.to_json
|
57
|
+
}
|
58
|
+
end
|
59
|
+
|
60
|
+
it 'returns JPG download URL when given URL to a IIIF info.json' do
|
61
|
+
assign(:document, document)
|
62
|
+
expect(helper.iiif_jpg_url).to eq 'https://example.edu/image/full/full/0/default.jpg'
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
describe '#snippit' do
|
67
|
+
let(:document) { SolrDocument.new(document_attributes) }
|
68
|
+
let(:references_field) { Settings.FIELDS.REFERENCES }
|
69
|
+
context 'as a String' do
|
70
|
+
let(:document_attributes) do
|
71
|
+
{
|
72
|
+
value: 'This is a really long string that should get truncated when it gets rendered'\
|
73
|
+
'in the index view to give a brief description of the contents of a particular document'\
|
74
|
+
'indexed into Solr'
|
75
|
+
}
|
76
|
+
end
|
77
|
+
it 'truncates longer strings to 150 characters' do
|
78
|
+
expect(helper.snippit(document).length).to eq 150
|
79
|
+
end
|
80
|
+
it 'truncated string ends with ...' do
|
81
|
+
expect(helper.snippit(document)[-3..-1]).to eq '...'
|
82
|
+
end
|
83
|
+
end
|
84
|
+
context 'as an Array' do
|
85
|
+
let(:document_attributes) do
|
86
|
+
{
|
87
|
+
value: ['This is a really long string that should get truncated when it gets rendered'\
|
88
|
+
'in the index view to give a brief description of the contents of a particular document'\
|
89
|
+
'indexed into Solr']
|
90
|
+
}
|
91
|
+
end
|
92
|
+
it 'truncates longer strings to 150 characters' do
|
93
|
+
expect(helper.snippit(document).length).to eq 150
|
94
|
+
end
|
95
|
+
it 'truncated string ends with ...' do
|
96
|
+
expect(helper.snippit(document)[-3..-1]).to eq '...'
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
describe '#cartodb_link' do
|
102
|
+
let(:application_name) { 'My GeoBlacklight Deployment' }
|
103
|
+
|
104
|
+
it 'removes spaces from application_name to produce valid CartoDB request URL' do
|
105
|
+
expect(cartodb_link('http://demo.org/wfs/layer.json')).to eq 'http://oneclick.cartodb.com/?file=http%3A%2F%2Fdemo.org%2Fwfs%2Flayer.json&provider=MyGeoBlacklightDeployment&logo=http%3A%2F%2Fgeoblacklight.org%2Fimages%2Fgeoblacklight-logo.png'
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
47
109
|
describe '#render_web_services' do
|
48
110
|
let(:reference) { double(type: 'wms') }
|
49
111
|
it 'with a reference to a defined partial' do
|
@@ -62,4 +124,10 @@ describe GeoblacklightHelper, type: :helper do
|
|
62
124
|
helper.render_web_services(reference)
|
63
125
|
end
|
64
126
|
end
|
127
|
+
|
128
|
+
describe '#leaflet_options' do
|
129
|
+
it 'returns a hash of options for leaflet' do
|
130
|
+
expect(leaflet_options[:VIEWERS][:WMS][:CONTROLS]).to eq(['Opacity'])
|
131
|
+
end
|
132
|
+
end
|
65
133
|
end
|