1 require "application_system_test_case"
 
   3 class AccountHomeTest < ApplicationSystemTestCase
 
   4   test "Go to Home Location works on map layout pages" do
 
   5     user = create(:user, :display_name => "test user", :home_lat => 60, :home_lon => 30)
 
   9     assert_no_selector "img.leaflet-marker-icon"
 
  12     click_on "Go to Home Location"
 
  13     all "img.leaflet-marker-icon", :count => 1 do |marker|
 
  14       assert_equal "My home location", marker["title"]
 
  17     click_on "OpenStreetMap logo"
 
  18     assert_no_selector "img.leaflet-marker-icon"
 
  21   test "Go to Home Location works on non-map layout pages" do
 
  22     user = create(:user, :display_name => "test user", :home_lat => 60, :home_lon => 30)
 
  26     assert_no_selector "img.leaflet-marker-icon"
 
  29     click_on "Go to Home Location"
 
  30     all "img.leaflet-marker-icon", :count => 1 do |marker|
 
  31       assert_equal "My home location", marker["title"]
 
  34     click_on "OpenStreetMap logo"
 
  35     assert_no_selector "img.leaflet-marker-icon"
 
  38   test "Go to Home Location is not available for users without home location" do
 
  39     user = create(:user, :display_name => "test user")
 
  43     assert_no_selector "img.leaflet-marker-icon"
 
  46     assert_no_link "Go to Home Location"
 
  49   test "account home page shows a warning when visited by users without home location" do
 
  50     user = create(:user, :display_name => "test user")
 
  53     visit account_home_path
 
  54     assert_no_selector "img.leaflet-marker-icon"
 
  55     assert_text "Home location is not set"