Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion config/test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,6 @@ end

config :pow, :extension_test_modules, extension_test_modules

config :phoenix_live_view, debug_heex_annotations: true
config :phoenix_live_view,
debug_heex_annotations: true,
debug_attributes: true
8 changes: 4 additions & 4 deletions mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ defmodule Pow.MixProject do
elixir: "~> 1.14",
elixirc_paths: elixirc_paths(Mix.env()),
start_permanent: Mix.env() == :prod,
compilers: Mix.compilers(),
compilers: [:phoenix_live_view] ++ Mix.compilers(),
deps: deps(),
xref: [exclude: [:mnesia]],

Expand All @@ -34,10 +34,10 @@ defmodule Pow.MixProject do
defp deps do
[
{:ecto, "~> 2.2 or ~> 3.0"},
{:phoenix, ">= 1.3.0 and < 1.8.0"},
{:phoenix, "~> 1.8"},
{:phoenix_html, ">= 2.0.0 and < 5.0.0"},
{:plug, ">= 1.5.0 and < 2.0.0", optional: true},
{:phoenix_live_view, ">= 0.18.0", optional: true},
{:phoenix_live_view, "~> 1.1"},

{:phoenix_ecto, "~> 4.3", only: [:dev, :test]},
{:credo, "~> 1.5", only: [:dev, :test]},
Expand All @@ -47,7 +47,7 @@ defmodule Pow.MixProject do

{:ecto_sql, "~> 3.5", only: [:test]},
{:postgrex, "~> 0.15", only: [:test]},
{:floki, ">= 0.30.0", only: :test}
{:lazy_html, ">= 0.0.0", only: :test},
]
end

Expand Down
38 changes: 21 additions & 17 deletions mix.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion test/extensions/email_confirmation/ecto/schema_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ defmodule PowEmailConfirmation.Ecto.SchemaTest do
use Pow.Extension.Ecto.Schema,
extensions: [PowEmailConfirmation]

@ecto_derive_inspect_for_redacted_fields false
@derive_inspect_for_redacted_fields false

schema "users" do
pow_user_fields()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,13 @@ defmodule PowEmailConfirmation.Phoenix.ControllerCallbacksTest do

assert html = html_response(conn, 200)

html_tree = DOM.parse(html)
{html_tree, _} = DOM.parse_document(html)

assert [_input_elem] = DOM.all(html_tree, "input[name=\"user[email]\"]")
assert DOM.all(html_tree, "*[phx-feedback-for=\"user[email]\"] > p") == []
assert _input_elem = DOM.all(html_tree, "input[name=\"user[email]\"]")
assert Enum.empty?(DOM.all(html_tree, "*[phx-feedback-for=\"user[email]\"] > p"))

assert [input_elem] = DOM.all(html_tree, "input[name=\"user[password_confirmation]\"]")
assert [error_elem] = DOM.all(html_tree, "*[phx-feedback-for=\"user[password_confirmation]\"] > p")
assert input_elem = DOM.all(html_tree, "input[name=\"user[password_confirmation]\"]")
assert error_elem = DOM.all(html_tree, "*[phx-feedback-for=\"user[password_confirmation]\"] > p")
assert DOM.attribute(input_elem, "value") == "invalid"
assert DOM.to_text(error_elem) =~ "does not match confirmation"
end
Expand All @@ -105,10 +105,10 @@ defmodule PowEmailConfirmation.Phoenix.ControllerCallbacksTest do

assert html = html_response(conn, 200)

html_tree = DOM.parse(html)
{html_tree, _} = DOM.parse_document(html)

assert [input_elem] = DOM.all(html_tree, "input[name=\"user[email]\"]")
assert [error_elem] = DOM.all(html_tree, "*[phx-feedback-for=\"user[email]\"] > p")
assert input_elem = DOM.all(html_tree, "input[name=\"user[email]\"]")
assert error_elem = DOM.all(html_tree, "*[phx-feedback-for=\"user[email]\"] > p")
assert DOM.attribute(input_elem, "value") == "[email protected]"
assert DOM.to_text(error_elem) =~ "has already been taken"
end
Expand Down
2 changes: 1 addition & 1 deletion test/extensions/invitation/ecto/schema_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ defmodule PowInvitation.Ecto.SchemaTest do
use Pow.Extension.Ecto.Schema,
extensions: [PowInvitation]

@ecto_derive_inspect_for_redacted_fields false
@derive_inspect_for_redacted_fields false

schema "users" do
field :organization_id, :integer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ defmodule PowInvitation.Phoenix.InvitationControllerTest do

assert html = html_response(conn, 200)

html_tree = DOM.parse(html)
{html_tree, _} = DOM.parse_document(html)

assert [label_elem] = DOM.all(html_tree, "label[for=user_email]")
assert [input_elem] = DOM.all(html_tree, "input[name=\"user[email]\"]")
assert label_elem = DOM.all(html_tree, "label[for=user_email]")
assert input_elem = DOM.all(html_tree, "input[name=\"user[email]\"]")
assert DOM.to_text(label_elem) =~ "Email"
assert DOM.attribute(input_elem, "type") == "email"
refute DOM.attribute(input_elem, "value")
Expand All @@ -44,10 +44,10 @@ defmodule PowInvitation.Phoenix.InvitationControllerTest do

assert html = html_response(conn, 200)

html_tree = DOM.parse(html)
{html_tree, _} = DOM.parse_document(html)

assert [label_elem] = DOM.all(html_tree, "label[for=user_username]")
assert [input_elem] = DOM.all(html_tree, "input[name=\"user[username]\"]")
assert label_elem = DOM.all(html_tree, "label[for=user_username]")
assert input_elem = DOM.all(html_tree, "input[name=\"user[username]\"]")
assert DOM.to_text(label_elem) =~ "Username"
assert DOM.attribute(input_elem, "type") == "text"
end
Expand Down Expand Up @@ -91,10 +91,10 @@ defmodule PowInvitation.Phoenix.InvitationControllerTest do

assert html = html_response(conn, 200)

html_tree = DOM.parse(html)
{html_tree, _} = DOM.parse_document(html)

assert [input_elem] = DOM.all(html_tree, "input[name=\"user[email]\"]")
assert [error_elem] = DOM.all(html_tree, "*[phx-feedback-for=\"user[email]\"] > p")
assert input_elem = DOM.all(html_tree, "input[name=\"user[email]\"]")
assert error_elem = DOM.all(html_tree, "*[phx-feedback-for=\"user[email]\"] > p")
assert DOM.attribute(input_elem, "value") == "invalid"
assert DOM.to_text(error_elem) =~ "has invalid format"
end
Expand All @@ -120,10 +120,10 @@ defmodule PowInvitation.Phoenix.InvitationControllerTest do

assert html = html_response(conn, 200)

html_tree = DOM.parse(html)
{html_tree, _} = DOM.parse_document(html)

assert [input_elem] = DOM.all(html_tree, "input[name=\"user[email]\"]")
assert [error_elem] = DOM.all(html_tree, "*[phx-feedback-for=\"user[email]\"] > p")
assert input_elem = DOM.all(html_tree, "input[name=\"user[email]\"]")
assert error_elem = DOM.all(html_tree, "*[phx-feedback-for=\"user[email]\"] > p")
assert DOM.attribute(input_elem, "value") == "[email protected]"
assert DOM.to_text(error_elem) =~ "has already been taken"
end
Expand Down Expand Up @@ -189,22 +189,22 @@ defmodule PowInvitation.Phoenix.InvitationControllerTest do

assert html = html_response(conn, 200)

html_tree = DOM.parse(html)
{html_tree, _} = DOM.parse_document(html)

assert [label_elem] = DOM.all(html_tree, "label[for=user_email]")
assert [input_elem] = DOM.all(html_tree, "input[name=\"user[email]\"]")
assert label_elem = DOM.all(html_tree, "label[for=user_email]")
assert input_elem = DOM.all(html_tree, "input[name=\"user[email]\"]")
assert DOM.to_text(label_elem) =~ "Email"
assert DOM.attribute(input_elem, "type") == "email"
assert DOM.attribute(input_elem, "required")

assert [label_elem] = DOM.all(html_tree, "label[for=user_password]")
assert [input_elem] = DOM.all(html_tree, "input[name=\"user[password]\"]")
assert label_elem = DOM.all(html_tree, "label[for=user_password]")
assert input_elem = DOM.all(html_tree, "input[name=\"user[password]\"]")
assert DOM.to_text(label_elem) =~ "Password"
assert DOM.attribute(input_elem, "type") == "password"
assert DOM.attribute(input_elem, "required")

assert [label_elem] = DOM.all(html_tree, "label[for=user_password_confirmation]")
assert [input_elem] = DOM.all(html_tree, "input[name=\"user[password_confirmation]\"]")
assert label_elem = DOM.all(html_tree, "label[for=user_password_confirmation]")
assert input_elem = DOM.all(html_tree, "input[name=\"user[password_confirmation]\"]")
assert DOM.to_text(label_elem) =~ "Confirm password"
assert DOM.attribute(input_elem, "type") == "password"
assert DOM.attribute(input_elem, "required")
Expand Down Expand Up @@ -253,10 +253,10 @@ defmodule PowInvitation.Phoenix.InvitationControllerTest do

assert html = html_response(conn, 200)

html_tree = DOM.parse(html)
{html_tree, _} = DOM.parse_document(html)

assert [input_elem] = DOM.all(html_tree, "input[name=\"user[email]\"]")
assert [error_elem] = DOM.all(html_tree, "*[phx-feedback-for=\"user[email]\"] > p")
assert input_elem = DOM.all(html_tree, "input[name=\"user[email]\"]")
assert error_elem = DOM.all(html_tree, "*[phx-feedback-for=\"user[email]\"] > p")
assert DOM.attribute(input_elem, "value") == "[email protected]"
assert DOM.to_text(error_elem) =~ "has already been taken"
end
Expand All @@ -266,15 +266,15 @@ defmodule PowInvitation.Phoenix.InvitationControllerTest do

assert html = html_response(conn, 200)

html_tree = DOM.parse(html)
{html_tree, _} = DOM.parse_document(html)

assert [input_elem] = DOM.all(html_tree, "input[name=\"user[email]\"]")
assert [error_elem] = DOM.all(html_tree, "*[phx-feedback-for=\"user[email]\"] > p")
assert input_elem = DOM.all(html_tree, "input[name=\"user[email]\"]")
assert error_elem = DOM.all(html_tree, "*[phx-feedback-for=\"user[email]\"] > p")
assert DOM.attribute(input_elem, "value") == "invalid"
assert DOM.to_text(error_elem) =~ "has invalid format"

assert [input_elem] = DOM.all(html_tree, "input[name=\"user[password_confirmation]\"]")
assert [error_elem] = DOM.all(html_tree, "*[phx-feedback-for=\"user[password_confirmation]\"] > p")
assert input_elem = DOM.all(html_tree, "input[name=\"user[password_confirmation]\"]")
assert error_elem = DOM.all(html_tree, "*[phx-feedback-for=\"user[password_confirmation]\"] > p")
assert DOM.attribute(input_elem, "value") == "invalid"
assert DOM.to_text(error_elem) =~ "does not match confirmation"

Expand Down
2 changes: 1 addition & 1 deletion test/extensions/reset_password/ecto/schema_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ defmodule PowResetPassword.Ecto.SchemaTest do
use Pow.Extension.Ecto.Schema,
extensions: [PowResetPassword]

@ecto_derive_inspect_for_redacted_fields false
@derive_inspect_for_redacted_fields false

schema "users" do
field :password_reset_at, :utc_datetime
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ defmodule PowResetPassword.Phoenix.ResetPasswordControllerTest do

assert html = html_response(conn, 200)

html_tree = DOM.parse(html)
{html_tree, _} = DOM.parse_document(html)

assert [label_elem] = DOM.all(html_tree, "label[for=user_email]")
assert [input_elem] = DOM.all(html_tree, "input[name=\"user[email]\"]")
assert label_elem = DOM.all(html_tree, "label[for=user_email]")
assert input_elem = DOM.all(html_tree, "input[name=\"user[email]\"]")
assert DOM.to_text(label_elem) =~ "Email"
assert DOM.attribute(input_elem, "type") == "email"
refute DOM.attribute(input_elem, "value")
Expand Down Expand Up @@ -79,9 +79,9 @@ defmodule PowResetPassword.Phoenix.ResetPasswordControllerTest do
assert html = html_response(conn, 200)
assert get_flash(conn, :error) == "No account exists for the provided email. Please try again."

html_tree = DOM.parse(html)
{html_tree, _} = DOM.parse_document(html)

assert [input_elem] = DOM.all(html_tree, "input[name=\"user[email]\"]")
assert input_elem = DOM.all(html_tree, "input[name=\"user[email]\"]")
assert DOM.attribute(input_elem, "value") == "[email protected]"
end
end
Expand Down Expand Up @@ -122,21 +122,21 @@ defmodule PowResetPassword.Phoenix.ResetPasswordControllerTest do

assert html = html_response(conn, 200)

html_tree = DOM.parse(html)
{html_tree, _} = DOM.parse_document(html)

assert [label_elem] = DOM.all(html_tree, "label[for=user_password]")
assert [input_elem] = DOM.all(html_tree, "input[name=\"user[password]\"]")
assert label_elem = DOM.all(html_tree, "label[for=user_password]")
assert input_elem = DOM.all(html_tree, "input[name=\"user[password]\"]")
assert DOM.to_text(label_elem) =~ "New password"
assert DOM.attribute(input_elem, "type") == "password"
assert DOM.attribute(input_elem, "required")

assert [label_elem] = DOM.all(html_tree, "label[for=user_password_confirmation]")
assert [input_elem] = DOM.all(html_tree, "input[name=\"user[password_confirmation]\"]")
assert label_elem = DOM.all(html_tree, "label[for=user_password_confirmation]")
assert input_elem = DOM.all(html_tree, "input[name=\"user[password_confirmation]\"]")
assert DOM.to_text(label_elem) =~ "Confirm new password"
assert DOM.attribute(input_elem, "type") == "password"
assert DOM.attribute(input_elem, "required")

assert [_] = DOM.all(html, "a[href=\"/session/new\"]")
assert _ = DOM.all(html_tree, "a[href=\"/session/new\"]")
end
end

Expand Down Expand Up @@ -188,13 +188,13 @@ defmodule PowResetPassword.Phoenix.ResetPasswordControllerTest do

assert html = html_response(conn, 200)

html_tree = DOM.parse(html)
{html_tree, _} = DOM.parse_document(html)

assert [input_elem] = DOM.all(html_tree, "input[name=\"user[password]\"]")
assert input_elem = DOM.all(html_tree, "input[name=\"user[password]\"]")
assert DOM.attribute(input_elem, "value") == @password

assert [input_elem] = DOM.all(html_tree, "input[name=\"user[password_confirmation]\"]")
assert [error_elem] = DOM.all(html_tree, "*[phx-feedback-for=\"user[password_confirmation]\"] > p")
assert input_elem = DOM.all(html_tree, "input[name=\"user[password_confirmation]\"]")
assert error_elem = DOM.all(html_tree, "*[phx-feedback-for=\"user[password_confirmation]\"] > p")
assert DOM.attribute(input_elem, "value") == "invalid"
assert DOM.to_text(error_elem) =~ "does not match confirmation"

Expand Down
2 changes: 1 addition & 1 deletion test/pow/ecto/context_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ defmodule Pow.Ecto.ContextTest do
use Ecto.Schema
use Pow.Ecto.Schema, password_hash_verify: {&__MODULE__.send_hash_password/1, &__MODULE__.send_verify_password/2}

@ecto_derive_inspect_for_redacted_fields false
@derive_inspect_for_redacted_fields false

alias Pow.Ecto.Schema.Password

Expand Down
2 changes: 1 addition & 1 deletion test/pow/ecto/schema/changeset_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ defmodule Pow.Ecto.Schema.ChangesetTest do
use Ecto.Schema
use Pow.Ecto.Schema

@ecto_derive_inspect_for_redacted_fields false
@derive_inspect_for_redacted_fields false

schema "users" do
pow_user_fields()
Expand Down
6 changes: 3 additions & 3 deletions test/pow/ecto/schema_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ defmodule Pow.Ecto.SchemaTest do
use Ecto.Schema
use Pow.Ecto.Schema

@ecto_derive_inspect_for_redacted_fields false
@derive_inspect_for_redacted_fields false

schema "users" do
field :password_hash, :string, source: :encrypted_password
Expand All @@ -49,7 +49,7 @@ defmodule Pow.Ecto.SchemaTest do
use Ecto.Schema
use Pow.Ecto.Schema

@ecto_derive_inspect_for_redacted_fields false
@derive_inspect_for_redacted_fields false

@pow_assocs {:has_many, :users, __MODULE__, []}

Expand Down Expand Up @@ -159,7 +159,7 @@ defmodule Pow.Ecto.SchemaTest do
use Ecto.Schema
use Pow.Ecto.Schema

@ecto_derive_inspect_for_redacted_fields false
@derive_inspect_for_redacted_fields false

schema "users" do
field :email, CustomType
Expand Down
4 changes: 2 additions & 2 deletions test/pow/extension/ecto/schema_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ defmodule Pow.Extension.Ecto.SchemaTest do
use Pow.Extension.Ecto.Schema,
extensions: [Pow.Extension.Ecto.SchemaTest.ExtensionMock]

@ecto_derive_inspect_for_redacted_fields false
@derive_inspect_for_redacted_fields false

schema "users" do
pow_user_fields()
Expand All @@ -83,7 +83,7 @@ defmodule Pow.Extension.Ecto.SchemaTest do
use Pow.Extension.Ecto.Schema,
extensions: [Pow.Extension.Ecto.SchemaTest.ExtensionMock]

@ecto_derive_inspect_for_redacted_fields false
@derive_inspect_for_redacted_fields false

schema "users" do
pow_user_fields()
Expand Down
3 changes: 2 additions & 1 deletion test/pow/extension/phoenix/router_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ defmodule Pow.Extension.Phoenix.RouterTest do

# To prevent the `TestController.init/1 is undefined` warnings
defmodule ExtensionMock.Phoenix.TestController do
use Phoenix.Controller, namespace: Pow.Extension.Phoenix.RouterTest
use Phoenix.Controller, formats: []
plug :put_layout, html: Pow.Extension.Phoenix.RouterTest.LayoutView
end

defmodule ExtensionMock.Phoenix.Router do
Expand Down
Loading