From: Anton Khorev Date: Mon, 12 Sep 2022 22:52:23 +0000 (+0300) Subject: Merge tooltip fixes/tests X-Git-Tag: live~1401^2~5 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/e409e83b4886ce918c64f5c4cd7fa30cbc1ba14f?hp=--cc Merge tooltip fixes/tests --- e409e83b4886ce918c64f5c4cd7fa30cbc1ba14f diff --cc app/assets/javascripts/leaflet.layers.js index faca07e3c,2633d1037..d762696a1 --- a/app/assets/javascripts/leaflet.layers.js +++ b/app/assets/javascripts/leaflet.layers.js @@@ -171,8 -145,7 +145,7 @@@ L.OSM.layers = function (options) } $(item).attr("class", disabled ? "disabled" : ""); - // item.attr("data-bs-original-title", disabled ? // has additional bug when zooming out from enabled state - item.attr("data-original-title", disabled ? - item.attr("data-bs-original-title", disabled ? ++ item.attr("data-bs-original-title", disabled ? // has additional bug when zooming out from enabled state I18n.t("javascripts.site.map_" + name + "_zoom_in_tooltip") : ""); }); }; diff --cc test/system/site_test.rb index 6dd8550d1,a08f7f344..2809feb93 --- a/test/system/site_test.rb +++ b/test/system/site_test.rb @@@ -38,17 -38,34 +38,28 @@@ class SiteTest < ApplicationSystemTestC tooltip.assert_text "not available" end + test "tooltip shows for query button when zoomed in" do + visit "/#map=14/0/0" + + assert_no_selector ".tooltip" + button = find ".control-query .control-button" + button.hover + tooltip = find ".tooltip" + tooltip.assert_text "Query features" + tooltip.assert_no_text "Zoom in" + end + - test "tooltip shows for query button when zoomed out" do - visit "/#map=10/0/0" + [ + "#edit_tab", + ".control-note .control-button", + ".control-query .control-button" + ].each do |selector| + test "tooltips on low zoom levels for disabled control '#{selector}'" do - visit "/#map=1/1/1" ++ visit "/#map=10/0/0" - assert_no_selector ".tooltip" - button = find ".control-query .control-button" - button.hover - tooltip = find ".tooltip" - tooltip.assert_text "Zoom in to query features" - end - - test "tooltip shows for edit button when zoomed out" do - visit "/#map=11/0/0" - - assert_no_selector ".tooltip" - button = find "#edit_tab" - button.hover - tooltip = find ".tooltip" - tooltip.assert_text "Zoom in to edit the map" + assert_no_selector ".tooltip" + find(selector).hover + assert_selector ".tooltip", :text => "Zoom in" + end end end