search tags when on click
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2022-12-15 22:33:10 -05:00
parent 0b4449c8a8
commit c3ceb877b2
21 changed files with 152 additions and 55 deletions

View File

@ -37,6 +37,14 @@ defmodule MemexWeb.ContextLiveTest do
assert html =~ context.slug
end
test "searches by tag", %{conn: conn} do
{:ok, index_live, html} = live(conn, Routes.context_index_path(conn, :index))
assert html =~ "example-tag"
assert index_live |> element("a", "example-tag") |> render_click()
assert_patch(index_live, Routes.context_index_path(conn, :search, "example-tag"))
end
test "saves new context", %{conn: conn} do
{:ok, index_live, _html} = live(conn, Routes.context_index_path(conn, :index))
@ -146,6 +154,14 @@ defmodule MemexWeb.ContextLiveTest do
]
end
test "searches by tag", %{conn: conn, context: context} do
{:ok, show_live, html} = live(conn, Routes.context_show_path(conn, :show, context.slug))
assert html =~ "example-tag"
assert show_live |> element("a", "example-tag") |> render_click()
assert_redirect(show_live, Routes.context_index_path(conn, :search, "example-tag"))
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))

View File

@ -38,6 +38,14 @@ defmodule MemexWeb.NoteLiveTest do
assert html =~ note.slug
end
test "searches by tag", %{conn: conn} do
{:ok, index_live, html} = live(conn, Routes.note_index_path(conn, :index))
assert html =~ "example-tag"
assert index_live |> element("a", "example-tag") |> render_click()
assert_patch(index_live, Routes.note_index_path(conn, :search, "example-tag"))
end
test "saves new note", %{conn: conn} do
{:ok, index_live, _html} = live(conn, Routes.note_index_path(conn, :index))
@ -147,6 +155,14 @@ defmodule MemexWeb.NoteLiveTest do
]
end
test "searches by tag", %{conn: conn, note: note} do
{:ok, show_live, html} = live(conn, Routes.note_show_path(conn, :show, note.slug))
assert html =~ "example-tag"
assert show_live |> element("a", "example-tag") |> render_click()
assert_redirect(show_live, Routes.note_index_path(conn, :search, "example-tag"))
end
test "displays context", %{
conn: conn,
backlinked_note: %{slug: backlinked_note_slug},

View File

@ -48,6 +48,14 @@ defmodule MemexWeb.PipelineLiveTest do
assert html =~ pipeline.description
end
test "searches by tag", %{conn: conn} do
{:ok, index_live, html} = live(conn, Routes.pipeline_index_path(conn, :index))
assert html =~ "example-tag"
assert index_live |> element("a", "example-tag") |> render_click()
assert_patch(index_live, Routes.pipeline_index_path(conn, :search, "example-tag"))
end
test "saves new pipeline", %{conn: conn} do
{:ok, index_live, _html} = live(conn, Routes.pipeline_index_path(conn, :index))
@ -175,6 +183,14 @@ defmodule MemexWeb.PipelineLiveTest do
]
end
test "searches by tag", %{conn: conn, pipeline: pipeline} do
{:ok, show_live, html} = live(conn, Routes.pipeline_show_path(conn, :show, pipeline.slug))
assert html =~ "example-tag"
assert show_live |> element("a", "example-tag") |> render_click()
assert_redirect(show_live, Routes.pipeline_index_path(conn, :search, "example-tag"))
end
test "updates a step", %{conn: conn, pipeline: pipeline, step: step} do
{:ok, show_live, _html} = live(conn, Routes.pipeline_show_path(conn, :show, pipeline.slug))

View File

@ -16,7 +16,7 @@ defmodule Memex.ContextsFixtures do
attrs
|> Enum.into(%{
content: "some content",
tags: [],
tags: ["example-tag"],
slug: random_slug(),
visibility: :private
})

View File

@ -16,7 +16,7 @@ defmodule Memex.NotesFixtures do
attrs
|> Enum.into(%{
content: "some content",
tags: [],
tags: ["example-tag"],
slug: random_slug(),
visibility: :private
})

View File

@ -16,7 +16,7 @@ defmodule Memex.PipelinesFixtures do
attrs
|> Enum.into(%{
description: "some description",
tags: [],
tags: ["example-tag"],
slug: random_slug(),
visibility: :private
})