Skip to content

Commit

Permalink
mix format #145 #356 #345
Browse files Browse the repository at this point in the history
  • Loading branch information
nelsonic committed Aug 14, 2023
1 parent b206b2a commit 02cc7d0
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
10 changes: 8 additions & 2 deletions lib/app_web/live/app_live.ex
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,10 @@ defmodule AppWeb.AppLive do
%{"itemId_from" => itemId_from, "itemId_to" => itemId_to},
socket
) do
IO.puts("updateIndexes -> itemId_from: #{itemId_from}, itemId_to: #{itemId_to} | #{Useful.typeof(itemId_to)}")
IO.puts(
"updateIndexes -> itemId_from: #{itemId_from}, itemId_to: #{itemId_to} | #{Useful.typeof(itemId_to)}"
)

App.ListItem.move_item(itemId_from, itemId_to)
{:noreply, socket}
end
Expand All @@ -313,7 +316,10 @@ defmodule AppWeb.AppLive do
},
socket
) do
IO.puts("cur_item_id: #{current_item_id}, selected_item_id: #{selected_item_id}")
IO.puts(
"cur_item_id: #{current_item_id}, selected_item_id: #{selected_item_id}"
)

{:noreply,
push_event(socket, "dragover-item", %{
current_item_id: current_item_id,
Expand Down
9 changes: 6 additions & 3 deletions test/app/list_items_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ defmodule App.ListItemsTest do
@valid_attrs %{text: "Buy Bananas", person_id: 0, status: 2}
test "get_list_item_position/2 retrieves the position of an item in a list" do
{:ok, %{model: item, version: _version}} =
Item.create_item(@valid_attrs)
Item.create_item(@valid_attrs)

{:ok, li1} = App.ListItem.add_item_to_all_list(item)
assert li1.position == 1.0

Expand All @@ -89,12 +90,14 @@ defmodule App.ListItemsTest do
assert length(item_ids) == 0

# Add an new item for the person:
{:ok, %{model: item}} = %{text: "hai", person_id: person_id, status: 2}
|> Item.create_item()
{:ok, %{model: item}} =
%{text: "hai", person_id: person_id, status: 2}
|> Item.create_item()

App.ListItem.add_item_to_all_list(item)

updated_item_ids = App.ListItem.get_items_on_all_list(person_id)

assert length(updated_item_ids) ==
length(App.Item.all_items_for_person(person_id))

Expand Down
5 changes: 4 additions & 1 deletion test/app/list_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,11 @@ defmodule App.ListTest do

test "get_list_by_text!/2 returns the list for the person_id by text" do
person_id = 4
{:ok, %{model: all_list}} = %{text: "all", person_id: person_id, status: 2}

{:ok, %{model: all_list}} =
%{text: "all", person_id: person_id, status: 2}
|> App.List.create_list()

list = App.List.get_list_by_text!(person_id, "all")
assert list.text == "all"
assert list.id == all_list.id
Expand Down

0 comments on commit 02cc7d0

Please sign in to comment.