From 56df5a3802fe3cf9e9f11884d207bbcb283fd5f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonatan=20K=C5=82osko?= Date: Fri, 27 Oct 2023 18:33:32 +0200 Subject: [PATCH] Improve hub tests (#2308) --- lib/livebook/hubs/dockerfile.ex | 2 +- .../live/file_select_component.ex | 66 ++++++++++++------- .../live/hub/edit/team_component.ex | 30 ++++----- .../livebook_teams/web/hub/edit_live_test.exs | 16 ++--- test/livebook_teams/web/session_live_test.exs | 46 ++++++------- .../live/file_select_component_test.exs | 2 +- test/livebook_web/live/session_live_test.exs | 10 +-- 7 files changed, 88 insertions(+), 84 deletions(-) diff --git a/lib/livebook/hubs/dockerfile.ex b/lib/livebook/hubs/dockerfile.ex index 8f4c2bedd..5fd36f883 100644 --- a/lib/livebook/hubs/dockerfile.ex +++ b/lib/livebook/hubs/dockerfile.ex @@ -54,7 +54,7 @@ defmodule Livebook.Hubs.Dockerfile do list(Livebook.FileSystem.t()), Livebook.FileSystem.File.t() | nil, list(Livebook.Notebook.file_entry()), - list(Livebook.Session.Data.secrets()) + Livebook.Session.Data.secrets() ) :: String.t() def build_dockerfile(config, hub, hub_secrets, hub_file_systems, file, file_entries, secrets) do base_image = Enum.find(Livebook.Config.docker_images(), &(&1.tag == config.docker_tag)) diff --git a/lib/livebook_web/live/file_select_component.ex b/lib/livebook_web/live/file_select_component.ex index ebce30cba..61701349c 100644 --- a/lib/livebook_web/live/file_select_component.ex +++ b/lib/livebook_web/live/file_select_component.ex @@ -87,11 +87,12 @@ defmodule LivebookWeb.FileSelectComponent do @impl true def render(assigns) do ~H""" -
+

File system

<.file_system_menu_button + id={"#{@id}-file-system-menu"} file={@file} file_systems={@file_systems} configure_path={@configure_path} @@ -107,7 +108,7 @@ defmodule LivebookWeb.FileSelectComponent do >
- <.menu id="new-item-menu" disabled={@file_system_select_disabled} position={:bottom_right}> + <.menu + id={"#{@id}-new-item-menu"} + disabled={@file_system_select_disabled} + position={:bottom_right} + > <:toggle> <.menu_item> - <.menu_item> - @@ -181,14 +189,24 @@ defmodule LivebookWeb.FileSelectComponent do
- <.new_item_section type="dir" icon="folder-add-fill" myself={@myself} /> - <.new_item_section type="notebook" icon="file-add-line" myself={@myself} /> + <.new_item_section + id={"#{@id}-new-dir-section"} + type="dir" + icon="folder-add-fill" + myself={@myself} + /> + <.new_item_section + id={"#{@id}-new-notebook-section"} + type="notebook" + icon="file-add-line" + myself={@myself} + />
<.live_file_input @@ -203,6 +221,7 @@ defmodule LivebookWeb.FileSelectComponent do > <%= for file_info <- @file_infos, file_info.highlighted != "" do %> <.file + id={"#{@id}-file-#{file_info.id}"} file_info={file_info} myself={@myself} renaming_file={@renaming_file} @@ -214,6 +233,7 @@ defmodule LivebookWeb.FileSelectComponent do
<%= for file_info <- @file_infos, file_info.highlighted == "" do %> <.file + id={"#{@id}-file-#{file_info.id}"} file_info={file_info} myself={@myself} renaming_file={@renaming_file} @@ -243,25 +263,24 @@ defmodule LivebookWeb.FileSelectComponent do ~H"""