display note backlinks in contexts
This commit is contained in:
@ -1,8 +1,8 @@
|
||||
defmodule MemexWeb.ContextLiveTest do
|
||||
use MemexWeb.ConnCase
|
||||
|
||||
import Phoenix.LiveViewTest
|
||||
import Memex.ContextsFixtures
|
||||
import Memex.{ContextsFixtures, NotesFixtures}
|
||||
alias MemexWeb.Endpoint
|
||||
|
||||
@create_attrs %{
|
||||
"content" => "some content",
|
||||
@ -132,4 +132,26 @@ defmodule MemexWeb.ContextLiveTest do
|
||||
refute has_element?(index_live, "#context-#{context.id}")
|
||||
end
|
||||
end
|
||||
|
||||
describe "show with note" do
|
||||
setup [:register_and_log_in_user]
|
||||
|
||||
setup %{user: user} do
|
||||
%{slug: note_slug} = note = note_fixture(user)
|
||||
|
||||
[
|
||||
note: note,
|
||||
context:
|
||||
context_fixture(%{content: "example with backlink to [[#{note_slug}]] note"}, user)
|
||||
]
|
||||
end
|
||||
|
||||
test "displays context", %{conn: conn, context: context, note: %{slug: note_slug}} do
|
||||
{:ok, show_live, html} = live(conn, Routes.context_show_path(conn, :show, context.slug))
|
||||
|
||||
assert html =~ "context"
|
||||
assert html =~ Routes.note_show_path(Endpoint, :show, note_slug)
|
||||
assert has_element?(show_live, "[data-qa=\"context-note-#{note_slug}\"]")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user