polish(rover): drop redundant View action; location cell already links
This commit is contained in:
parent
d44351366a
commit
558980a191
2 changed files with 3 additions and 18 deletions
|
|
@ -277,15 +277,8 @@ defmodule MicrowavepropWeb.RoverLocationsLive do
|
|||
assigns = %{record: record, owner?: owner?(scope, record)}
|
||||
|
||||
~H"""
|
||||
<div class="flex gap-2">
|
||||
<.link
|
||||
navigate={~p"/rover-locations/#{@record.id}"}
|
||||
class="btn btn-xs btn-ghost"
|
||||
>
|
||||
View
|
||||
</.link>
|
||||
<div :if={@owner?} class="flex gap-2">
|
||||
<button
|
||||
:if={@owner?}
|
||||
type="button"
|
||||
phx-click="edit"
|
||||
phx-value-id={@record.id}
|
||||
|
|
@ -294,7 +287,6 @@ defmodule MicrowavepropWeb.RoverLocationsLive do
|
|||
Edit
|
||||
</button>
|
||||
<button
|
||||
:if={@owner?}
|
||||
type="button"
|
||||
phx-click="delete"
|
||||
phx-value-id={@record.id}
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@ defmodule MicrowavepropWeb.RoverLocationsLiveTest do
|
|||
assert html =~ ~s(value="EM12gm")
|
||||
end
|
||||
|
||||
test "View link on each row navigates to the show page", %{conn: conn, user: user} do
|
||||
test "the location cell links to the show page", %{conn: conn, user: user} do
|
||||
{:ok, loc} =
|
||||
Rover.create_location(user, %{
|
||||
lat: 32.5,
|
||||
|
|
@ -132,14 +132,7 @@ defmodule MicrowavepropWeb.RoverLocationsLiveTest do
|
|||
|
||||
{:ok, lv, _html} = live(conn, ~p"/rover-locations")
|
||||
|
||||
assert {:ok, _show_lv, html} =
|
||||
lv
|
||||
|> element("a[href='/rover-locations/#{loc.id}']", "View")
|
||||
|> render_click()
|
||||
|> follow_redirect(conn, ~p"/rover-locations/#{loc.id}")
|
||||
|
||||
assert html =~ "rooftop spot"
|
||||
assert html =~ "EM12gm"
|
||||
assert has_element?(lv, "a[href='/rover-locations/#{loc.id}']")
|
||||
end
|
||||
|
||||
test "edit/delete buttons appear only on the owner's row", %{conn: conn, user: user} do
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue