<%= label f, :position, gettext("Position"), class: "label" %>
diff --git a/test/teslamate_web/live/charge_cost_live_test.exs b/test/teslamate_web/live/charge_cost_live_test.exs
index 8bcd54b7..6230817d 100644
--- a/test/teslamate_web/live/charge_cost_live_test.exs
+++ b/test/teslamate_web/live/charge_cost_live_test.exs
@@ -194,23 +194,24 @@ defmodule TeslaMateWeb.ChargeLive.CostTest do
assert [] =
html
|> Floki.parse_document!()
- |> Floki.find("##{id}_cost")
+ |> Floki.find("#charging_process_cost")
|> Floki.attribute("value")
html =
render_submit(view, :save, %{charging_process: %{cost: 42.12}})
|> Floki.parse_document!()
- assert "Total" = html |> Floki.find("##{id}_mode option[selected]") |> Floki.text()
+ assert "Total" =
+ html |> Floki.find("#charging_process_mode option[selected]") |> Floki.text()
- assert ["42.12"] = html |> Floki.find("##{id}_cost") |> Floki.attribute("value")
+ assert ["42.12"] = html |> Floki.find("#charging_process_cost") |> Floki.attribute("value")
assert %ChargingProcess{cost: decimal("42.12")} = Repo.get(ChargingProcess, id)
html =
render_submit(view, :save, %{charging_process: %{cost: nil}})
|> Floki.parse_document!()
- assert [] = html |> Floki.find("##{id}_cost") |> Floki.attribute("value")
+ assert [] = html |> Floki.find("#charging_process_cost") |> Floki.attribute("value")
assert nil == Repo.get(ChargingProcess, id).cost
end
@@ -227,23 +228,24 @@ defmodule TeslaMateWeb.ChargeLive.CostTest do
assert [] =
html
|> Floki.parse_document!()
- |> Floki.find("##{id}_cost")
+ |> Floki.find("#charging_process_cost")
|> Floki.attribute("value")
html =
render_submit(view, :save, %{charging_process: %{cost: 0.12, mode: "per_kwh"}})
|> Floki.parse_document!()
- assert "Total" = html |> Floki.find("##{id}_mode option[selected]") |> Floki.text()
+ assert "Total" =
+ html |> Floki.find("#charging_process_mode option[selected]") |> Floki.text()
- assert ["1.20"] = html |> Floki.find("##{id}_cost") |> Floki.attribute("value")
+ assert ["1.20"] = html |> Floki.find("#charging_process_cost") |> Floki.attribute("value")
assert %ChargingProcess{cost: decimal("1.20")} = Repo.get(ChargingProcess, id)
html =
render_submit(view, :save, %{charging_process: %{cost: nil}})
|> Floki.parse_document!()
- assert [] = html |> Floki.find("##{id}_cost") |> Floki.attribute("value")
+ assert [] = html |> Floki.find("#charging_process_cost") |> Floki.attribute("value")
assert nil == Repo.get(ChargingProcess, id).cost
end
@@ -260,23 +262,24 @@ defmodule TeslaMateWeb.ChargeLive.CostTest do
assert [] =
html
|> Floki.parse_document!()
- |> Floki.find("##{id}_cost")
+ |> Floki.find("#charging_process_cost")
|> Floki.attribute("value")
html =
render_submit(view, :save, %{charging_process: %{cost: -0.029, mode: "per_kwh"}})
|> Floki.parse_document!()
- assert "Total" = html |> Floki.find("##{id}_mode option[selected]") |> Floki.text()
+ assert "Total" =
+ html |> Floki.find("#charging_process_mode option[selected]") |> Floki.text()
- assert ["-0.29"] = html |> Floki.find("##{id}_cost") |> Floki.attribute("value")
+ assert ["-0.29"] = html |> Floki.find("#charging_process_cost") |> Floki.attribute("value")
assert %ChargingProcess{cost: decimal("-0.29")} = Repo.get(ChargingProcess, id)
html =
render_submit(view, :save, %{charging_process: %{cost: nil}})
|> Floki.parse_document!()
- assert [] = html |> Floki.find("##{id}_cost") |> Floki.attribute("value")
+ assert [] = html |> Floki.find("#charging_process_cost") |> Floki.attribute("value")
assert nil == Repo.get(ChargingProcess, id).cost
end
@@ -294,16 +297,17 @@ defmodule TeslaMateWeb.ChargeLive.CostTest do
assert [] =
html
|> Floki.parse_document!()
- |> Floki.find("##{id}_cost")
+ |> Floki.find("#charging_process_cost")
|> Floki.attribute("value")
html =
render_submit(view, :save, %{charging_process: %{cost: 0.10, mode: "per_minute"}})
|> Floki.parse_document!()
- assert "Total" = html |> Floki.find("##{id}_mode option[selected]") |> Floki.text()
+ assert "Total" =
+ html |> Floki.find("#charging_process_mode option[selected]") |> Floki.text()
- assert ["1.50"] = html |> Floki.find("##{id}_cost") |> Floki.attribute("value")
+ assert ["1.50"] = html |> Floki.find("#charging_process_cost") |> Floki.attribute("value")
assert %ChargingProcess{cost: decimal("1.50")} = Repo.get(ChargingProcess, id)
end
end
diff --git a/test/teslamate_web/live/geofence_live_test.exs b/test/teslamate_web/live/geofence_live_test.exs
index ea087f10..f27b2bbc 100644
--- a/test/teslamate_web/live/geofence_live_test.exs
+++ b/test/teslamate_web/live/geofence_live_test.exs
@@ -113,40 +113,40 @@ defmodule TeslaMateWeb.GeoFenceLiveTest do
assert {:ok, view, html} = live(conn, "/geo-fences/#{id}/edit")
html = Floki.parse_document!(html)
- name = Floki.find(html, "##{id}_name")
+ name = Floki.find(html, "#geo_fence_name")
assert ["Post office"] = Floki.attribute(name, "value")
- latitude = Floki.find(html, "##{id}_latitude")
+ latitude = Floki.find(html, "#geo_fence_latitude")
assert ["-25.066188"] = Floki.attribute(latitude, "value")
- longitude = Floki.find(html, "##{id}_longitude")
+ longitude = Floki.find(html, "#geo_fence_longitude")
assert ["-130.100502"] = Floki.attribute(longitude, "value")
- radius = Floki.find(html, "##{id}_radius")
+ radius = Floki.find(html, "#geo_fence_radius")
assert ["100"] = Floki.attribute(radius, "value")
- radius = Floki.find(html, "##{id}_cost_per_unit")
+ radius = Floki.find(html, "#geo_fence_cost_per_unit")
assert ["0.2599"] = Floki.attribute(radius, "value")
- radius = Floki.find(html, "##{id}_session_fee")
+ radius = Floki.find(html, "#geo_fence_session_fee")
assert ["5.49"] = Floki.attribute(radius, "value")
html =
render_submit(view, :save, %{geo_fence: %{name: "", radius: ""}})
|> Floki.parse_document!()
- assert [""] = html |> Floki.find("##{id}_name") |> Floki.attribute("value")
+ assert [""] = html |> Floki.find("#geo_fence_name") |> Floki.attribute("value")
for kind <- ["name", "radius"] do
error_html =
html
|> Floki.find(".field-body .field")
- |> Enum.filter(fn field -> Floki.find(field, "##{id}_#{kind}") |> length() == 1 end)
+ |> Enum.filter(fn field -> Floki.find(field, "#geo_fence_#{kind}") |> length() == 1 end)
|> Floki.find("span")
|> Floki.raw_html(encode: false)
assert error_html ==
- "can't be blank"
+ "can't be blank"
end
end
@@ -157,16 +157,16 @@ defmodule TeslaMateWeb.GeoFenceLiveTest do
assert {:ok, view, html} = live(conn, "/geo-fences/#{id}/edit")
html = Floki.parse_document!(html)
- name = Floki.find(html, "##{id}_name")
+ name = Floki.find(html, "#geo_fence_name")
assert ["Post office"] = Floki.attribute(name, "value")
- latitude = Floki.find(html, "##{id}_latitude")
+ latitude = Floki.find(html, "#geo_fence_latitude")
assert ["-25.066188"] = Floki.attribute(latitude, "value")
- longitude = Floki.find(html, "##{id}_longitude")
+ longitude = Floki.find(html, "#geo_fence_longitude")
assert ["-130.100502"] = Floki.attribute(longitude, "value")
- radius = Floki.find(html, "##{id}_radius")
+ radius = Floki.find(html, "#geo_fence_radius")
assert ["100"] = Floki.attribute(radius, "value")
render_submit(view, :save, %{
@@ -522,8 +522,8 @@ defmodule TeslaMateWeb.GeoFenceLiveTest do
h = Floki.parse_document!(h)
assert [] == Floki.find(h, ".modal.is-active")
- assert ["47.814441"] = h |> Floki.find("##{id}_latitude") |> Floki.attribute("value")
- assert ["12.367768"] = h |> Floki.find("##{id}_longitude") |> Floki.attribute("value")
+ assert ["47.814441"] = h |> Floki.find("#geo_fence_latitude") |> Floki.attribute("value")
+ assert ["12.367768"] = h |> Floki.find("#geo_fence_longitude") |> Floki.attribute("value")
html =
render_submit(view, :save, %{geo_fence: %{latitude: 47.814451, longitude: 12.367761}})
@@ -560,8 +560,8 @@ defmodule TeslaMateWeb.GeoFenceLiveTest do
h = Floki.parse_document!(h)
assert [] == Floki.find(h, ".modal.is-active")
- assert ["47.814441"] = h |> Floki.find("##{id}_latitude") |> Floki.attribute("value")
- assert ["12.367768"] = h |> Floki.find("##{id}_longitude") |> Floki.attribute("value")
+ assert ["47.814441"] = h |> Floki.find("#geo_fence_latitude") |> Floki.attribute("value")
+ assert ["12.367768"] = h |> Floki.find("#geo_fence_longitude") |> Floki.attribute("value")
html =
render_submit(view, :save, %{geo_fence: %{radius: 50}})