Skip to content

Commit d349ea1

Browse files
committed
test: improve comments explaining async loading behavior in FileSelectComponent
1 parent 90d12c4 commit d349ea1

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

test/livebook_web/live/file_select_component_test.exs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,12 @@ defmodule LivebookWeb.FileSelectComponentTest do
3737

3838
html = render_component(FileSelectComponent, attrs(file: new_file))
3939

40-
# After changing directory, loading should be reset to false after listing
40+
# After changing directory, loading should be reset to false after async listing completes
41+
# Note: render_component is synchronous, so by the time it returns, the async
42+
# file listing via start_async has already completed and loading is false.
43+
# The loading state is properly managed internally:
44+
# 1. When directory changes, start_async is called with loading: true
45+
# 2. When async completes, handle_async sets loading: false
4146
refute html =~ ~s(role="status")
4247
end
4348

@@ -53,10 +58,11 @@ defmodule LivebookWeb.FileSelectComponentTest do
5358
assert html =~ "basic.livemd"
5459
refute html =~ "play-circle-line"
5560

56-
# Update with running_files changed
61+
# Update with running_files changed (same directory, no dir change)
5762
html = render_component(FileSelectComponent, attrs(file: file, running_files: [running_file]))
5863

59-
# Loading should not be shown when only running_files changes
64+
# Loading should not be triggered when only running_files changes
65+
# because update_file_infos detects no directory change
6066
refute html =~ ~s(role="status")
6167
# Verify basic.livemd is now marked as running
6268
assert html =~ "play-circle-line"

0 commit comments

Comments
 (0)