Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
zkayser committed Apr 14, 2020
1 parent 6179d1a commit 06875dc
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
4 changes: 4 additions & 0 deletions lib/live_deck_web/live/control_live.ex
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ defmodule LiveDeckWeb.ControlLive do
|> assign_presentation(socket)}
end

def handle_event("start_timer", _, socket) do
{:noreply, assign(socket, :presentation, nil)}
end

defp assign_presentation(presentation, socket) do
socket
|> assign(presentation: presentation)
Expand Down
2 changes: 1 addition & 1 deletion lib/live_deck_web/templates/control/index.html.leex
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
<div>
</div>
<div class="remote__timer">
<button class="btn">Start Timer</button>
<button phx-click="start_timer" class="btn">Start Timer</button>
</div>
</section>
</div>
4 changes: 4 additions & 0 deletions test/live_deck_web/live/control_live_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ defmodule LiveDeckWeb.ControlLiveTest do
render_click(view, "next")
assert render_click(view, "prev") =~ ~s(data-current-slide=\"1\")
end

test "clicking the start timer button toggles the timer", %{view: view} do
assert render_click(view, "start_timer") =~ ~s(0:00)
end
end

defp mount(context) do
Expand Down

0 comments on commit 06875dc

Please sign in to comment.