From 91288a9ffa7465d554e2c30ab408ab5a75f41de1 Mon Sep 17 00:00:00 2001 From: shibao Date: Sat, 19 Feb 2022 00:31:17 -0500 Subject: [PATCH] fix tests --- lib/cannery_web/components/container_card.ex | 2 +- .../container_live/edit_tags_component.ex | 2 +- lib/cannery_web/live/home_live.ex | 8 +- .../templates/layout/root.html.heex | 6 +- priv/gettext/default.pot | 49 +++-- priv/gettext/en/LC_MESSAGES/actions.po | 50 ++--- priv/gettext/en/LC_MESSAGES/default.po | 194 ++++++++++++------ priv/gettext/en/LC_MESSAGES/errors.po | 23 ++- priv/gettext/en/LC_MESSAGES/prompts.po | 29 +-- priv/gettext/prompts.pot | 4 +- test/cannery/ammo_test.exs | 8 +- test/cannery/containers_test.exs | 9 +- .../cannery_web/live/ammo_group_live_test.exs | 4 +- test/cannery_web/live/container_live_test.exs | 6 +- 14 files changed, 247 insertions(+), 147 deletions(-) diff --git a/lib/cannery_web/components/container_card.ex b/lib/cannery_web/components/container_card.ex index ce9bfd27..ba6cec2c 100644 --- a/lib/cannery_web/components/container_card.ex +++ b/lib/cannery_web/components/container_card.ex @@ -5,7 +5,7 @@ defmodule CanneryWeb.Components.ContainerCard do use CanneryWeb, :component import CanneryWeb.Components.TagCard - alias Cannery.{Repo, Containers} + alias Cannery.{Containers, Repo} alias CanneryWeb.Endpoint def container_card(%{container: container} = assigns) do diff --git a/lib/cannery_web/live/container_live/edit_tags_component.ex b/lib/cannery_web/live/container_live/edit_tags_component.ex index af871ad2..103757b5 100644 --- a/lib/cannery_web/live/container_live/edit_tags_component.ex +++ b/lib/cannery_web/live/container_live/edit_tags_component.ex @@ -4,7 +4,7 @@ defmodule CanneryWeb.ContainerLive.EditTagsComponent do """ use CanneryWeb, :live_component - alias Cannery.{Accounts.User, Containers, Containers.Container, Tags, Tags.Tag, Repo} + alias Cannery.{Accounts.User, Containers, Containers.Container, Repo, Tags, Tags.Tag} alias Phoenix.LiveView.Socket @impl true diff --git a/lib/cannery_web/live/home_live.ex b/lib/cannery_web/live/home_live.ex index ba8bdc4e..4d4dc55c 100644 --- a/lib/cannery_web/live/home_live.ex +++ b/lib/cannery_web/live/home_live.ex @@ -9,7 +9,13 @@ defmodule CanneryWeb.HomeLive do @impl true def mount(_params, session, socket) do admins = Accounts.list_users_by_role(:admin) - {:ok, socket |> assign_defaults(session) |> assign(query: "", results: %{}, admins: admins)} + + socket = + socket + |> assign_defaults(session) + |> assign(page_title: "Home", query: "", results: %{}, admins: admins) + + {:ok, socket} end @impl true diff --git a/lib/cannery_web/templates/layout/root.html.heex b/lib/cannery_web/templates/layout/root.html.heex index a3705ef3..c45c333c 100644 --- a/lib/cannery_web/templates/layout/root.html.heex +++ b/lib/cannery_web/templates/layout/root.html.heex @@ -5,7 +5,11 @@ <%= csrf_meta_tag() %> - <%= live_title_tag(assigns[:page_title], suffix: " | Cannery") %> + <%= if(assigns |> Map.has_key?(:page_title), + do: "#{assigns.page_title} | Cannery", + else: "Cannery" + ) + |> live_title_tag(suffix: "") %>