blacklight-maps 0.3.3 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (75) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +2 -0
  3. data/.rubocop.yml +99 -0
  4. data/.solr_wrapper.yml +7 -0
  5. data/.travis.yml +19 -16
  6. data/Gemfile +40 -18
  7. data/README.md +22 -11
  8. data/Rakefile +35 -32
  9. data/app/assets/images/blacklight/maps.svg +1 -0
  10. data/app/assets/javascripts/blacklight-maps.js +1 -4
  11. data/app/assets/javascripts/blacklight-maps/blacklight-maps-browse.js +21 -11
  12. data/app/assets/stylesheets/blacklight_maps/{blacklight-maps.css.scss → blacklight-maps.scss} +1 -2
  13. data/app/assets/stylesheets/blacklight_maps/{default.css.scss → default.scss} +7 -10
  14. data/app/helpers/blacklight/blacklight_maps_helper_behavior.rb +81 -86
  15. data/app/helpers/blacklight_maps_helper.rb +2 -0
  16. data/app/views/catalog/_document_maps.html.erb +1 -1
  17. data/app/views/catalog/{_index_map.html.erb → _index_mapview.html.erb} +1 -1
  18. data/app/views/catalog/_show_maplet_default.html.erb +8 -9
  19. data/app/views/catalog/map.html.erb +2 -2
  20. data/blacklight-maps.gemspec +27 -26
  21. data/config/locales/blacklight-maps-zh.yml +20 -0
  22. data/config/locales/blacklight-maps.ar.yml +21 -0
  23. data/config/locales/blacklight-maps.de.yml +21 -0
  24. data/config/locales/blacklight-maps.en.yml +1 -1
  25. data/config/locales/blacklight-maps.es.yml +21 -0
  26. data/config/locales/blacklight-maps.fr.yml +20 -0
  27. data/config/locales/blacklight-maps.hu.yml +21 -0
  28. data/config/locales/blacklight-maps.it.yml +20 -0
  29. data/config/locales/blacklight-maps.nl.yml +21 -0
  30. data/config/locales/blacklight-maps.pt-BR.yml +21 -0
  31. data/config/locales/blacklight-maps.sq.yml +21 -0
  32. data/config/routes.rb +3 -2
  33. data/lib/blacklight/maps.rb +8 -14
  34. data/lib/blacklight/maps/controller.rb +27 -0
  35. data/lib/blacklight/maps/engine.rb +17 -19
  36. data/lib/blacklight/maps/export.rb +112 -93
  37. data/lib/blacklight/maps/geometry.rb +30 -18
  38. data/lib/blacklight/maps/maps_search_builder.rb +26 -0
  39. data/lib/blacklight/maps/render_constraints_override.rb +63 -30
  40. data/lib/blacklight/maps/version.rb +3 -1
  41. data/lib/generators/blacklight_maps/install_generator.rb +56 -13
  42. data/lib/generators/blacklight_maps/templates/search_history_controller.rb +7 -0
  43. data/{solr_conf → lib/generators/blacklight_maps/templates/solr}/conf/schema.xml +0 -0
  44. data/{solr_conf → lib/generators/blacklight_maps/templates/solr}/conf/solrconfig.xml +0 -0
  45. data/lib/railties/blacklight_maps.rake +13 -9
  46. data/spec/controllers/catalog_controller_spec.rb +20 -10
  47. data/spec/fixtures/sample_solr_documents.yml +955 -852
  48. data/spec/helpers/blacklight_maps_helper_spec.rb +61 -106
  49. data/spec/lib/blacklight/maps/export_spec.rb +109 -143
  50. data/spec/lib/blacklight/maps/geometry_spec.rb +34 -21
  51. data/spec/lib/blacklight/maps/maps_search_builder_spec.rb +42 -0
  52. data/spec/lib/blacklight/maps/render_constraints_override_spec.rb +42 -69
  53. data/spec/spec_helper.rb +19 -21
  54. data/spec/system/index_view_spec.rb +127 -0
  55. data/spec/system/initial_view_spec.rb +28 -0
  56. data/spec/system/map_view_spec.rb +50 -0
  57. data/spec/system/show_view_maplet_spec.rb +78 -0
  58. data/spec/test_app_templates/lib/generators/test_app_generator.rb +8 -14
  59. data/vendor/assets/images/layers-2x.png +0 -0
  60. data/vendor/assets/images/layers.png +0 -0
  61. data/vendor/assets/images/marker-icon-2x.png +0 -0
  62. data/vendor/assets/images/marker-icon.png +0 -0
  63. data/vendor/assets/images/marker-shadow.png +0 -0
  64. data/vendor/assets/javascripts/leaflet.js.erb +13922 -0
  65. data/vendor/assets/javascripts/leaflet.markercluster.js +3 -0
  66. data/vendor/assets/stylesheets/MarkerCluster.Default.css +60 -0
  67. data/vendor/assets/stylesheets/MarkerCluster.css +14 -0
  68. data/vendor/assets/stylesheets/leaflet.css +635 -0
  69. metadata +100 -89
  70. data/config/jetty.yml +0 -7
  71. data/lib/blacklight/maps/controller_override.rb +0 -33
  72. data/spec/features/initial_view_spec.rb +0 -21
  73. data/spec/features/maps_spec.rb +0 -252
  74. data/spec/lib/blacklight/maps/controller_override_spec.rb +0 -34
  75. data/spec/test_app_templates/Gemfile.extra +0 -5
metadata CHANGED
@@ -1,66 +1,65 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blacklight-maps
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Beer
8
8
  - Jack Reed
9
- autorequire:
10
- bindir: bin
9
+ - Eben English
10
+ autorequire:
11
+ bindir: exe
11
12
  cert_chain: []
12
- date: 2015-05-13 00:00:00.000000000 Z
13
+ date: 2020-06-11 00:00:00.000000000 Z
13
14
  dependencies:
14
15
  - !ruby/object:Gem::Dependency
15
- name: rails
16
+ name: blacklight
16
17
  requirement: !ruby/object:Gem::Requirement
17
18
  requirements:
18
19
  - - ">="
19
20
  - !ruby/object:Gem::Version
20
- version: '0'
21
+ version: 7.8.0
22
+ - - "<"
23
+ - !ruby/object:Gem::Version
24
+ version: '8'
21
25
  type: :runtime
22
26
  prerelease: false
23
27
  version_requirements: !ruby/object:Gem::Requirement
24
28
  requirements:
25
29
  - - ">="
26
30
  - !ruby/object:Gem::Version
27
- version: '0'
31
+ version: 7.8.0
32
+ - - "<"
33
+ - !ruby/object:Gem::Version
34
+ version: '8'
28
35
  - !ruby/object:Gem::Dependency
29
- name: blacklight
36
+ name: rails
30
37
  requirement: !ruby/object:Gem::Requirement
31
38
  requirements:
32
39
  - - ">="
33
40
  - !ruby/object:Gem::Version
34
- version: 5.1.0
41
+ version: '5.1'
42
+ - - "<"
43
+ - !ruby/object:Gem::Version
44
+ version: '7'
35
45
  type: :runtime
36
46
  prerelease: false
37
47
  version_requirements: !ruby/object:Gem::Requirement
38
48
  requirements:
39
49
  - - ">="
40
50
  - !ruby/object:Gem::Version
41
- version: 5.1.0
42
- - !ruby/object:Gem::Dependency
43
- name: bootstrap-sass
44
- requirement: !ruby/object:Gem::Requirement
45
- requirements:
46
- - - "~>"
47
- - !ruby/object:Gem::Version
48
- version: '3.0'
49
- type: :runtime
50
- prerelease: false
51
- version_requirements: !ruby/object:Gem::Requirement
52
- requirements:
53
- - - "~>"
51
+ version: '5.1'
52
+ - - "<"
54
53
  - !ruby/object:Gem::Version
55
- version: '3.0'
54
+ version: '7'
56
55
  - !ruby/object:Gem::Dependency
57
- name: leaflet-rails
56
+ name: capybara
58
57
  requirement: !ruby/object:Gem::Requirement
59
58
  requirements:
60
59
  - - ">="
61
60
  - !ruby/object:Gem::Version
62
61
  version: '0'
63
- type: :runtime
62
+ type: :development
64
63
  prerelease: false
65
64
  version_requirements: !ruby/object:Gem::Requirement
66
65
  requirements:
@@ -68,182 +67,194 @@ dependencies:
68
67
  - !ruby/object:Gem::Version
69
68
  version: '0'
70
69
  - !ruby/object:Gem::Dependency
71
- name: leaflet-markercluster-rails
70
+ name: engine_cart
72
71
  requirement: !ruby/object:Gem::Requirement
73
72
  requirements:
74
- - - ">="
73
+ - - "~>"
75
74
  - !ruby/object:Gem::Version
76
- version: '0'
77
- type: :runtime
75
+ version: '2.1'
76
+ type: :development
78
77
  prerelease: false
79
78
  version_requirements: !ruby/object:Gem::Requirement
80
79
  requirements:
81
- - - ">="
80
+ - - "~>"
82
81
  - !ruby/object:Gem::Version
83
- version: '0'
82
+ version: '2.1'
84
83
  - !ruby/object:Gem::Dependency
85
- name: bundler
84
+ name: rspec-rails
86
85
  requirement: !ruby/object:Gem::Requirement
87
86
  requirements:
88
87
  - - "~>"
89
88
  - !ruby/object:Gem::Version
90
- version: '1.5'
89
+ version: '3.0'
91
90
  type: :development
92
91
  prerelease: false
93
92
  version_requirements: !ruby/object:Gem::Requirement
94
93
  requirements:
95
94
  - - "~>"
96
95
  - !ruby/object:Gem::Version
97
- version: '1.5'
96
+ version: '3.0'
98
97
  - !ruby/object:Gem::Dependency
99
- name: rake
98
+ name: rubocop
100
99
  requirement: !ruby/object:Gem::Requirement
101
100
  requirements:
102
- - - ">="
101
+ - - "~>"
103
102
  - !ruby/object:Gem::Version
104
- version: '0'
103
+ version: 0.63.0
105
104
  type: :development
106
105
  prerelease: false
107
106
  version_requirements: !ruby/object:Gem::Requirement
108
107
  requirements:
109
- - - ">="
108
+ - - "~>"
110
109
  - !ruby/object:Gem::Version
111
- version: '0'
110
+ version: 0.63.0
112
111
  - !ruby/object:Gem::Dependency
113
- name: rspec-rails
112
+ name: rubocop-rspec
114
113
  requirement: !ruby/object:Gem::Requirement
115
114
  requirements:
116
115
  - - "~>"
117
116
  - !ruby/object:Gem::Version
118
- version: '3.0'
117
+ version: '1.8'
119
118
  type: :development
120
119
  prerelease: false
121
120
  version_requirements: !ruby/object:Gem::Requirement
122
121
  requirements:
123
122
  - - "~>"
124
123
  - !ruby/object:Gem::Version
125
- version: '3.0'
124
+ version: '1.8'
126
125
  - !ruby/object:Gem::Dependency
127
- name: jettywrapper
126
+ name: selenium-webdriver
128
127
  requirement: !ruby/object:Gem::Requirement
129
128
  requirements:
130
129
  - - ">="
131
130
  - !ruby/object:Gem::Version
132
- version: '0'
131
+ version: 3.13.1
133
132
  type: :development
134
133
  prerelease: false
135
134
  version_requirements: !ruby/object:Gem::Requirement
136
135
  requirements:
137
136
  - - ">="
138
137
  - !ruby/object:Gem::Version
139
- version: '0'
138
+ version: 3.13.1
140
139
  - !ruby/object:Gem::Dependency
141
- name: engine_cart
140
+ name: solr_wrapper
142
141
  requirement: !ruby/object:Gem::Requirement
143
142
  requirements:
144
143
  - - "~>"
145
144
  - !ruby/object:Gem::Version
146
- version: 0.4.0
145
+ version: '2.0'
147
146
  type: :development
148
147
  prerelease: false
149
148
  version_requirements: !ruby/object:Gem::Requirement
150
149
  requirements:
151
150
  - - "~>"
152
151
  - !ruby/object:Gem::Version
153
- version: 0.4.0
154
- - !ruby/object:Gem::Dependency
155
- name: capybara
156
- requirement: !ruby/object:Gem::Requirement
157
- requirements:
158
- - - ">="
159
- - !ruby/object:Gem::Version
160
- version: '0'
161
- type: :development
162
- prerelease: false
163
- version_requirements: !ruby/object:Gem::Requirement
164
- requirements:
165
- - - ">="
166
- - !ruby/object:Gem::Version
167
- version: '0'
152
+ version: '2.0'
168
153
  - !ruby/object:Gem::Dependency
169
- name: poltergeist
154
+ name: webdrivers
170
155
  requirement: !ruby/object:Gem::Requirement
171
156
  requirements:
172
- - - ">="
157
+ - - "~>"
173
158
  - !ruby/object:Gem::Version
174
- version: 1.5.0
159
+ version: '3.0'
175
160
  type: :development
176
161
  prerelease: false
177
162
  version_requirements: !ruby/object:Gem::Requirement
178
163
  requirements:
179
- - - ">="
164
+ - - "~>"
180
165
  - !ruby/object:Gem::Version
181
- version: 1.5.0
182
- description:
166
+ version: '3.0'
167
+ description: Blacklight plugin providing map views for records with geographic data.
183
168
  email:
184
169
  - cabeer@stanford.edu
185
170
  - pjreed@stanford.edu
171
+ - eenglish@bpl.org
186
172
  executables: []
187
173
  extensions: []
188
174
  extra_rdoc_files: []
189
175
  files:
190
176
  - ".coveralls.yml"
191
177
  - ".gitignore"
178
+ - ".rubocop.yml"
179
+ - ".solr_wrapper.yml"
192
180
  - ".travis.yml"
193
181
  - CONTRIBUTING.md
194
182
  - Gemfile
195
183
  - LICENSE.txt
196
184
  - README.md
197
185
  - Rakefile
186
+ - app/assets/images/blacklight/maps.svg
198
187
  - app/assets/javascripts/blacklight-maps.js
199
188
  - app/assets/javascripts/blacklight-maps/blacklight-maps-browse.js
200
- - app/assets/stylesheets/blacklight_maps/blacklight-maps.css.scss
201
- - app/assets/stylesheets/blacklight_maps/default.css.scss
189
+ - app/assets/stylesheets/blacklight_maps/blacklight-maps.scss
190
+ - app/assets/stylesheets/blacklight_maps/default.scss
202
191
  - app/helpers/blacklight/blacklight_maps_helper_behavior.rb
203
192
  - app/helpers/blacklight_maps_helper.rb
204
193
  - app/views/catalog/_document_maps.html.erb
205
- - app/views/catalog/_index_map.html.erb
194
+ - app/views/catalog/_index_mapview.html.erb
206
195
  - app/views/catalog/_map_placename_search.html.erb
207
196
  - app/views/catalog/_map_spatial_search.html.erb
208
197
  - app/views/catalog/_show_maplet_default.html.erb
209
198
  - app/views/catalog/map.html.erb
210
199
  - blacklight-maps.gemspec
211
- - config/jetty.yml
200
+ - config/locales/blacklight-maps-zh.yml
201
+ - config/locales/blacklight-maps.ar.yml
202
+ - config/locales/blacklight-maps.de.yml
212
203
  - config/locales/blacklight-maps.en.yml
204
+ - config/locales/blacklight-maps.es.yml
205
+ - config/locales/blacklight-maps.fr.yml
206
+ - config/locales/blacklight-maps.hu.yml
207
+ - config/locales/blacklight-maps.it.yml
208
+ - config/locales/blacklight-maps.nl.yml
209
+ - config/locales/blacklight-maps.pt-BR.yml
210
+ - config/locales/blacklight-maps.sq.yml
213
211
  - config/routes.rb
214
212
  - docs/blacklight-maps_index-view.png
215
213
  - docs/blacklight-maps_map-view.png
216
214
  - docs/blacklight-maps_search-control.png
217
215
  - docs/blacklight-maps_show-view.png
218
216
  - lib/blacklight/maps.rb
219
- - lib/blacklight/maps/controller_override.rb
217
+ - lib/blacklight/maps/controller.rb
220
218
  - lib/blacklight/maps/engine.rb
221
219
  - lib/blacklight/maps/export.rb
222
220
  - lib/blacklight/maps/geometry.rb
221
+ - lib/blacklight/maps/maps_search_builder.rb
223
222
  - lib/blacklight/maps/render_constraints_override.rb
224
223
  - lib/blacklight/maps/version.rb
225
224
  - lib/generators/blacklight_maps/install_generator.rb
226
225
  - lib/generators/blacklight_maps/templates/blacklight_maps.css.scss
226
+ - lib/generators/blacklight_maps/templates/search_history_controller.rb
227
+ - lib/generators/blacklight_maps/templates/solr/conf/schema.xml
228
+ - lib/generators/blacklight_maps/templates/solr/conf/solrconfig.xml
227
229
  - lib/railties/blacklight_maps.rake
228
- - solr_conf/conf/schema.xml
229
- - solr_conf/conf/solrconfig.xml
230
230
  - spec/controllers/catalog_controller_spec.rb
231
- - spec/features/initial_view_spec.rb
232
- - spec/features/maps_spec.rb
233
231
  - spec/fixtures/sample_solr_documents.yml
234
232
  - spec/helpers/blacklight_maps_helper_spec.rb
235
- - spec/lib/blacklight/maps/controller_override_spec.rb
236
233
  - spec/lib/blacklight/maps/export_spec.rb
237
234
  - spec/lib/blacklight/maps/geometry_spec.rb
235
+ - spec/lib/blacklight/maps/maps_search_builder_spec.rb
238
236
  - spec/lib/blacklight/maps/render_constraints_override_spec.rb
239
237
  - spec/spec_helper.rb
240
- - spec/test_app_templates/Gemfile.extra
238
+ - spec/system/index_view_spec.rb
239
+ - spec/system/initial_view_spec.rb
240
+ - spec/system/map_view_spec.rb
241
+ - spec/system/show_view_maplet_spec.rb
241
242
  - spec/test_app_templates/lib/generators/test_app_generator.rb
242
- homepage: ''
243
+ - vendor/assets/images/layers-2x.png
244
+ - vendor/assets/images/layers.png
245
+ - vendor/assets/images/marker-icon-2x.png
246
+ - vendor/assets/images/marker-icon.png
247
+ - vendor/assets/images/marker-shadow.png
248
+ - vendor/assets/javascripts/leaflet.js.erb
249
+ - vendor/assets/javascripts/leaflet.markercluster.js
250
+ - vendor/assets/stylesheets/MarkerCluster.Default.css
251
+ - vendor/assets/stylesheets/MarkerCluster.css
252
+ - vendor/assets/stylesheets/leaflet.css
253
+ homepage: https://github.com/projectblacklight/blacklight-maps
243
254
  licenses:
244
- - Apache 2.0
255
+ - Apache-2.0
245
256
  metadata: {}
246
- post_install_message:
257
+ post_install_message:
247
258
  rdoc_options: []
248
259
  require_paths:
249
260
  - lib
@@ -258,21 +269,21 @@ required_rubygems_version: !ruby/object:Gem::Requirement
258
269
  - !ruby/object:Gem::Version
259
270
  version: '0'
260
271
  requirements: []
261
- rubyforge_project:
262
- rubygems_version: 2.2.2
263
- signing_key:
272
+ rubygems_version: 3.0.8
273
+ signing_key:
264
274
  specification_version: 4
265
275
  summary: Maps for Blacklight
266
276
  test_files:
267
277
  - spec/controllers/catalog_controller_spec.rb
268
- - spec/features/initial_view_spec.rb
269
- - spec/features/maps_spec.rb
270
278
  - spec/fixtures/sample_solr_documents.yml
271
279
  - spec/helpers/blacklight_maps_helper_spec.rb
272
- - spec/lib/blacklight/maps/controller_override_spec.rb
273
280
  - spec/lib/blacklight/maps/export_spec.rb
274
281
  - spec/lib/blacklight/maps/geometry_spec.rb
282
+ - spec/lib/blacklight/maps/maps_search_builder_spec.rb
275
283
  - spec/lib/blacklight/maps/render_constraints_override_spec.rb
276
284
  - spec/spec_helper.rb
277
- - spec/test_app_templates/Gemfile.extra
285
+ - spec/system/index_view_spec.rb
286
+ - spec/system/initial_view_spec.rb
287
+ - spec/system/map_view_spec.rb
288
+ - spec/system/show_view_maplet_spec.rb
278
289
  - spec/test_app_templates/lib/generators/test_app_generator.rb
@@ -1,7 +0,0 @@
1
- development:
2
- startup_wait: 15
3
- jetty_port: 8983
4
- test:
5
- startup_wait: 60
6
- jetty_port: <%= ENV['TEST_JETTY_PORT'] || 8888 %>
7
- <%= ENV['TEST_JETTY_PATH'] ? "jetty_home: " + ENV['TEST_JETTY_PATH'] : '' %>
@@ -1,33 +0,0 @@
1
- module BlacklightMaps
2
- module ControllerOverride
3
- extend ActiveSupport::Concern
4
- included do
5
- solr_search_params_logic << :add_spatial_search_to_solr
6
- end
7
-
8
- def map
9
- (@response, @document_list) = get_search_results
10
- params[:view] = 'maps'
11
- respond_to do |format|
12
- format.html
13
- end
14
- end
15
-
16
- # add spatial search params to solr
17
- def add_spatial_search_to_solr(solr_parameters, user_parameters)
18
- if user_parameters[:spatial_search_type] && user_parameters[:coordinates]
19
- solr_parameters[:fq] ||= []
20
- if user_parameters[:spatial_search_type] == 'bbox'
21
- solr_parameters[:fq] << blacklight_config.view.maps.coordinates_field + ":" + user_parameters[:coordinates]
22
- else
23
- solr_parameters[:fq] << "{!geofilt sfield=#{blacklight_config.view.maps.coordinates_field}}"
24
- solr_parameters[:pt] = user_parameters[:coordinates]
25
- solr_parameters[:d] = blacklight_config.view.maps.spatial_query_dist
26
- end
27
- end
28
- solr_parameters
29
- end
30
-
31
- end
32
-
33
- end
@@ -1,21 +0,0 @@
1
- require 'spec_helper'
2
-
3
- feature 'Initial view parameter', js: true do
4
- before :all do
5
- CatalogController.configure_blacklight do |config|
6
- config.view.maps.facet_mode = 'coordinates'
7
- config.view.maps.coordinates_facet_field = 'coordinates_facet'
8
- config.add_facet_field 'coordinates_facet', :limit => -2, :label => 'Coordinates', :show => false
9
- end
10
- end
11
- scenario 'defaults to zoom area of markers' do
12
- visit catalog_index_path f: { format: ['Book'] }, view: 'maps'
13
- expect(page).to have_css '.leaflet-marker-icon.marker-cluster', count: 8
14
- end
15
- scenario 'when provided sets map to its view' do
16
- map_tag = '<div id="blacklight-index-map" data-initialview="[[37.65, -122.56],[37.89, -122.27]]" data-maxzoom="18" data-tileurl="http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png" data-mapattribution="Map data &amp;copy; &lt;a href=&quot;http://openstreetmap.org&quot;&gt;OpenStreetMap&lt;/a&gt; contributors, &lt;a href=&quot;http://creativecommons.org/licenses/by-sa/2.0/&quot;&gt;CC-BY-SA&lt;/a&gt;" data-searchcontrol="true" data-catalogpath="/catalog" data-placenamefield="placename_field" data-clustercount="hits" />'.html_safe
17
- expect_any_instance_of(Blacklight::BlacklightMapsHelperBehavior).to receive(:blacklight_map_tag).and_return(map_tag)
18
- visit catalog_index_path f: { format: ['Book'] }, view: 'maps'
19
- expect(page).to_not have_css '.leaflet-marker-icon.marker-cluster'
20
- end
21
- end
@@ -1,252 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe "Map View", js: true do
4
-
5
- before :each do
6
- CatalogController.blacklight_config = Blacklight::Configuration.new
7
- end
8
-
9
- describe "catalog#index and catalog#map views" do
10
-
11
- describe "catalog#index map view" do
12
-
13
- before :each do
14
- CatalogController.configure_blacklight do |config|
15
- # use geojson facet for blacklight-maps catalog#index map view specs
16
- config.add_facet_field 'geojson', :limit => -2, :label => 'GeoJSON', :show => false
17
- config.add_facet_fields_to_solr_request!
18
- end
19
- visit catalog_index_path :q => 'korea', :view => 'maps'
20
- end
21
-
22
- it "should display map elements" do
23
- expect(page).to have_selector("#documents.map")
24
- expect(page).to have_selector("#blacklight-index-map")
25
- end
26
-
27
- it "should display tile layer attribution" do
28
- expect(find("div.leaflet-control-container")).to have_content('OpenStreetMap contributors, CC-BY-SA')
29
- end
30
-
31
- describe "#sortAndPerPage" do
32
-
33
- it "should show the mapped item count" do
34
- expect(page).to have_selector(".mapped-count .badge", text: "4")
35
- end
36
-
37
- it "should show the mapped item caveat" do
38
- expect(page).to have_selector(".mapped-caveat")
39
- end
40
-
41
- # TODO: placeholder spec: #sortAndPerPage > .view-type > .view-type-group
42
- # should show active map icon. however, this spec doesn't work because
43
- # Blacklight::ConfigurationHelperBehavior#has_alternative_views? returns false,
44
- # so catalog/_view_type_group partial renders no content, can't figure out why
45
- it "should show the map view icon" #do
46
- #expect(page).to have_selector(".view-type-maps.active")
47
- #end
48
-
49
- end
50
-
51
- describe "data attributes" do
52
-
53
- it "maxzoom should be from config" do
54
- expect(page).to have_selector("#blacklight-index-map[data-maxzoom='#{CatalogController.blacklight_config.view.maps.maxzoom}']")
55
- end
56
-
57
- it "tileurl should be from config" do
58
- expect(page).to have_selector("#blacklight-index-map[data-tileurl='#{CatalogController.blacklight_config.view.maps.tileurl}']")
59
- end
60
-
61
- end
62
-
63
- describe "marker clusters" do
64
-
65
- before {
66
- 0.upto(2) { find("a.leaflet-control-zoom-out").click } # zoom out to create cluster
67
- }
68
-
69
- it "should have marker cluster div" do
70
- expect(page).to have_selector("div.marker-cluster")
71
- end
72
-
73
- it "should only have one marker cluster" do
74
- expect(page).to have_selector("div.marker-cluster", count: 1)
75
- end
76
-
77
- it "should show the result count" do
78
- expect(find("div.marker-cluster")).to have_content(4)
79
- end
80
-
81
- describe "click marker cluster" do
82
-
83
- before { find("div.marker-cluster").click }
84
-
85
- it "should split into two marker clusters" do
86
- expect(page).to have_selector("div.marker-cluster", count: 2)
87
- end
88
-
89
- end
90
-
91
- end
92
-
93
- describe "marker popups" do
94
- before do
95
- find('.marker-cluster', text: '1', match: :first).click
96
- end
97
-
98
- it "should show a popup with correct content" do
99
- expect(page).to have_selector("div.leaflet-popup-content-wrapper")
100
- expect(page).to have_content("Seoul (Korea)")
101
- end
102
-
103
- describe "click search link" do
104
-
105
- before { find("div.leaflet-popup-content a").click }
106
-
107
- it "should run a new search" do
108
- expect(page).to have_selector(".constraint-value .filterValue", text: "Seoul (Korea)")
109
- end
110
-
111
- it "should use the default view type" do
112
- expect(current_url).to include("view=list")
113
- end
114
-
115
- end
116
-
117
- end
118
-
119
- describe "map search control" do
120
-
121
- it "should have a search control" do
122
- expect(page).to have_selector(".leaflet-control .search-control")
123
- end
124
-
125
- describe "search control hover" do
126
-
127
- before { find(".search-control").hover }
128
-
129
- it "should add a border to the map" do
130
- expect(page).to have_selector(".leaflet-overlay-pane path")
131
- end
132
-
133
- end
134
-
135
- describe "search control click" do
136
-
137
- before { find(".search-control").click }
138
-
139
- it "should run a new search" do
140
- expect(page).to have_selector(".constraint.coordinates")
141
- expect(current_url).to include("view=list")
142
- end
143
-
144
- end
145
-
146
- end
147
-
148
- end
149
-
150
- describe "catalog#map view" do
151
-
152
- before :each do
153
- CatalogController.configure_blacklight do |config|
154
- # use coordinates_facet facet for blacklight-maps catalog#map view specs
155
- config.view.maps.facet_mode = 'coordinates'
156
- config.view.maps.coordinates_facet_field = 'coordinates_facet'
157
- config.add_facet_field 'coordinates_facet', :limit => -2, :label => 'Coordinates', :show => false
158
- config.add_facet_fields_to_solr_request!
159
- end
160
- visit map_path
161
- #print page.html # debugging
162
- end
163
-
164
- it "should display map elements" do
165
- expect(page).to have_selector("#documents.map")
166
- expect(page).to have_selector("#blacklight-index-map")
167
- end
168
-
169
- it "should display some markers" do
170
- expect(page).to have_selector("div.marker-cluster")
171
- end
172
-
173
- describe "marker popups" do
174
-
175
- before :each do
176
- 0.upto(1) { find("a.leaflet-control-zoom-in").click } # zoom in
177
- find(".marker-cluster:first-child").click
178
- end
179
-
180
- it "should show a popup with correct content" do
181
- expect(page).to have_selector("div.leaflet-popup-content-wrapper")
182
- expect(page).to have_content("[35.86166, 104.195397]")
183
- end
184
-
185
- describe "click search link" do
186
-
187
- before { find("div.leaflet-popup-content a").click }
188
-
189
- it "should run a new search" do
190
- expect(page).to have_selector(".constraint-value .filterValue", text: "35.86166,104.195397")
191
- expect(current_url).to include("view=list")
192
- end
193
-
194
- end
195
-
196
- end
197
-
198
- end
199
-
200
- end
201
-
202
- describe "catalog#show maplet view" do
203
-
204
- before :each do
205
- CatalogController.configure_blacklight do |config|
206
- # add maplet to show partials
207
- config.show.partials << :show_maplet
208
- end
209
- visit catalog_path('2008308175')
210
- end
211
-
212
- it "should show the maplet" do
213
- expect(page).to have_selector("#blacklight-show-map")
214
- end
215
-
216
- it "should show the mapped item count" do
217
- expect(page).to have_selector(".mapped-count .badge", text: "2")
218
- end
219
-
220
- it "should show a bounding box and a point marker" do
221
- expect(page).to have_selector(".leaflet-overlay-pane path.leaflet-clickable")
222
- expect(page).to have_selector(".leaflet-marker-icon")
223
- end
224
-
225
- describe "click marker icon" do
226
-
227
- before { find(".leaflet-marker-icon").click }
228
-
229
- it "should show a popup with correct content" do
230
- expect(page).to have_selector("div.leaflet-popup-content-wrapper")
231
- expect(page).to have_content("India")
232
- end
233
-
234
- end
235
-
236
- describe "click bbox path" do
237
-
238
- before do
239
- 0.upto(4) { find("a.leaflet-control-zoom-in").click } #so bbox not covered by point
240
- find(".leaflet-overlay-pane svg").click
241
- end
242
-
243
- it "should show a popup with correct content" do
244
- expect(page).to have_selector("div.leaflet-popup-content-wrapper")
245
- expect(page).to have_content("[68.162386, 6.7535159, 97.395555, 35.5044752]")
246
- end
247
-
248
- end
249
-
250
- end
251
-
252
- end