1 require "application_system_test_case"
3 class SiteTest < ApplicationSystemTestCase
4 test "visiting the index" do
7 assert_selector "h1", :text => "OpenStreetMap"
10 test "tooltip shows for Layers button" do
13 assert_no_selector ".tooltip"
14 button = find ".control-layers .control-button"
16 assert_selector ".tooltip", :text => "Layers"
19 test "tooltip shows for Map Key button on Standard layer" do
22 assert_no_selector ".tooltip"
23 button = find ".control-key .control-button"
25 tooltip = find ".tooltip"
26 tooltip.assert_text "Map Key"
27 tooltip.assert_no_text "not available"
30 test "tooltip shows for Map Key button on a layer without a key provided" do
31 visit "/#layers=Y" # assumes that CyclOSM layer has no map key
33 assert_no_selector ".tooltip"
34 button = find ".control-key .control-button"
36 tooltip = find ".tooltip"
37 tooltip.assert_text "Map Key"
38 tooltip.assert_text "not available"
41 test "tooltip shows for query button when zoomed in" do
44 assert_no_selector ".tooltip"
45 button = find ".control-query .control-button"
47 tooltip = find ".tooltip"
48 tooltip.assert_text "Query features"
49 tooltip.assert_no_text "Zoom in"
54 ".control-note .control-button",
55 ".control-query .control-button"
57 test "tooltips on low zoom levels for disabled control '#{selector}'" do
60 assert_no_selector ".tooltip"
62 assert_selector ".tooltip", :text => "Zoom in"
66 test "notes layer tooltip appears on zoom out" do
67 visit "/#map=9/40/-4" # depends on zoom levels where notes are allowed
68 find(".control-layers .control-button").click
69 li = find(".layers-ui .overlay-layers li:first-child")
70 li.not_matches_css? ".disabled"
71 li.hover # try to trigger disabled tooltip
72 zoomout = find(".control-button.zoomout")
73 zoomout.hover # un-hover the tooltip that's being tested
75 li.matches_css? ".disabled"
77 assert_selector ".tooltip", :text => "Zoom in"