Skip to content

Commit

Permalink
Merge pull request #1002 from OpenFn/issue976
Browse files Browse the repository at this point in the history
Fix for first click on a new credential type radio button
  • Loading branch information
taylordowns2000 authored Jul 31, 2023
2 parents 8f679da + f60ec6e commit 7635aa4
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ and this project adheres to
- Fix issue creating a new credential from the Job editor where the new
credential was not being set on the job.
[#951](https://github.com/OpenFn/Lightning/issues/951)
- Fix issue where checking a credential type radio button shows as unchecked on
first click. [#976](https://github.com/OpenFn/Lightning/issues/976)

## [v0.7.0-pre5] - 2023-07-28

Expand Down
2 changes: 1 addition & 1 deletion lib/lightning_web/live/credential_live/type_picker.ex
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ defmodule LightningWeb.CredentialLive.TypePicker do
<.form
:let={f}
id="credential-type-picker"
for={%{}}
for={%{"selected" => @selected}}
as={:type}
phx-target={@myself}
phx-change="type_changed"
Expand Down
13 changes: 10 additions & 3 deletions test/support/credential_live_helpers.ex
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
defmodule LightningWeb.CredentialLiveHelpers do
import Phoenix.LiveViewTest
import ExUnit.Assertions

def select_credential_type(live, type) do
live
|> form("#credential-type-picker", type: %{selected: type})
|> render_change()
html =
live
|> form("#credential-type-picker", type: %{selected: type})
|> render_change()

assert Floki.parse_fragment!(html)
|> Floki.find("input[type=radio][value=#{type}][checked]")
|> Enum.any?(),
"Expected #{type} to be selected"
end

def click_continue(live) do
Expand Down

0 comments on commit 7635aa4

Please sign in to comment.