Make map location HTML class names consistent

We were using `map_location` in one place and
`location-map-remove-marker` in another one. We usually use dashes in
HTML class names, we don't say "location map" anywhere else.
This commit is contained in:
Javi Martín
2023-05-02 15:47:14 +02:00
parent f4ef6412b6
commit a145fdb8a8
6 changed files with 40 additions and 40 deletions

View File

@@ -18,7 +18,7 @@ shared_examples "mappable" do |mappable_factory_name, mappable_association_name,
send("fill_in_#{mappable_factory_name}_form")
within ".map_location" do
within ".map-location" do
expect(page).not_to have_css(".map-icon")
end
end
@@ -30,7 +30,7 @@ shared_examples "mappable" do |mappable_factory_name, mappable_association_name,
send("fill_in_#{mappable_factory_name}_form")
find("#new_map_location").click
within ".map_location" do
within ".map-location" do
expect(page).to have_css(".map-icon")
end
end
@@ -43,7 +43,7 @@ shared_examples "mappable" do |mappable_factory_name, mappable_association_name,
find("#new_map_location").click
send("submit_#{mappable_factory_name}_form")
within ".map_location" do
within ".map-location" do
expect(page).to have_css(".map-icon")
end
end
@@ -53,10 +53,10 @@ shared_examples "mappable" do |mappable_factory_name, mappable_association_name,
visit send(mappable_new_path, arguments)
send("fill_in_#{mappable_factory_name}_form")
expect(page).to have_css ".map_location"
expect(page).to have_css ".map-location"
send("submit_#{mappable_factory_name}_form")
expect(page).not_to have_css(".map_location")
expect(page).not_to have_css(".map-location")
end
scenario "Can not display map on #{mappable_factory_name} when feature.map is disabled" do
@@ -65,10 +65,10 @@ shared_examples "mappable" do |mappable_factory_name, mappable_association_name,
visit send(mappable_new_path, arguments)
send("fill_in_#{mappable_factory_name}_form")
expect(page).not_to have_css ".map_location"
expect(page).not_to have_css ".map-location"
send("submit_#{mappable_factory_name}_form")
expect(page).not_to have_css(".map_location")
expect(page).not_to have_css(".map-location")
end
describe "When restoring the page from browser history" do
@@ -90,7 +90,7 @@ shared_examples "mappable" do |mappable_factory_name, mappable_association_name,
go_back
within ".map_location" do
within ".map-location" do
expect(page).to have_css(".leaflet-map-pane", count: 1)
end
end
@@ -99,7 +99,7 @@ shared_examples "mappable" do |mappable_factory_name, mappable_association_name,
do_login_for user, management: management
visit send(mappable_new_path, arguments)
within ".map_location" do
within ".map-location" do
expect(page).not_to have_css(".map-icon")
end
expect(page.execute_script("return App.Map.maps[0].getZoom();")).to eq(10)
@@ -107,7 +107,7 @@ shared_examples "mappable" do |mappable_factory_name, mappable_association_name,
map_zoom_in
find("#new_map_location").click
within ".map_location" do
within ".map-location" do
expect(page).to have_css(".map-icon")
end
@@ -123,7 +123,7 @@ shared_examples "mappable" do |mappable_factory_name, mappable_association_name,
go_back
within ".map_location" do
within ".map-location" do
expect(page).to have_css(".map-icon")
expect(page.execute_script("return App.Map.maps[0].getZoom();")).to eq(11)
end
@@ -133,14 +133,14 @@ shared_examples "mappable" do |mappable_factory_name, mappable_association_name,
do_login_for user, management: management
visit send(mappable_new_path, arguments)
within ".map_location" do
within ".map-location" do
expect(page).not_to have_css(".map-icon")
end
place_map_at(-68.592487, -62.391357)
find("#new_map_location").click
within ".map_location" do
within ".map-location" do
expect(page).to have_css(".map-icon")
end
@@ -156,7 +156,7 @@ shared_examples "mappable" do |mappable_factory_name, mappable_association_name,
go_back
within ".map_location" do
within ".map-location" do
expect(page).to have_css(".map-icon")
end
end
@@ -189,13 +189,13 @@ shared_examples "mappable" do |mappable_factory_name, mappable_association_name,
do_login_for mappable.author, management: management
visit send(mappable_edit_path, id: mappable.id)
find(".map_location").click
find(".map-location").click
click_on("Save changes")
mappable.reload
expect(page).to have_css(".map_location")
expect(page).not_to have_selector(".map_location[data-marker-latitude='#{map_location.latitude}']")
expect(page).to have_selector(".map_location[data-marker-latitude='#{mappable.map_location.latitude}']")
expect(page).to have_css(".map-location")
expect(page).not_to have_selector(".map-location[data-marker-latitude='#{map_location.latitude}']")
expect(page).to have_selector(".map-location[data-marker-latitude='#{mappable.map_location.latitude}']")
end
scenario "Should edit mappable on #{mappable_factory_name} without change map" do
@@ -206,9 +206,9 @@ shared_examples "mappable" do |mappable_factory_name, mappable_association_name,
click_on("Save changes")
mappable.reload
expect(page).to have_css(".map_location")
expect(page).to have_selector(".map_location[data-marker-latitude='#{map_location.latitude}']")
expect(page).to have_selector(".map_location[data-marker-latitude='#{mappable.map_location.latitude}']")
expect(page).to have_css(".map-location")
expect(page).to have_selector(".map-location[data-marker-latitude='#{map_location.latitude}']")
expect(page).to have_selector(".map-location[data-marker-latitude='#{mappable.map_location.latitude}']")
end
scenario "Can not display map on #{mappable_factory_name} edit when remove map marker" do
@@ -218,7 +218,7 @@ shared_examples "mappable" do |mappable_factory_name, mappable_association_name,
click_link "Remove map marker"
click_on "Save changes"
expect(page).not_to have_css(".map_location")
expect(page).not_to have_css(".map-location")
end
scenario "Can not display map on #{mappable_factory_name} edit when feature.map is disabled" do
@@ -229,7 +229,7 @@ shared_examples "mappable" do |mappable_factory_name, mappable_association_name,
fill_in "#{mappable_factory_name.camelize} title", with: "New title"
click_on("Save changes")
expect(page).not_to have_css(".map_location")
expect(page).not_to have_css(".map-location")
end
scenario "No need to skip map on update" do
@@ -254,7 +254,7 @@ shared_examples "mappable" do |mappable_factory_name, mappable_association_name,
do_login_for user, management: management if management
visit send(mappable_show_path, arguments)
within ".map_location" do
within ".map-location" do
expect(page).to have_css(".map-icon")
end
end
@@ -267,7 +267,7 @@ shared_examples "mappable" do |mappable_factory_name, mappable_association_name,
do_login_for user, management: management if management
visit send(mappable_show_path, arguments)
expect(page).not_to have_css(".map_location")
expect(page).not_to have_css(".map-location")
end
scenario "Should not display map on #{mappable_factory_name} show page when feature.map is disable" do
@@ -277,7 +277,7 @@ shared_examples "mappable" do |mappable_factory_name, mappable_association_name,
do_login_for user, management: management if management
visit send(mappable_show_path, arguments)
expect(page).not_to have_css(".map_location")
expect(page).not_to have_css(".map-location")
end
end
end