diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 64f70a43..5c348f3d 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -14,15 +14,6 @@ jobs:
fail-fast: false
matrix:
include:
- - elixir: 1.8.2
- otp: 21.3.8.17
- - elixir: 1.9.4
- otp: 21.3.8.17
- warnings_as_errors: true # not 1.10 as its --warnigs-as-errors has bugs https://github.com/elixir-lang/elixir/issues/10073
- - elixir: 1.10.4
- otp: 21.3.8.17
- - elixir: 1.10.4
- otp: 23.1.1
- elixir: 1.11.1
otp: 21.3.8.17
- elixir: 1.11.4
diff --git a/lib/surface/api.ex b/lib/surface/api.ex
index 1f01f222..e9690fee 100644
--- a/lib/surface/api.ex
+++ b/lib/surface/api.ex
@@ -421,9 +421,11 @@ defmodule Surface.API do
end
defp validate_opt(_func, _name, _type, _opts, :values, value, _caller)
- when not is_list(value) do
+ when not is_list(value) and not is_struct(value, Range) do
{:error,
- "invalid value for option :values. Expected a list of values, got: #{inspect(value)}"}
+ "invalid value for option :values. Expected a list of values or a Range, got: #{
+ inspect(value)
+ }"}
end
defp validate_opt(:prop, _name, _type, _opts, :accumulate, value, _caller)
diff --git a/mix.exs b/mix.exs
index e508d4b0..2fb833bb 100644
--- a/mix.exs
+++ b/mix.exs
@@ -7,7 +7,7 @@ defmodule Surface.MixProject do
[
app: :surface,
version: @version,
- elixir: "~> 1.8",
+ elixir: "~> 1.11",
description: "A component based library for Phoenix LiveView",
elixirc_paths: elixirc_paths(Mix.env()),
compilers: [:phoenix] ++ Mix.compilers(),
diff --git a/test/api_test.exs b/test/api_test.exs
index a5e8ceb6..4f726c8d 100644
--- a/test/api_test.exs
+++ b/test/api_test.exs
@@ -45,11 +45,20 @@ defmodule Surface.APITest do
test "validate :values" do
code = "prop label, :string, values: 1"
- message = ~r/invalid value for option :values. Expected a list of values, got: 1/
+ message = ~r/invalid value for option :values. Expected a list of values or a Range, got: 1/
assert_raise(CompileError, message, fn -> eval(code) end)
end
+ test "validate :values when using a range" do
+ code = """
+ prop age, :integer, values: 1..100
+ data items, :integer, values: 1..3
+ """
+
+ {:ok, _module} = eval(code)
+ end
+
test "validate :as in slot" do
code = "slot label, as: \"default_label\""
message = ~r/invalid value for option :as in slot. Expected an atom, got: \"default_label\"/
diff --git a/test/components/form/label_test.exs b/test/components/form/label_test.exs
index 849787aa..23161b3a 100644
--- a/test/components/form/label_test.exs
+++ b/test/components/form/label_test.exs
@@ -98,17 +98,13 @@ defmodule Surface.Components.Form.LabelTest do
html = render_surface(do: ~H[])
assert html =~ ~r[]s
- html =
- render_surface(
- do: ~H[]
- )
+ html = render_surface(do: ~H[])
assert html =~ ~r[]s
html =
render_surface(
- do:
- ~H[]
+ do: ~H[]
)
assert html =~ ~r[]s
@@ -120,8 +116,7 @@ defmodule Surface.Components.Form.LabelTest do
html =
render_surface(
- do:
- ~H[]
+ do: ~H[]
)
assert html =~ ~r[]s
@@ -169,8 +164,7 @@ defmodule Surface.Components.Form.LabelTest do
test "with field and inline safe content" do
html =
render_surface(
- do:
- ~H[