Skip to content

Commit

Permalink
Merge pull request #40 from sul-dlss/mapattribution
Browse files Browse the repository at this point in the history
add mapattribution parameter passing with tests
  • Loading branch information
mejackreed committed Mar 26, 2014
2 parents bf2b6a6 + 803091c commit b31fe40
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion app/helpers/blacklight_maps_helper.rb
Expand Up @@ -6,7 +6,8 @@ def blacklight_map_tag id, tag_options = {}, &block
default_data = {
maxzoom: blacklight_config.view.maps.maxzoom,
tileurl: blacklight_config.view.maps.tileurl,
type: blacklight_config.view.maps.type
type: blacklight_config.view.maps.type,
mapattribution: blacklight_config.view.maps.mapattribution
}

options = {id: id, data: default_data}.deep_merge(tag_options)
Expand Down
6 changes: 3 additions & 3 deletions spec/helpers/blacklight_maps_helper_spec.rb
Expand Up @@ -34,12 +34,12 @@ def create_response
context "with default values" do
subject { helper.blacklight_map_tag('blacklight-map') }
it { should have_selector "div#blacklight-map" }
it { should have_selector "div[data-maxzoom='8'][data-tileurl='http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png']" }
it { should have_selector "div[data-maxzoom='8'][data-tileurl='http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png'][data-mapattribution='Map data &copy; <a href=\"http://openstreetmap.org\">OpenStreetMap</a> contributors, <a href=\"http://creativecommons.org/licenses/by-sa/2.0/\">CC-BY-SA</a>']" }
end

context "with custom values" do
subject { helper.blacklight_map_tag('blacklight-map', data: {maxzoom: 6, tileurl: 'http://example.com/' }) }
it { should have_selector "div[data-maxzoom='6'][data-tileurl='http://example.com/']" }
subject { helper.blacklight_map_tag('blacklight-map', data: {maxzoom: 6, tileurl: 'http://example.com/', mapattribution: 'hello world' }) }
it { should have_selector "div[data-maxzoom='6'][data-tileurl='http://example.com/'][data-mapattribution='hello world']" }
end

context "when a block is provided" do
Expand Down

0 comments on commit b31fe40

Please sign in to comment.