mitgliederverwaltung/test/mv_web/live/import_live/components_test.exs

31 lines
1.1 KiB
Elixir

defmodule MvWeb.ImportLive.ComponentsTest do
use ExUnit.Case, async: true
alias MvWeb.ImportLive.Components
describe "import_button_disabled?/2" do
@done_entry %{done?: true}
test "disables the Start Import button while the preview is displayed" do
# During :preview the upload entry is done, but re-clicking Start Import
# would re-run the upload processing and overwrite the current preview.
assert Components.import_button_disabled?(:preview, [@done_entry]) == true
end
test "disables the button while an import is running" do
assert Components.import_button_disabled?(:running, [@done_entry]) == true
end
test "disables the button when there are no upload entries" do
assert Components.import_button_disabled?(:idle, []) == true
end
test "disables the button while an upload entry is not yet done" do
assert Components.import_button_disabled?(:idle, [%{done?: false}]) == true
end
test "enables the button at idle with a completed upload" do
assert Components.import_button_disabled?(:idle, [@done_entry]) == false
end
end
end