mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-06 02:51:34 +00:00
Show alert if map cannot load
This commit is contained in:
@@ -20,10 +20,13 @@ angular.module('Darkswarm').directive 'mapSearch', ($timeout, Search) ->
|
||||
$timeout =>
|
||||
map = ctrl.getMap()
|
||||
|
||||
searchBox = scope.createSearchBox map
|
||||
scope.bindSearchResponse map, searchBox
|
||||
scope.biasResults map, searchBox
|
||||
scope.performUrlSearch map
|
||||
if !map
|
||||
alert(t('gmap_load_failure'))
|
||||
else
|
||||
searchBox = scope.createSearchBox map
|
||||
scope.bindSearchResponse map, searchBox
|
||||
scope.biasResults map, searchBox
|
||||
scope.performUrlSearch map
|
||||
|
||||
scope.createSearchBox = (map) ->
|
||||
map.controls[google.maps.ControlPosition.TOP_LEFT].push scope.input
|
||||
|
||||
@@ -2784,6 +2784,7 @@ See the %{link} to find out more about %{sitename}'s features and to start using
|
||||
confirm_hub_change: "Are you sure? This will change your selected hub and remove any items in your shopping cart."
|
||||
confirm_oc_change: "Are you sure? This will change your selected order cycle and remove any items in your shopping cart."
|
||||
location_placeholder: "Type in a location..."
|
||||
gmap_load_failure: "Unable to load map. Please check your browser settings and allow 3rd party cookies for this website."
|
||||
error_required: "can't be blank"
|
||||
error_number: "must be number"
|
||||
error_email: "must be email address"
|
||||
|
||||
27
spec/system/consumer/map_spec.rb
Normal file
27
spec/system/consumer/map_spec.rb
Normal file
@@ -0,0 +1,27 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'system_helper'
|
||||
|
||||
RSpec.describe 'Map' do
|
||||
context 'map can load' do
|
||||
it 'does not show alert' do
|
||||
url_whitelist = page.driver.browser.url_whitelist
|
||||
page.driver.browser.url_whitelist = nil
|
||||
|
||||
assert_raises(Capybara::ModalNotFound) do
|
||||
accept_alert { visit '/map' }
|
||||
end
|
||||
|
||||
page.driver.browser.url_whitelist = url_whitelist
|
||||
end
|
||||
end
|
||||
|
||||
context 'map cannot load' do
|
||||
it 'shows alert' do
|
||||
message = accept_alert { visit '/map' }
|
||||
expect(message).to eq("Unable to load map.
|
||||
Please check your browser settings
|
||||
and allow 3rd party cookies for this website.".squish)
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user