chore: Fix fragile tests that relied on semantic-ui classes
This commit is contained in:
parent
97eabcc875
commit
3e1d8d3f3a
3 changed files with 4 additions and 14 deletions
|
@ -1,5 +1,5 @@
|
||||||
<%%= form_for @changeset, @action, [class: "ui large form"], fn f -> %>
|
<%%= form_for @changeset, @action, [class: "ui large form"], fn f -> %>
|
||||||
<div class="ui stacked left aligned segment">
|
<div>
|
||||||
<%= for input <- Mix.Legendary.inputs(schema) do %>
|
<%= for input <- Mix.Legendary.inputs(schema) do %>
|
||||||
<%= input %>
|
<%= input %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
@ -46,15 +46,9 @@ defmodule CoreWeb.Helpers do
|
||||||
"""
|
"""
|
||||||
end
|
end
|
||||||
|
|
||||||
def styled_input(f, field, opts \\ [], options \\ nil) do
|
def styled_input(f, field, opts \\ [], options \\ nil, block_list \\ []) do
|
||||||
styled_input(f, field, opts, options) do
|
{content, _} = Keyword.pop(block_list, :do, "")
|
||||||
""
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def styled_input(f, field, opts, options, do: content) do
|
|
||||||
{type, rest_opts} = Keyword.pop(opts, :type, input_type(f, field))
|
{type, rest_opts} = Keyword.pop(opts, :type, input_type(f, field))
|
||||||
IO.inspect(type)
|
|
||||||
{icon, rest_opts} = Keyword.pop(rest_opts, :icon, "")
|
{icon, rest_opts} = Keyword.pop(rest_opts, :icon, "")
|
||||||
{classes, rest_opts} = Keyword.pop(rest_opts, :class, default_classes_for_type(type))
|
{classes, rest_opts} = Keyword.pop(rest_opts, :class, default_classes_for_type(type))
|
||||||
{label_text, rest_opts} = Keyword.pop(rest_opts, :label)
|
{label_text, rest_opts} = Keyword.pop(rest_opts, :label)
|
||||||
|
|
|
@ -74,13 +74,12 @@ defmodule CoreWeb.HelpersTest do
|
||||||
|> flash_block()
|
|> flash_block()
|
||||||
|> safe_to_string()
|
|> safe_to_string()
|
||||||
|
|
||||||
assert markup =~ "ui negative message"
|
assert markup =~ "js-flash"
|
||||||
end
|
end
|
||||||
|
|
||||||
test "styled_input/4 (without error)" do
|
test "styled_input/4 (without error)" do
|
||||||
markup = safe_to_string(styled_input(form(), :no_error_field))
|
markup = safe_to_string(styled_input(form(), :no_error_field))
|
||||||
|
|
||||||
assert markup =~ ~S{<div class="field "}
|
|
||||||
assert markup =~ "<input"
|
assert markup =~ "<input"
|
||||||
assert markup =~ "<label"
|
assert markup =~ "<label"
|
||||||
end
|
end
|
||||||
|
@ -88,10 +87,8 @@ defmodule CoreWeb.HelpersTest do
|
||||||
test "styled_input/4 (with error)" do
|
test "styled_input/4 (with error)" do
|
||||||
markup = safe_to_string(styled_input(form(), :error_field))
|
markup = safe_to_string(styled_input(form(), :error_field))
|
||||||
|
|
||||||
assert markup =~ ~S{<div class="field error"}
|
|
||||||
assert markup =~ "<input"
|
assert markup =~ "<input"
|
||||||
assert markup =~ "<label"
|
assert markup =~ "<label"
|
||||||
assert markup =~ "ui pointing red basic label"
|
|
||||||
end
|
end
|
||||||
|
|
||||||
test "styled_input/5 with content" do
|
test "styled_input/5 with content" do
|
||||||
|
@ -104,7 +101,6 @@ defmodule CoreWeb.HelpersTest do
|
||||||
end
|
end
|
||||||
|> safe_to_string()
|
|> safe_to_string()
|
||||||
|
|
||||||
assert markup =~ ~S{<div class="field "}
|
|
||||||
assert markup =~ "<select"
|
assert markup =~ "<select"
|
||||||
assert markup =~ "<label"
|
assert markup =~ "<label"
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue