geoblacklight 6.0.0.pre.alpha.6 → 6.0.0.pre.alpha.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/ISSUE_TEMPLATE.md +0 -1
- data/.github/workflows/ruby.yml +1 -1
- data/CODE_OF_CONDUCT.md +11 -11
- data/CONTRIBUTING.md +19 -9
- data/README.md +1 -1
- data/app/assets/stylesheets/geoblacklight/global.css +1 -1
- data/app/assets/stylesheets/geoblacklight/index_maps.css +1 -1
- data/app/assets/stylesheets/geoblacklight/record.css +15 -13
- data/app/assets/stylesheets/geoblacklight/viewers.css +88 -5
- data/app/components/geoblacklight/document/download_link_component.html.erb +1 -2
- data/app/components/geoblacklight/document/download_links_component.html.erb +3 -1
- data/app/components/geoblacklight/document/preview_component.html.erb +6 -0
- data/app/components/geoblacklight/document/preview_component.rb +14 -0
- data/app/components/geoblacklight/document_component.html.erb +1 -6
- data/app/components/geoblacklight/facets/bbox_field_component.html.erb +17 -0
- data/app/components/geoblacklight/facets/bbox_field_component.rb +7 -0
- data/app/components/geoblacklight/header_badge_component.html.erb +2 -0
- data/app/components/geoblacklight/header_badge_component.rb +21 -0
- data/app/components/geoblacklight/header_component.html.erb +1 -1
- data/app/components/geoblacklight/header_icons_component.html.erb +1 -1
- data/app/components/geoblacklight/header_icons_component.rb +8 -12
- data/app/components/geoblacklight/item_map_viewer_component.rb +6 -5
- data/app/components/geoblacklight/location_leaflet_map_component.rb +8 -9
- data/app/{views/catalog/_metadata.html.erb → components/geoblacklight/metadata_component.html.erb} +5 -7
- data/app/components/geoblacklight/metadata_component.rb +29 -0
- data/app/components/geoblacklight/metadata_description_markdown_component.rb +21 -0
- data/app/components/geoblacklight/relations_component.html.erb +2 -2
- data/app/components/geoblacklight/resource_header_badge_component.rb +37 -0
- data/app/components/geoblacklight/search_result_component.html.erb +15 -14
- data/app/components/geoblacklight/static_map_component.rb +5 -2
- data/app/helpers/geoblacklight_helper.rb +27 -50
- data/app/javascript/geoblacklight/controllers/leaflet_viewer_controller.js +19 -4
- data/app/javascript/geoblacklight/controllers/openlayers_viewer_controller.js +10 -2
- data/app/javascript/geoblacklight/leaflet/basemaps.js +8 -8
- data/app/javascript/geoblacklight/openlayers/basemaps.js +8 -8
- data/app/models/concerns/geoblacklight/solr_document.rb +9 -0
- data/app/views/catalog/_document_split.html.erb +1 -6
- data/app/views/catalog/_home_text.html.erb +1 -1
- data/app/views/catalog/metadata.html.erb +1 -1
- data/geoblacklight.gemspec +2 -1
- data/lib/generators/geoblacklight/templates/catalog_controller.rb +22 -30
- data/lib/generators/geoblacklight/templates/settings.yml +0 -5
- data/lib/geoblacklight/configuration/leaflet_config.rb +3 -2
- data/lib/geoblacklight/configuration/settings_builder.rb +0 -1
- data/lib/geoblacklight/configuration.rb +18 -5
- data/lib/geoblacklight/engine.rb +1 -0
- data/lib/geoblacklight/item_viewer.rb +1 -1
- data/lib/geoblacklight/version.rb +1 -1
- data/schema/readme.md +1 -1
- data/spec/components/geoblacklight/citation_component_spec.rb +1 -1
- data/spec/components/geoblacklight/document_component_spec.rb +10 -0
- data/spec/components/geoblacklight/metadata_component_spec.rb +67 -0
- data/spec/components/geoblacklight/metadata_description_markdown_component_spec.rb +38 -0
- data/spec/components/geoblacklight/viewer_help_text_component_spec.rb +1 -0
- data/spec/controllers/catalog_controller_spec.rb +8 -55
- data/spec/features/configurable_basemap_spec.rb +7 -7
- data/spec/features/home_page_spec.rb +0 -26
- data/spec/features/index_view_spec.rb +0 -24
- data/spec/features/layer_preview_spec.rb +1 -1
- data/spec/features/metadata_panel_spec.rb +18 -69
- data/spec/features/relations_spec.rb +0 -18
- data/spec/features/search_spec.rb +0 -22
- data/spec/features/sms_spec.rb +8 -8
- data/spec/features/web_services_modal_spec.rb +0 -83
- data/spec/fixtures/fgdc/SANB_a2725322-fgdc.xml +209 -0
- data/spec/fixtures/index_maps/index-map-point.geojson +13181 -949
- data/spec/fixtures/index_maps/index-map-polygon-no-downloadurl.geojson +21150 -970
- data/spec/fixtures/index_maps/index-map-polygon.geojson +21150 -970
- data/spec/fixtures/index_maps/index-map-stanford.geojson +269 -390
- data/spec/fixtures/index_maps/index-map-v1-complex.geojson +8596 -12247
- data/spec/fixtures/iso19139/{stanford-cg357zz0321.xml → SANB_a2725322-iso19139.xml} +130 -194
- data/spec/fixtures/metadata/fgdc.html +119 -59
- data/spec/fixtures/metadata/iso.html +258 -260
- data/spec/fixtures/mods/stanford-bc576pk4911.mods +98 -0
- data/spec/fixtures/solr_documents/README.md +48 -47
- data/spec/fixtures/solr_documents/actual-raster1.json +2 -3
- data/spec/fixtures/solr_documents/index-map-stanford.json +31 -27
- data/spec/fixtures/solr_documents/restricted-line.json +20 -31
- data/spec/helpers/geoblacklight_helper_spec.rb +0 -76
- data/spec/models/concerns/geoblacklight/solr_document/citation_spec.rb +1 -1
- data/spec/requests/bookmarks_spec.rb +13 -0
- data/spec/requests/catalog_search_spec.rb +43 -0
- data/spec/requests/catalog_show_spec.rb +48 -0
- data/spec/requests/home_page_spec.rb +42 -0
- data/spec/requests/index_view_spec.rb +27 -0
- data/spec/requests/metadata_spec.rb +40 -0
- data/spec/requests/missing_metadata_spec.rb +28 -0
- data/spec/requests/relations_spec.rb +28 -0
- data/spec/requests/search_history_spec.rb +13 -0
- data/spec/requests/search_results_spec.rb +62 -0
- data/spec/requests/web_services_spec.rb +51 -0
- metadata +44 -23
- data/spec/features/bookmarks_spec.rb +0 -12
- data/spec/features/data_dictionary_download_spec.rb +0 -18
- data/spec/features/empty_search_spec.rb +0 -13
- data/spec/features/exports_spec.rb +0 -14
- data/spec/features/help_text_spec.rb +0 -10
- data/spec/features/missing_metadata_spec.rb +0 -26
- data/spec/features/oembed_spec.rb +0 -11
- data/spec/features/saved_searches_spec.rb +0 -11
- data/spec/features/search_bar_spec.rb +0 -14
- data/spec/features/search_results_complex_geometry_spec.rb +0 -25
- data/spec/features/search_results_icons_spec.rb +0 -16
- data/spec/features/search_results_overlap_ratio_spec.rb +0 -57
- data/spec/features/show_page_metadata_spec.rb +0 -14
- data/spec/features/suppressed_records_spec.rb +0 -16
- data/spec/fixtures/fgdc/harvard-g7064-s2-1834-k3.xml +0 -1
- data/spec/fixtures/mods/fb897vt9938.mods +0 -111
- data/spec/fixtures/mods/stanford-cg357zz0321.mods +0 -113
|
@@ -30,11 +30,26 @@ module Geoblacklight
|
|
|
30
30
|
# WMS Parameters
|
|
31
31
|
attr_accessor :wms_params # typed as Hash
|
|
32
32
|
|
|
33
|
-
# Enable catalog#show sidebar static map for items with the following viewer protocols
|
|
34
|
-
attr_accessor :sidebar_static_map # typed as Array
|
|
35
|
-
|
|
36
33
|
attribute :iiif_drag_drop_link, :string, default: "@manifest?manifest=@manifest"
|
|
37
34
|
|
|
35
|
+
# Configure basemap provider for GeoBlacklight maps
|
|
36
|
+
# Valid basemaps include:
|
|
37
|
+
# 'positron'
|
|
38
|
+
# 'dark_matter'
|
|
39
|
+
# 'positron_lite'
|
|
40
|
+
# 'world_antique'
|
|
41
|
+
# 'world_eco'
|
|
42
|
+
# 'flat_blue'
|
|
43
|
+
# 'midnight_commander'
|
|
44
|
+
# 'openstreetmap_hot'
|
|
45
|
+
# 'openstreetmap_standard'
|
|
46
|
+
|
|
47
|
+
# Basemap used in light mode
|
|
48
|
+
attribute :basemap_provider, :string, default: "positron"
|
|
49
|
+
|
|
50
|
+
# Basemap used in dark mode
|
|
51
|
+
attribute :dark_basemap_provider, :string, default: "dark_matter"
|
|
52
|
+
|
|
38
53
|
# Homepage Map Geometry
|
|
39
54
|
# Leave null to default to entire world
|
|
40
55
|
# Add a stringified GeoJSON object to scope initial render (example from UMass)
|
|
@@ -125,8 +140,6 @@ module Geoblacklight
|
|
|
125
140
|
note_prefix: "Warning: "
|
|
126
141
|
)
|
|
127
142
|
}
|
|
128
|
-
|
|
129
|
-
@sidebar_static_map = ["iiif", "iiif_manifest"]
|
|
130
143
|
end
|
|
131
144
|
|
|
132
145
|
def fields
|
data/lib/geoblacklight/engine.rb
CHANGED
|
@@ -77,7 +77,7 @@ module Geoblacklight
|
|
|
77
77
|
end
|
|
78
78
|
|
|
79
79
|
def viewer_preference
|
|
80
|
-
[cog, pmtiles,
|
|
80
|
+
[oembed, cog, pmtiles, index_map, tilejson, xyz, wmts, tms, wms, iiif_manifest, iiif, tiled_map_layer, dynamic_map_layer,
|
|
81
81
|
image_map_layer, feature_layer].compact.map(&:to_hash).first
|
|
82
82
|
end
|
|
83
83
|
end
|
data/schema/readme.md
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
This directory contains a [JSON schema vocabulary](http://json-schema.org) file. It is provided for documentation and testing purposes.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
- geoblacklight-schema-aardvark.json : This document is formatted in the [OpenGeoMetadata, version Aardvark schema](https://opengeometadata.org/docs/ogm-aardvark), compatible with Geoblacklight version 4.0+.
|
|
6
6
|
|
|
7
7
|
For more information on the metadata schema for GeoBlacklight, see [opengeometadata.org](https://opengeometadata.org)
|
|
@@ -15,7 +15,7 @@ RSpec.describe Geoblacklight::Document::CitationComponent, type: :component do
|
|
|
15
15
|
|
|
16
16
|
it "creates a citation with the identifier link" do
|
|
17
17
|
expect(page)
|
|
18
|
-
.to have_text "
|
|
18
|
+
.to have_text "East View Geospatial. (2010-04-01). Roads, Port-au-Prince, Haiti, 2010. [Shapefile]. East View Geospatial. https://spatial.lib.berkeley.edu/viewpublic/berkeley-s76d73"
|
|
19
19
|
end
|
|
20
20
|
end
|
|
21
21
|
|
|
@@ -89,4 +89,14 @@ RSpec.describe Geoblacklight::DocumentComponent, type: :component do
|
|
|
89
89
|
expect(page).to have_css("div#leaflet-viewer")
|
|
90
90
|
end
|
|
91
91
|
end
|
|
92
|
+
|
|
93
|
+
context "when the document does not have previewable content" do
|
|
94
|
+
let(:fixture) { "solr_documents/actual-papermap1.json" }
|
|
95
|
+
|
|
96
|
+
it "does not render the viewer" do
|
|
97
|
+
expect(page).not_to have_css("div#leaflet-viewer")
|
|
98
|
+
expect(page).not_to have_css("div#openlayers-viewer")
|
|
99
|
+
expect(page).not_to have_css("div#mirador")
|
|
100
|
+
end
|
|
101
|
+
end
|
|
92
102
|
end
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "spec_helper"
|
|
4
|
+
|
|
5
|
+
RSpec.describe Geoblacklight::MetadataComponent, type: :component do
|
|
6
|
+
let(:metadata) do
|
|
7
|
+
instance_double(
|
|
8
|
+
Geoblacklight::Metadata::Base,
|
|
9
|
+
endpoint: "https://example.com/metadata.xml",
|
|
10
|
+
transform: "<div>test</div>",
|
|
11
|
+
type: :fgdc
|
|
12
|
+
)
|
|
13
|
+
end
|
|
14
|
+
let(:references) { instance_double(Geoblacklight::References, shown_metadata: [metadata]) }
|
|
15
|
+
let(:document) { instance_double(SolrDocument, references: references) }
|
|
16
|
+
|
|
17
|
+
it "renders the metadata navigation and transformed content" do
|
|
18
|
+
render_inline(described_class.new(document: document))
|
|
19
|
+
|
|
20
|
+
expect(page).to have_css(".metadata-view")
|
|
21
|
+
expect(page).to have_css(".pill-metadata.active[href='#fgdc']", text: "FGDC")
|
|
22
|
+
expect(page).to have_css("#fgdc.tab-pane.active #metadata-container", text: "test")
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
context "when the metadata cannot be transformed" do
|
|
26
|
+
before do
|
|
27
|
+
allow(metadata).to receive(:transform).and_raise(Geoblacklight::MetadataTransformer::TransformError)
|
|
28
|
+
allow(metadata).to receive(:to_xml).and_return("<data></data>")
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
it "renders the XML markup" do
|
|
32
|
+
render_inline(described_class.new(document: document))
|
|
33
|
+
|
|
34
|
+
expect(page).to have_css("#metadata-markup-container .CodeRay", text: "data")
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
shared_examples "missing metadata" do |error_class|
|
|
39
|
+
before do
|
|
40
|
+
allow(metadata).to receive(:transform).and_raise(error_class)
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
it "renders the missing metadata message" do
|
|
44
|
+
render_inline(described_class.new(document: document))
|
|
45
|
+
|
|
46
|
+
expect(page).to have_css("#metadata-error-container")
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
context "when the metadata cannot be parsed" do
|
|
51
|
+
include_examples "missing metadata", Geoblacklight::MetadataTransformer::ParseError
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
context "when the metadata type is unsupported" do
|
|
55
|
+
include_examples "missing metadata", Geoblacklight::MetadataTransformer::TypeError
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
context "with an unexpected error" do
|
|
59
|
+
before do
|
|
60
|
+
allow(metadata).to receive(:transform).and_raise(ArgumentError)
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
it "raises the error" do
|
|
64
|
+
expect { render_inline(described_class.new(document: document)) }.to raise_error(ArgumentError)
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
end
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "spec_helper"
|
|
4
|
+
|
|
5
|
+
RSpec.describe Geoblacklight::MetadataDescriptionMarkdownComponent, type: :component do
|
|
6
|
+
subject(:component) { described_class.new(field:, show: true) }
|
|
7
|
+
|
|
8
|
+
let(:field) do
|
|
9
|
+
instance_double(Blacklight::FieldPresenter,
|
|
10
|
+
key: "dct_description_sm",
|
|
11
|
+
label: "Description",
|
|
12
|
+
render_field?: true,
|
|
13
|
+
values: ["a **short**", "description"])
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
before do
|
|
17
|
+
render_inline(component)
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
it "renders the description field" do
|
|
21
|
+
expect(page).to have_css("dt.blacklight-dct_description_sm", text: "Description")
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
it "wraps the values in a truncate abstract" do
|
|
25
|
+
expect(page).to have_css("div.truncate-abstract[data-read-more-text='Read more'][data-close-text='Close']")
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
it "transforms each markdown value into HTML" do
|
|
29
|
+
expect(page).to have_css("div.truncate-abstract p", count: 2)
|
|
30
|
+
expect(page).to have_css("div.truncate-abstract p strong", text: "short")
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
describe "#markdown_to_html" do
|
|
34
|
+
it "transforms markdown into HTML" do
|
|
35
|
+
expect(component.markdown_to_html("a **short** description")).to eq "<p>a <strong>short</strong> description</p>\n"
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
@@ -9,6 +9,7 @@ RSpec.describe Geoblacklight::ViewerHelpTextComponent, type: :component do
|
|
|
9
9
|
context "when the help text exists for an existing viewer protocol" do
|
|
10
10
|
it "shows correct help text title for wms" do
|
|
11
11
|
render_inline(described_class.new(feature, key))
|
|
12
|
+
expect(page).to have_css(".help-text", count: 1)
|
|
12
13
|
expect(page).to have_text(I18n.t("geoblacklight.help_text.viewer_protocol.wms.title"))
|
|
13
14
|
end
|
|
14
15
|
end
|
|
@@ -3,6 +3,14 @@
|
|
|
3
3
|
require "spec_helper"
|
|
4
4
|
|
|
5
5
|
RSpec.describe CatalogController, type: :controller do
|
|
6
|
+
describe ".blacklight_config" do
|
|
7
|
+
it "uses the metadata description component for the description field" do
|
|
8
|
+
description_field = described_class.blacklight_config.show_fields[Geoblacklight.configuration.fields.description]
|
|
9
|
+
|
|
10
|
+
expect(description_field.component).to eq Geoblacklight::MetadataDescriptionMarkdownComponent
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
|
|
6
14
|
describe "#web_services" do
|
|
7
15
|
it "returns a document based off an id" do
|
|
8
16
|
get :web_services, params: {id: "mit-f6rqs4ucovjk2"}
|
|
@@ -11,61 +19,6 @@ RSpec.describe CatalogController, type: :controller do
|
|
|
11
19
|
end
|
|
12
20
|
end
|
|
13
21
|
|
|
14
|
-
describe ".default_solr_params" do
|
|
15
|
-
it "sets the number of rows returned by Solr to 10 and does not filter the results" do
|
|
16
|
-
get :index
|
|
17
|
-
expect(response).to have_http_status :ok
|
|
18
|
-
expect(assigns(:response).docs).not_to be_empty
|
|
19
|
-
expect(assigns(:response).docs.length).to eq 10
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
it "sets the starting document index to 0" do
|
|
23
|
-
get :index
|
|
24
|
-
expect(response).to have_http_status :ok
|
|
25
|
-
expect(assigns(:response).docs).not_to be_empty
|
|
26
|
-
expect(assigns(:response).docs.first.id).to eq "stanford-cg357zz0321"
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
context "with altered default parameters" do
|
|
30
|
-
let(:blacklight_config) { Blacklight::Configuration.new }
|
|
31
|
-
|
|
32
|
-
before do
|
|
33
|
-
allow(controller).to receive_messages blacklight_config: blacklight_config
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
it "sets the starting document index" do
|
|
37
|
-
blacklight_config.default_solr_params = {:start => 2, "q.alt" => "*:*"}
|
|
38
|
-
get :index
|
|
39
|
-
expect(response).to have_http_status :ok
|
|
40
|
-
expect(assigns(:response).docs).not_to be_empty
|
|
41
|
-
expect(assigns(:response).docs.first.id).to eq "mit-001145244"
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
it "filters using a default DisMax query when no query is provided by the client" do
|
|
45
|
-
blacklight_config.default_solr_params = {:start => 10, "q.alt" => "{!dismax}id:nyu"}
|
|
46
|
-
get :index
|
|
47
|
-
expect(response).to have_http_status :ok
|
|
48
|
-
expect(assigns(:response).docs).to be_empty
|
|
49
|
-
end
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
context "with altered per page parameters" do
|
|
53
|
-
let(:blacklight_config) { Blacklight::Configuration.new }
|
|
54
|
-
|
|
55
|
-
before do
|
|
56
|
-
allow(controller).to receive_messages blacklight_config: blacklight_config
|
|
57
|
-
end
|
|
58
|
-
|
|
59
|
-
it "alters the number of documents returned from Solr" do
|
|
60
|
-
blacklight_config.default_per_page = 20
|
|
61
|
-
get :index
|
|
62
|
-
expect(response).to have_http_status :ok
|
|
63
|
-
expect(assigns(:response).docs).not_to be_empty
|
|
64
|
-
expect(assigns(:response).docs.length).to eq 20
|
|
65
|
-
end
|
|
66
|
-
end
|
|
67
|
-
end
|
|
68
|
-
|
|
69
22
|
describe "#raw" do
|
|
70
23
|
it "returns a JSON representation of a Solr Document" do
|
|
71
24
|
get :raw, params: {id: "tufts-cambridgegrid100-04"}
|
|
@@ -10,7 +10,7 @@ RSpec.feature "Configurable basemap", js: true do
|
|
|
10
10
|
|
|
11
11
|
feature "without provided basemap config" do
|
|
12
12
|
before do
|
|
13
|
-
|
|
13
|
+
Geoblacklight.configuration.basemap_provider = nil
|
|
14
14
|
end
|
|
15
15
|
scenario "has Carto map" do
|
|
16
16
|
visit root_path
|
|
@@ -18,21 +18,21 @@ RSpec.feature "Configurable basemap", js: true do
|
|
|
18
18
|
end
|
|
19
19
|
end
|
|
20
20
|
|
|
21
|
-
feature "using
|
|
21
|
+
feature "using dark matter" do
|
|
22
22
|
before do
|
|
23
|
-
|
|
23
|
+
Geoblacklight.configuration.basemap_provider = "dark_matter"
|
|
24
24
|
end
|
|
25
|
-
scenario "has
|
|
25
|
+
scenario "has dark matter map" do
|
|
26
26
|
visit root_path
|
|
27
27
|
expect(page).to have_css "img[src*='dark_all']", visible: :all
|
|
28
28
|
end
|
|
29
29
|
end
|
|
30
30
|
|
|
31
|
-
feature "using
|
|
31
|
+
feature "using openstreetmap hot" do
|
|
32
32
|
before do
|
|
33
|
-
|
|
33
|
+
Geoblacklight.configuration.basemap_provider = "openstreetmap_hot"
|
|
34
34
|
end
|
|
35
|
-
scenario "has
|
|
35
|
+
scenario "has openstreetmap hot map" do
|
|
36
36
|
visit root_path
|
|
37
37
|
expect(page).to have_css "img[src*='hot']", visible: :all
|
|
38
38
|
end
|
|
@@ -7,22 +7,6 @@ RSpec.feature "Home page", js: true do # use js: true for tests which require js
|
|
|
7
7
|
visit root_path
|
|
8
8
|
end
|
|
9
9
|
|
|
10
|
-
scenario "search bar" do
|
|
11
|
-
expect(page).not_to have_css "#search-navbar"
|
|
12
|
-
expect(page).to have_css "h1", text: "Explore and discover..."
|
|
13
|
-
expect(page).to have_css "h2", text: "Find the maps and data you need"
|
|
14
|
-
expect(page).to have_css "form.search-query-form"
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
scenario "find by category" do
|
|
18
|
-
expect(page).to have_css ".category-block", count: 4
|
|
19
|
-
expect(page).to have_css ".home-facet-link", count: 36
|
|
20
|
-
expect(page).to have_css "a.more_facets_link", count: 4
|
|
21
|
-
click_link "Counties"
|
|
22
|
-
expect(page).to have_css ".filter-name", text: "Subject"
|
|
23
|
-
expect(page).to have_css ".filter-value", text: "Counties"
|
|
24
|
-
end
|
|
25
|
-
|
|
26
10
|
scenario "map should be visible" do
|
|
27
11
|
within "#main-container" do
|
|
28
12
|
expect(page).to have_css("#leaflet-viewer")
|
|
@@ -37,14 +21,4 @@ RSpec.feature "Home page", js: true do # use js: true for tests which require js
|
|
|
37
21
|
end
|
|
38
22
|
expect(page).to have_css "#documents"
|
|
39
23
|
end
|
|
40
|
-
|
|
41
|
-
scenario "can search by placename" do
|
|
42
|
-
click_link "New York, New York"
|
|
43
|
-
results = page.all(:css, "article.document")
|
|
44
|
-
expect(results.count).to equal(4)
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
scenario "pages should have meta tag with geoblacklight version" do
|
|
48
|
-
expect(page.body).to include("geoblacklight-version")
|
|
49
|
-
end
|
|
50
24
|
end
|
|
@@ -8,19 +8,6 @@ RSpec.feature "Index view", js: true do
|
|
|
8
8
|
visit search_catalog_path(q: "*")
|
|
9
9
|
end
|
|
10
10
|
|
|
11
|
-
scenario "should have documents and map on page" do
|
|
12
|
-
visit search_catalog_path(f: {Geoblacklight.configuration.fields.provider => ["Stanford"]})
|
|
13
|
-
expect(page).to have_css("#documents")
|
|
14
|
-
expect(page).to have_css(".document", count: 5)
|
|
15
|
-
expect(page).to have_css("#leaflet-viewer")
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
scenario "should have sort and per_page on page" do
|
|
19
|
-
visit search_catalog_path(f: {Geoblacklight.configuration.fields.provider => ["Stanford"]})
|
|
20
|
-
expect(page).to have_css("#sort-dropdown")
|
|
21
|
-
expect(page).to have_css("#per_page-dropdown")
|
|
22
|
-
end
|
|
23
|
-
|
|
24
11
|
scenario "hover on record should produce bounding box on map" do
|
|
25
12
|
# Needed to find an svg element on the page
|
|
26
13
|
visit search_catalog_path(f: {Geoblacklight.configuration.fields.provider => ["Stanford"]})
|
|
@@ -47,15 +34,4 @@ RSpec.feature "Index view", js: true do
|
|
|
47
34
|
expect(page).to have_content("Subject Population")
|
|
48
35
|
end
|
|
49
36
|
end
|
|
50
|
-
|
|
51
|
-
scenario "should have schema.org props listed" do
|
|
52
|
-
visit search_catalog_path(f: {Geoblacklight.configuration.fields.provider => ["Stanford"]})
|
|
53
|
-
within(".documentHeader", match: :first) do
|
|
54
|
-
expect(page).to have_css("a[itemprop='name']")
|
|
55
|
-
find(".dropdown-toggle").click
|
|
56
|
-
end
|
|
57
|
-
within(".more-info-area", match: :first) do
|
|
58
|
-
expect(page).to have_css("small[itemprop='description']")
|
|
59
|
-
end
|
|
60
|
-
end
|
|
61
37
|
end
|
|
@@ -4,7 +4,7 @@ require "spec_helper"
|
|
|
4
4
|
|
|
5
5
|
RSpec.feature "Layer preview", js: true do
|
|
6
6
|
scenario "Restricted layer should show bounding box" do
|
|
7
|
-
visit solr_document_path("
|
|
7
|
+
visit solr_document_path("berkeley-s76d73")
|
|
8
8
|
within("#leaflet-viewer") do
|
|
9
9
|
expect(page).to have_css("path")
|
|
10
10
|
end
|
|
@@ -2,79 +2,28 @@
|
|
|
2
2
|
|
|
3
3
|
require "spec_helper"
|
|
4
4
|
|
|
5
|
-
RSpec.feature "Metadata
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
before do
|
|
18
|
-
allow(iso19139_response).to receive(:body).and_return(iso19139)
|
|
19
|
-
allow(iso19139_response).to receive(:status).and_return(200)
|
|
20
|
-
allow(iso19139_connection).to receive(:get).and_return(iso19139_response)
|
|
21
|
-
allow(Faraday).to receive(:new).with(url: "https://raw.githubusercontent.com/OpenGeoMetadata/edu.stanford.purl/master/cg/357/zz/0321/iso19139.xml").and_return(iso19139_connection)
|
|
22
|
-
|
|
23
|
-
allow(fgdc_response).to receive(:body).and_return(fgdc)
|
|
24
|
-
allow(fgdc_response).to receive(:status).and_return(200)
|
|
25
|
-
allow(fgdc_connection).to receive(:get).and_return(fgdc_response)
|
|
26
|
-
allow(Faraday).to receive(:new).with(url: "https://raw.githubusercontent.com/OpenGeoMetadata/edu.harvard/master/217/121/227/77/fgdc.xml").and_return(fgdc_connection)
|
|
5
|
+
RSpec.feature "Metadata tool", js: true do
|
|
6
|
+
let(:fgdc) { File.read(Rails.root.join("..", "spec", "fixtures", "fgdc", "SANB_a2725322-fgdc.xml")) }
|
|
7
|
+
let(:response) { instance_double(Faraday::Response, body: fgdc, status: 200) }
|
|
8
|
+
let(:connection) { instance_double(Faraday::Connection, get: response) }
|
|
9
|
+
|
|
10
|
+
before do
|
|
11
|
+
allow(Faraday).to receive(:new).and_call_original
|
|
12
|
+
allow(Faraday).to receive(:new)
|
|
13
|
+
.with(url: "https://stacks.stanford.edu/file/druid:bc576pk4911/SANB_a2725322-fgdc.xml")
|
|
14
|
+
.and_return(connection)
|
|
15
|
+
end
|
|
27
16
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
allow(connection).to receive(:get).and_return(response)
|
|
31
|
-
allow(Faraday).to receive(:new).with(url: "http://purl.stanford.edu/cg357zz0321.mods").and_return(connection)
|
|
17
|
+
scenario "opens metadata in a modal" do
|
|
18
|
+
visit solr_document_path("stanford-bc576pk4911")
|
|
32
19
|
|
|
33
|
-
|
|
34
|
-
end
|
|
20
|
+
click_link "Metadata"
|
|
35
21
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
using_wait_time 15 do
|
|
41
|
-
within ".metadata-view" do
|
|
42
|
-
expect(page).to have_css ".pill-metadata", text: "FGDC"
|
|
43
|
-
expect(page).to have_css "dt", text: "Identification Information"
|
|
44
|
-
expect(page).to have_css "dt", text: "Metadata Reference Information"
|
|
45
|
-
end
|
|
22
|
+
using_wait_time 15 do
|
|
23
|
+
within ".modal-content" do
|
|
24
|
+
expect(page).to have_css(".metadata-view")
|
|
25
|
+
expect(page).to have_css(".pill-metadata", text: "FGDC")
|
|
46
26
|
end
|
|
47
27
|
end
|
|
48
|
-
context "when the metadata is in the XML" do
|
|
49
|
-
let(:mods) { File.read(Rails.root.join("..", "spec", "fixtures", "mods", "fb897vt9938.mods")) }
|
|
50
|
-
let(:response) { instance_double(Faraday::Response) }
|
|
51
|
-
let(:connection) { instance_double(Faraday::Connection) }
|
|
52
|
-
|
|
53
|
-
before do
|
|
54
|
-
allow(response).to receive(:body).and_return(mods)
|
|
55
|
-
allow(response).to receive(:status).and_return(200)
|
|
56
|
-
allow(connection).to receive(:get).and_return(response)
|
|
57
|
-
allow(Faraday).to receive(:new).with(url: "http://purl.stanford.edu/fb897vt9938.mods").and_return(connection)
|
|
58
|
-
allow(Faraday).to receive(:new).and_call_original
|
|
59
|
-
end
|
|
60
|
-
|
|
61
|
-
scenario "shows up as XML" do
|
|
62
|
-
visit solr_document_path "stanford-cg357zz0321"
|
|
63
|
-
expect(page).to have_css "li.metadata a", text: "Metadata"
|
|
64
|
-
click_link "Metadata"
|
|
65
|
-
using_wait_time 15 do
|
|
66
|
-
within ".metadata-view" do
|
|
67
|
-
expect(page).to have_css ".pill-metadata", text: "MODS"
|
|
68
|
-
expect(page).to have_css ".CodeRay"
|
|
69
|
-
end
|
|
70
|
-
end
|
|
71
|
-
end
|
|
72
|
-
end
|
|
73
|
-
end
|
|
74
|
-
feature "when metadata references are not available" do
|
|
75
|
-
scenario "is not in tools" do
|
|
76
|
-
visit solr_document_path "mit-f6rqs4ucovjk2"
|
|
77
|
-
expect(page).not_to have_css "li.metadata a", text: "Metadata"
|
|
78
|
-
end
|
|
79
28
|
end
|
|
80
29
|
end
|
|
@@ -3,24 +3,6 @@
|
|
|
3
3
|
require "spec_helper"
|
|
4
4
|
|
|
5
5
|
RSpec.feature "Display related documents" do
|
|
6
|
-
scenario "Record with dct_source_sm value(s) should have parent(s)" do
|
|
7
|
-
visit relations_solr_document_path("nyu_2451_34502")
|
|
8
|
-
expect(page).to have_css(".relations .card-header h2", text: "Source records...")
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
scenario "Record that is pointed to by others should have children" do
|
|
12
|
-
visit relations_solr_document_path("nyu_2451_34635")
|
|
13
|
-
expect(page).to have_css(".relations .card-header h2", text: "Derived records...")
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
scenario "Relations should respond to json" do
|
|
17
|
-
visit relations_solr_document_path("nyu_2451_34635", format: "json")
|
|
18
|
-
response = JSON.parse(page.body)
|
|
19
|
-
expect(response["relations"]).not_to respond_to("source_ancestors")
|
|
20
|
-
expect(response["relations"]["source_descendants"]["docs"].first[Geoblacklight.configuration.fields.id]).to eq "nyu_2451_34502"
|
|
21
|
-
expect(response["current_doc"]).to eq "nyu_2451_34635"
|
|
22
|
-
end
|
|
23
|
-
|
|
24
6
|
scenario "Record with relations should render widget in catalog#show", js: true do
|
|
25
7
|
visit solr_document_path("nyu_2451_34635")
|
|
26
8
|
expect(page).to have_css(".card.relations", visible: :all)
|
|
@@ -3,11 +3,6 @@
|
|
|
3
3
|
require "spec_helper"
|
|
4
4
|
|
|
5
5
|
RSpec.feature "Search" do
|
|
6
|
-
scenario "Suppressed records are hidden" do
|
|
7
|
-
visit "/?q=Sanborn+Map+Company"
|
|
8
|
-
expect(page).to have_css ".document", count: 1
|
|
9
|
-
end
|
|
10
|
-
|
|
11
6
|
scenario "When searching child records from a parent record, supressed records are not hidden", js: true do
|
|
12
7
|
visit "/catalog/princeton-1r66j405w"
|
|
13
8
|
|
|
@@ -18,21 +13,4 @@ RSpec.feature "Search" do
|
|
|
18
13
|
click_link "Browse all 4 records...", visible: :all
|
|
19
14
|
expect(page).to have_css ".document", count: 4
|
|
20
15
|
end
|
|
21
|
-
|
|
22
|
-
scenario "When sorting by year desc, highest value sorts first" do
|
|
23
|
-
visit "/?f%5Bschema_provider_s%5D%5B%5D=University+of+Minnesota&sort=gbl_indexYear_im+desc%2C+dct_title_sort+asc"
|
|
24
|
-
|
|
25
|
-
first_doc = find(".document", match: :first)
|
|
26
|
-
|
|
27
|
-
# Doc with gbl_indexYear_im value: [2014, 2030]
|
|
28
|
-
expect(first_doc["data-document-id"]).to eq("02236876-9c21-42f6-9870-d2562da8e44f")
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
scenario "When sorting by year, missing values sort last" do
|
|
32
|
-
visit "/?f%5Bschema_provider_s%5D%5B%5D=University+of+Minnesota&sort=gbl_indexYear_im+desc%2C+dct_title_sort+asc"
|
|
33
|
-
last_doc = find_all(".document").last
|
|
34
|
-
|
|
35
|
-
# Doc without gbl_indexYear_im value
|
|
36
|
-
expect(last_doc["data-document-id"]).to eq("05d-03-nogeomtype")
|
|
37
|
-
end
|
|
38
16
|
end
|
data/spec/features/sms_spec.rb
CHANGED
|
@@ -3,15 +3,15 @@
|
|
|
3
3
|
require "spec_helper"
|
|
4
4
|
|
|
5
5
|
RSpec.feature "SMS tool", js: true do
|
|
6
|
-
scenario "
|
|
7
|
-
visit solr_document_path
|
|
8
|
-
|
|
6
|
+
scenario "opens the SMS form in a modal" do
|
|
7
|
+
visit solr_document_path("stanford-bc576pk4911")
|
|
8
|
+
|
|
9
9
|
click_link "SMS This"
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
expect(page).to have_css
|
|
13
|
-
expect(page).to have_css
|
|
14
|
-
expect(page).to have_css
|
|
10
|
+
|
|
11
|
+
within ".modal-content" do
|
|
12
|
+
expect(page).to have_css("h1", text: "SMS This")
|
|
13
|
+
expect(page).to have_css("label", text: "Phone Number:")
|
|
14
|
+
expect(page).to have_css("label", text: "Carrier")
|
|
15
15
|
end
|
|
16
16
|
end
|
|
17
17
|
end
|