From de9e86b7f667248dd37e48364d3eb10340985fa0 Mon Sep 17 00:00:00 2001
From: phgrey
Date: Fri, 14 Jul 2023 08:14:34 +0200
Subject: [PATCH 01/11] tests initiated
---
README.md | 9 +++++
lib/moon/design/dropdown/options.ex | 1 +
mix.exs | 1 +
mix.lock | 3 ++
test/moon/design/dropdown_test.exs | 1 +
.../examples/dropdown/default_test.exs | 40 +++++++++++++++++++
test/test_helper.exs | 1 +
7 files changed, 56 insertions(+)
create mode 100644 test/moon/design/dropdown_test.exs
create mode 100644 test/moon_web/examples/dropdown/default_test.exs
diff --git a/README.md b/README.md
index fbd942351..03f32e0b4 100644
--- a/README.md
+++ b/README.md
@@ -102,3 +102,12 @@ alias Moon.Assets.Icons.IconZoom
```bash
mix test
```
+
+## Screenshots & tests at all
+1. https://github.com/mcrumm/elogram/blob/main/lib/elogram/server.ex#L31
+also some screenshot tests here -
+https://stackoverflow.com/questions/58131559/how-to-take-a-screenshot-on-failure-using-hound-elixir
+https://github.com/HashNuke/hound - maybe too old
+
+https://elixirforum.com/t/wallaby-visit-produces-empty-screenshot/45268
+https://github.com/elixir-wallaby/wallaby#screenshots
\ No newline at end of file
diff --git a/lib/moon/design/dropdown/options.ex b/lib/moon/design/dropdown/options.ex
index 483e6039c..c59abe7f3 100644
--- a/lib/moon/design/dropdown/options.ex
+++ b/lib/moon/design/dropdown/options.ex
@@ -44,6 +44,7 @@ defmodule Moon.Design.Dropdown.Options do
])}
{=@id}
data-testid={@testid}
+ role="listbox"
>
{#if slot_assigned?(:option)}
{#for {option, index} <- Enum.with_index(make_list(@option))}
diff --git a/mix.exs b/mix.exs
index d4a7d839e..f97ccaf3a 100644
--- a/mix.exs
+++ b/mix.exs
@@ -95,6 +95,7 @@ defmodule Moon.MixProject do
{:excoveralls, "~> 0.10", only: :test},
{:floki, ">= 0.27.0", only: :test},
{:snapshy, "~> 0.3.0", only: :test},
+ {:elogram, path: "../elogram"},
# dev
{:credo, "~> 1.5", only: [:dev, :test], runtime: false},
diff --git a/mix.lock b/mix.lock
index 9e41fdb10..0d07ab6bf 100644
--- a/mix.lock
+++ b/mix.lock
@@ -3,6 +3,7 @@
"bunt": {:hex, :bunt, "0.2.1", "e2d4792f7bc0ced7583ab54922808919518d0e57ee162901a16a1b6664ef3b14", [:mix], [], "hexpm", "a330bfb4245239787b15005e66ae6845c9cd524a288f0d141c148b02603777a5"},
"castore": {:hex, :castore, "1.0.3", "7130ba6d24c8424014194676d608cb989f62ef8039efd50ff4b3f33286d06db8", [:mix], [], "hexpm", "680ab01ef5d15b161ed6a95449fac5c6b8f60055677a8e79acf01b27baa4390b"},
"certifi": {:hex, :certifi, "2.9.0", "6f2a475689dd47f19fb74334859d460a2dc4e3252a3324bd2111b8f0429e7e21", [:rebar3], [], "hexpm", "266da46bdb06d6c6d35fde799bcb28d36d985d424ad7c08b5bb48f5b5cdd4641"},
+ "chrome_remote_interface": {:hex, :chrome_remote_interface, "0.4.1", "3fa70207f223fe7021db5e9196dcb72fba405821fb380443ef6d0fa80060c70c", [:mix], [{:hackney, "~> 1.6", [hex: :hackney, repo: "hexpm", optional: false]}, {:jason, "~> 1.1", [hex: :jason, repo: "hexpm", optional: false]}, {:websockex, "~> 0.4.0", [hex: :websockex, repo: "hexpm", optional: false]}], "hexpm", "79f8b617eb975b272cbd30b7fe10cc41bb45a1ada37996d93b81f05a251962fb"},
"combine": {:hex, :combine, "0.10.0", "eff8224eeb56498a2af13011d142c5e7997a80c8f5b97c499f84c841032e429f", [:mix], [], "hexpm", "1b1dbc1790073076580d0d1d64e42eae2366583e7aecd455d1215b0d16f2451b"},
"cowboy": {:hex, :cowboy, "2.10.0", "ff9ffeff91dae4ae270dd975642997afe2a1179d94b1887863e43f681a203e26", [:make, :rebar3], [{:cowlib, "2.12.1", [hex: :cowlib, repo: "hexpm", optional: false]}, {:ranch, "1.8.0", [hex: :ranch, repo: "hexpm", optional: false]}], "hexpm", "3afdccb7183cc6f143cb14d3cf51fa00e53db9ec80cdcd525482f5e99bc41d6b"},
"cowboy_telemetry": {:hex, :cowboy_telemetry, "0.4.0", "f239f68b588efa7707abce16a84d0d2acf3a0f50571f8bb7f56a15865aae820c", [:rebar3], [{:cowboy, "~> 2.7", [hex: :cowboy, repo: "hexpm", optional: false]}, {:telemetry, "~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "7d98bac1ee4565d31b62d59f8823dfd8356a169e7fcbb83831b8a5397404c9de"},
@@ -35,6 +36,7 @@
"mimerl": {:hex, :mimerl, "1.2.0", "67e2d3f571088d5cfd3e550c383094b47159f3eee8ffa08e64106cdf5e981be3", [:rebar3], [], "hexpm", "f278585650aa581986264638ebf698f8bb19df297f66ad91b18910dfc6e19323"},
"moon_icons": {:hex, :moon_icons, "0.2.6", "a3cc436ed5388392068e20b9cbe25f783e9b254a10e373ce3947c34bdaddbf7a", [:mix], [{:surface, ">= 0.9.1", [hex: :surface, repo: "hexpm", optional: false]}], "hexpm", "6b79a50f6cc673dd58d2f6f1b99985c33f1a5f4ea9fc332330e5a00366e25b98"},
"nimble_parsec": {:hex, :nimble_parsec, "1.3.1", "2c54013ecf170e249e9291ed0a62e5832f70a476c61da16f6aac6dca0189f2af", [:mix], [], "hexpm", "2682e3c0b2eb58d90c6375fc0cc30bc7be06f365bf72608804fb9cffa5e1b167"},
+ "nimble_pool": {:hex, :nimble_pool, "0.2.6", "91f2f4c357da4c4a0a548286c84a3a28004f68f05609b4534526871a22053cde", [:mix], [], "hexpm", "1c715055095d3f2705c4e236c18b618420a35490da94149ff8b580a2144f653f"},
"parse_trans": {:hex, :parse_trans, "3.3.1", "16328ab840cc09919bd10dab29e431da3af9e9e7e7e6f0089dd5a2d2820011d8", [:rebar3], [], "hexpm", "07cd9577885f56362d414e8c4c4e6bdf10d43a8767abb92d24cbe8b24c54888b"},
"phoenix": {:hex, :phoenix, "1.7.6", "61f0625af7c1d1923d582470446de29b008c0e07ae33d7a3859ede247ddaf59a", [:mix], [{:castore, ">= 0.0.0", [hex: :castore, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:phoenix_pubsub, "~> 2.1", [hex: :phoenix_pubsub, repo: "hexpm", optional: false]}, {:phoenix_template, "~> 1.0", [hex: :phoenix_template, repo: "hexpm", optional: false]}, {:phoenix_view, "~> 2.0", [hex: :phoenix_view, repo: "hexpm", optional: true]}, {:plug, "~> 1.14", [hex: :plug, repo: "hexpm", optional: false]}, {:plug_cowboy, "~> 2.6", [hex: :plug_cowboy, repo: "hexpm", optional: true]}, {:plug_crypto, "~> 1.2", [hex: :plug_crypto, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}, {:websock_adapter, "~> 0.5.3", [hex: :websock_adapter, repo: "hexpm", optional: false]}], "hexpm", "f6b4be7780402bb060cbc6e83f1b6d3f5673b674ba73cc4a7dd47db0322dfb88"},
"phoenix_ecto": {:hex, :phoenix_ecto, "4.4.2", "b21bd01fdeffcfe2fab49e4942aa938b6d3e89e93a480d4aee58085560a0bc0d", [:mix], [{:ecto, "~> 3.5", [hex: :ecto, repo: "hexpm", optional: false]}, {:phoenix_html, "~> 2.14.2 or ~> 3.0", [hex: :phoenix_html, repo: "hexpm", optional: true]}, {:plug, "~> 1.9", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "70242edd4601d50b69273b057ecf7b684644c19ee750989fd555625ae4ce8f5d"},
@@ -62,4 +64,5 @@
"vega_lite": {:hex, :vega_lite, "0.1.7", "1f1ad850821335702958f7351ca52808a5a109f9ce35fd5c14f9613970bad140", [:mix], [{:table, "~> 0.1.0", [hex: :table, repo: "hexpm", optional: false]}], "hexpm", "3932382ed5ad77c08c27abc45137257e9a86897916cef1a0da148632c6a91e30"},
"websock": {:hex, :websock, "0.5.2", "b3c08511d8d79ed2c2f589ff430bd1fe799bb389686dafce86d28801783d8351", [:mix], [], "hexpm", "925f5de22fca6813dfa980fb62fd542ec43a2d1a1f83d2caec907483fe66ff05"},
"websock_adapter": {:hex, :websock_adapter, "0.5.3", "4908718e42e4a548fc20e00e70848620a92f11f7a6add8cf0886c4232267498d", [:mix], [{:bandit, ">= 0.6.0", [hex: :bandit, repo: "hexpm", optional: true]}, {:plug, "~> 1.14", [hex: :plug, repo: "hexpm", optional: false]}, {:plug_cowboy, "~> 2.6", [hex: :plug_cowboy, repo: "hexpm", optional: true]}, {:websock, "~> 0.5", [hex: :websock, repo: "hexpm", optional: false]}], "hexpm", "cbe5b814c1f86b6ea002b52dd99f345aeecf1a1a6964e209d208fb404d930d3d"},
+ "websockex": {:hex, :websockex, "0.4.3", "92b7905769c79c6480c02daacaca2ddd49de936d912976a4d3c923723b647bf0", [:mix], [], "hexpm", "95f2e7072b85a3a4cc385602d42115b73ce0b74a9121d0d6dbbf557645ac53e4"},
}
diff --git a/test/moon/design/dropdown_test.exs b/test/moon/design/dropdown_test.exs
new file mode 100644
index 000000000..07441eb1d
--- /dev/null
+++ b/test/moon/design/dropdown_test.exs
@@ -0,0 +1 @@
+# TODO: try to use live_isolated or https://github.com/Serabe/live_isolated_component or https://gist.github.com/mcrumm/8e6b0a98196dd74a841d850c70805f50
diff --git a/test/moon_web/examples/dropdown/default_test.exs b/test/moon_web/examples/dropdown/default_test.exs
new file mode 100644
index 000000000..67dbaf117
--- /dev/null
+++ b/test/moon_web/examples/dropdown/default_test.exs
@@ -0,0 +1,40 @@
+defmodule MoonWeb.Examples.Dropdown.DefaultTest do
+ use MoonWeb.ConnCase, async: true
+
+ import Elogram.CaptureScreenshot
+
+ test "should open", %{conn: conn} do
+ {:ok, view, _html} = live(conn, "/example/DropdownExample.Default")
+
+ assert view
+ |> capture_screenshot(name: "default01.png")
+ |> element("#dropdown-02 div[aria-haspopup=true]")
+ |> render() =~ "Choose name..."
+
+ assert view |> element("#dropdown-02 div.hidden[role=listbox]") |> has_element?()
+
+ view
+ |> element("#dropdown-02 div[aria-haspopup=true]")
+ |> render_click()
+
+ assert view |> element("#dropdown-02 div[role=listbox]") |> has_element?()
+ refute view |> element("#dropdown-02 div.hidden[role=listbox]") |> has_element?()
+ end
+
+ test "should select", %{conn: conn} do
+ {:ok, view, _html} = live(conn, "/example/DropdownExample.Default")
+
+ select = view |> element("#dropdown-02 div[aria-haspopup=true]")
+ assert select |> render() =~ "Choose name..."
+
+ select |> render_click()
+
+ view
+ |> element("#dropdown-02 div[role=listbox] button:first-child")
+ |> render_click()
+
+ assert select |> render() =~ "Wade Cooper"
+
+ assert view |> element("#dropdown-02 div.hidden[role=listbox]") |> has_element?()
+ end
+end
diff --git a/test/test_helper.exs b/test/test_helper.exs
index 869559e70..b9bd48856 100644
--- a/test/test_helper.exs
+++ b/test/test_helper.exs
@@ -1 +1,2 @@
+Elogram.start([])
ExUnit.start()
From 9c0b0b795dd4f3ca046f891c5eb4eb55549b39b7 Mon Sep 17 00:00:00 2001
From: phgrey
Date: Mon, 24 Jul 2023 16:42:49 +0200
Subject: [PATCH 02/11] fix: initiating example tests
---
mix.exs | 1 -
test/moon_web/examples/dropdown/default_test.exs | 2 --
test/test_helper.exs | 1 -
3 files changed, 4 deletions(-)
diff --git a/mix.exs b/mix.exs
index f97ccaf3a..d4a7d839e 100644
--- a/mix.exs
+++ b/mix.exs
@@ -95,7 +95,6 @@ defmodule Moon.MixProject do
{:excoveralls, "~> 0.10", only: :test},
{:floki, ">= 0.27.0", only: :test},
{:snapshy, "~> 0.3.0", only: :test},
- {:elogram, path: "../elogram"},
# dev
{:credo, "~> 1.5", only: [:dev, :test], runtime: false},
diff --git a/test/moon_web/examples/dropdown/default_test.exs b/test/moon_web/examples/dropdown/default_test.exs
index 67dbaf117..b60a4b7b4 100644
--- a/test/moon_web/examples/dropdown/default_test.exs
+++ b/test/moon_web/examples/dropdown/default_test.exs
@@ -1,13 +1,11 @@
defmodule MoonWeb.Examples.Dropdown.DefaultTest do
use MoonWeb.ConnCase, async: true
- import Elogram.CaptureScreenshot
test "should open", %{conn: conn} do
{:ok, view, _html} = live(conn, "/example/DropdownExample.Default")
assert view
- |> capture_screenshot(name: "default01.png")
|> element("#dropdown-02 div[aria-haspopup=true]")
|> render() =~ "Choose name..."
diff --git a/test/test_helper.exs b/test/test_helper.exs
index b9bd48856..869559e70 100644
--- a/test/test_helper.exs
+++ b/test/test_helper.exs
@@ -1,2 +1 @@
-Elogram.start([])
ExUnit.start()
From b7bc1905a5297d06772e57582ef5d28c1b379ec2 Mon Sep 17 00:00:00 2001
From: phgrey
Date: Mon, 24 Jul 2023 16:57:45 +0200
Subject: [PATCH 03/11] formattings fix
---
test/moon_web/examples/dropdown/default_test.exs | 1 -
1 file changed, 1 deletion(-)
diff --git a/test/moon_web/examples/dropdown/default_test.exs b/test/moon_web/examples/dropdown/default_test.exs
index b60a4b7b4..f8a22bd3d 100644
--- a/test/moon_web/examples/dropdown/default_test.exs
+++ b/test/moon_web/examples/dropdown/default_test.exs
@@ -1,7 +1,6 @@
defmodule MoonWeb.Examples.Dropdown.DefaultTest do
use MoonWeb.ConnCase, async: true
-
test "should open", %{conn: conn} do
{:ok, view, _html} = live(conn, "/example/DropdownExample.Default")
From df7645795aee1a0fdd72250be0d9e55776feb608 Mon Sep 17 00:00:00 2001
From: Triin Kullisaar <95503530+tkullisaar@users.noreply.github.com>
Date: Thu, 27 Jul 2023 11:51:18 +0300
Subject: [PATCH 04/11] trigger elements tests and structure
---
.../examples/dropdown/datepicker_test.exs | 0
.../option_layouts/select_countries_test.exs | 0
.../option_layouts/select_language_test.exs | 0
.../dropdown/option_layouts/sort_by_test.exs | 0
.../dropdown/positions/bottom_end_test.exs | 0
.../dropdown/positions/bottom_start_test.exs | 0
.../dropdown/positions/bottom_test.exs | 0
.../dropdown/positions/left_end_test.exs | 0
.../dropdown/positions/left_start_test.exs | 0
.../examples/dropdown/positions/left_test.exs | 0
.../dropdown/positions/right_end_test.exs | 0
.../dropdown/positions/right_start_test.exs | 0
.../dropdown/positions/right_test.exs | 0
.../dropdown/positions/top_end_test.exs | 0
.../dropdown/positions/top_start_test.exs | 0
.../examples/dropdown/positions/top_test.exs | 0
.../dropdown/responsive_dropdown_test.exs | 0
.../examples/dropdown/sizes/lg_test.exs | 0
.../examples/dropdown/sizes/md_test.exs | 0
.../examples/dropdown/sizes/sm_test.exs | 0
.../dropdown/trigger_elements/button_test.exs | 37 +++++++++++++++++
.../trigger_elements/chip_with_arrow_test.exs | 40 +++++++++++++++++++
.../trigger_elements/icon_button_test.exs | 40 +++++++++++++++++++
23 files changed, 117 insertions(+)
create mode 100644 test/moon_web/examples/dropdown/datepicker_test.exs
create mode 100644 test/moon_web/examples/dropdown/option_layouts/select_countries_test.exs
create mode 100644 test/moon_web/examples/dropdown/option_layouts/select_language_test.exs
create mode 100644 test/moon_web/examples/dropdown/option_layouts/sort_by_test.exs
create mode 100644 test/moon_web/examples/dropdown/positions/bottom_end_test.exs
create mode 100644 test/moon_web/examples/dropdown/positions/bottom_start_test.exs
create mode 100644 test/moon_web/examples/dropdown/positions/bottom_test.exs
create mode 100644 test/moon_web/examples/dropdown/positions/left_end_test.exs
create mode 100644 test/moon_web/examples/dropdown/positions/left_start_test.exs
create mode 100644 test/moon_web/examples/dropdown/positions/left_test.exs
create mode 100644 test/moon_web/examples/dropdown/positions/right_end_test.exs
create mode 100644 test/moon_web/examples/dropdown/positions/right_start_test.exs
create mode 100644 test/moon_web/examples/dropdown/positions/right_test.exs
create mode 100644 test/moon_web/examples/dropdown/positions/top_end_test.exs
create mode 100644 test/moon_web/examples/dropdown/positions/top_start_test.exs
create mode 100644 test/moon_web/examples/dropdown/positions/top_test.exs
create mode 100644 test/moon_web/examples/dropdown/responsive_dropdown_test.exs
create mode 100644 test/moon_web/examples/dropdown/sizes/lg_test.exs
create mode 100644 test/moon_web/examples/dropdown/sizes/md_test.exs
create mode 100644 test/moon_web/examples/dropdown/sizes/sm_test.exs
create mode 100644 test/moon_web/examples/dropdown/trigger_elements/button_test.exs
create mode 100644 test/moon_web/examples/dropdown/trigger_elements/chip_with_arrow_test.exs
create mode 100644 test/moon_web/examples/dropdown/trigger_elements/icon_button_test.exs
diff --git a/test/moon_web/examples/dropdown/datepicker_test.exs b/test/moon_web/examples/dropdown/datepicker_test.exs
new file mode 100644
index 000000000..e69de29bb
diff --git a/test/moon_web/examples/dropdown/option_layouts/select_countries_test.exs b/test/moon_web/examples/dropdown/option_layouts/select_countries_test.exs
new file mode 100644
index 000000000..e69de29bb
diff --git a/test/moon_web/examples/dropdown/option_layouts/select_language_test.exs b/test/moon_web/examples/dropdown/option_layouts/select_language_test.exs
new file mode 100644
index 000000000..e69de29bb
diff --git a/test/moon_web/examples/dropdown/option_layouts/sort_by_test.exs b/test/moon_web/examples/dropdown/option_layouts/sort_by_test.exs
new file mode 100644
index 000000000..e69de29bb
diff --git a/test/moon_web/examples/dropdown/positions/bottom_end_test.exs b/test/moon_web/examples/dropdown/positions/bottom_end_test.exs
new file mode 100644
index 000000000..e69de29bb
diff --git a/test/moon_web/examples/dropdown/positions/bottom_start_test.exs b/test/moon_web/examples/dropdown/positions/bottom_start_test.exs
new file mode 100644
index 000000000..e69de29bb
diff --git a/test/moon_web/examples/dropdown/positions/bottom_test.exs b/test/moon_web/examples/dropdown/positions/bottom_test.exs
new file mode 100644
index 000000000..e69de29bb
diff --git a/test/moon_web/examples/dropdown/positions/left_end_test.exs b/test/moon_web/examples/dropdown/positions/left_end_test.exs
new file mode 100644
index 000000000..e69de29bb
diff --git a/test/moon_web/examples/dropdown/positions/left_start_test.exs b/test/moon_web/examples/dropdown/positions/left_start_test.exs
new file mode 100644
index 000000000..e69de29bb
diff --git a/test/moon_web/examples/dropdown/positions/left_test.exs b/test/moon_web/examples/dropdown/positions/left_test.exs
new file mode 100644
index 000000000..e69de29bb
diff --git a/test/moon_web/examples/dropdown/positions/right_end_test.exs b/test/moon_web/examples/dropdown/positions/right_end_test.exs
new file mode 100644
index 000000000..e69de29bb
diff --git a/test/moon_web/examples/dropdown/positions/right_start_test.exs b/test/moon_web/examples/dropdown/positions/right_start_test.exs
new file mode 100644
index 000000000..e69de29bb
diff --git a/test/moon_web/examples/dropdown/positions/right_test.exs b/test/moon_web/examples/dropdown/positions/right_test.exs
new file mode 100644
index 000000000..e69de29bb
diff --git a/test/moon_web/examples/dropdown/positions/top_end_test.exs b/test/moon_web/examples/dropdown/positions/top_end_test.exs
new file mode 100644
index 000000000..e69de29bb
diff --git a/test/moon_web/examples/dropdown/positions/top_start_test.exs b/test/moon_web/examples/dropdown/positions/top_start_test.exs
new file mode 100644
index 000000000..e69de29bb
diff --git a/test/moon_web/examples/dropdown/positions/top_test.exs b/test/moon_web/examples/dropdown/positions/top_test.exs
new file mode 100644
index 000000000..e69de29bb
diff --git a/test/moon_web/examples/dropdown/responsive_dropdown_test.exs b/test/moon_web/examples/dropdown/responsive_dropdown_test.exs
new file mode 100644
index 000000000..e69de29bb
diff --git a/test/moon_web/examples/dropdown/sizes/lg_test.exs b/test/moon_web/examples/dropdown/sizes/lg_test.exs
new file mode 100644
index 000000000..e69de29bb
diff --git a/test/moon_web/examples/dropdown/sizes/md_test.exs b/test/moon_web/examples/dropdown/sizes/md_test.exs
new file mode 100644
index 000000000..e69de29bb
diff --git a/test/moon_web/examples/dropdown/sizes/sm_test.exs b/test/moon_web/examples/dropdown/sizes/sm_test.exs
new file mode 100644
index 000000000..e69de29bb
diff --git a/test/moon_web/examples/dropdown/trigger_elements/button_test.exs b/test/moon_web/examples/dropdown/trigger_elements/button_test.exs
new file mode 100644
index 000000000..8afa578b4
--- /dev/null
+++ b/test/moon_web/examples/dropdown/trigger_elements/button_test.exs
@@ -0,0 +1,37 @@
+defmodule MoonWeb.Examples.Dropdown.TriggerElements.ButtonTest do
+ use MoonWeb.ConnCase, async: true
+
+ test "Button should open", %{conn: conn} do
+ {:ok, view, _html} = live(conn, "/example/DropdownExample.TriggerElements")
+
+ assert view
+ |> element("#dropdown-trigger-02 div[aria-haspopup=true]")
+ |> has_element?()
+
+ assert view |> element("#dropdown-trigger-02 div.hidden[role=listbox]") |> has_element?()
+
+ view
+ |> element("#dropdown-trigger-02 div[aria-haspopup=true]")
+ |> render_click()
+
+ assert view |> element("#dropdown-trigger-02 div[role=listbox]") |> has_element?()
+ refute view |> element("#dropdown-trigger-02 div.hidden[role=listbox]") |> has_element?()
+ end
+
+ test "Button should select", %{conn: conn} do
+ {:ok, view, _html} = live(conn, "/example/DropdownExample.TriggerElements")
+
+ select = view |> element("#dropdown-trigger-02 div[aria-haspopup=true]")
+ select |> render_click()
+
+ view
+ |> element("#dropdown-trigger-02 div[role=listbox] button:first-child")
+ |> render_click()
+
+ # TODO: assert select |> render() ("button[class=bg-heles]")" should it be checked based on bg-colour?
+
+ assert view |> element("#dropdown-trigger-02 div.hidden[role=listbox]") |> has_element?()
+ end
+
+ # TODO: should screenshot test be added down here or separate?
+end
diff --git a/test/moon_web/examples/dropdown/trigger_elements/chip_with_arrow_test.exs b/test/moon_web/examples/dropdown/trigger_elements/chip_with_arrow_test.exs
new file mode 100644
index 000000000..c7e8fe713
--- /dev/null
+++ b/test/moon_web/examples/dropdown/trigger_elements/chip_with_arrow_test.exs
@@ -0,0 +1,40 @@
+defmodule MoonWeb.Examples.Dropdown.TriggerElements.ChipWithArrowTest do
+ use MoonWeb.ConnCase, async: true
+
+ test "Chip with arrow should open", %{conn: conn} do
+ {:ok, view, _html} = live(conn, "/example/DropdownExample.TriggerElements")
+
+ assert view
+ |> element("#dropdown-trigger-03 div[aria-haspopup=true]")
+ # TODO: |> render() =~ should we check icon presence here?
+ |> has_element?()
+
+ assert view |> element("#dropdown-trigger-03 div.hidden[role=listbox]") |> has_element?()
+
+ view
+ |> element("#dropdown-trigger-03 div[aria-haspopup=true]")
+ |> render_click()
+
+ assert view |> element("#dropdown-trigger-03 div[role=listbox]") |> has_element?()
+ refute view |> element("#dropdown-trigger-03 div.hidden[role=listbox]") |> has_element?()
+ end
+
+ test "Chip with arrow should select", %{conn: conn} do
+ {:ok, view, _html} = live(conn, "/example/DropdownExample.TriggerElements")
+
+ select = view |> element("#dropdown-trigger-03 div[aria-haspopup=true]")
+ # TODO: assert select |> render() =~ should we check icon presence here?
+
+ select |> render_click()
+
+ view
+ |> element("#dropdown-trigger-03 div[role=listbox] button:first-child")
+ |> render_click()
+
+ # TODO: assert select |> render() ("button[class=bg-heles]")" should it be checked based on bg-colour?
+
+ assert view |> element("#dropdown-trigger-03 div.hidden[role=listbox]") |> has_element?()
+ end
+
+ # TODO: should screenshot test be added down here or separate?
+end
diff --git a/test/moon_web/examples/dropdown/trigger_elements/icon_button_test.exs b/test/moon_web/examples/dropdown/trigger_elements/icon_button_test.exs
new file mode 100644
index 000000000..2e300ca24
--- /dev/null
+++ b/test/moon_web/examples/dropdown/trigger_elements/icon_button_test.exs
@@ -0,0 +1,40 @@
+defmodule MoonWeb.Examples.Dropdown.TriggerElements.IconButtonTest do
+ use MoonWeb.ConnCase, async: true
+
+ test "IconButton should open", %{conn: conn} do
+ {:ok, view, _html} = live(conn, "/example/DropdownExample.TriggerElements")
+
+ assert view
+ |> element("#dropdown-trigger-01 div[aria-haspopup=true]")
+ # TODO: |> render() =~ should we check icon presence here?
+ |> has_element?()
+
+ assert view |> element("#dropdown-trigger-01 div.hidden[role=listbox]") |> has_element?()
+
+ view
+ |> element("#dropdown-trigger-01 div[aria-haspopup=true]")
+ |> render_click()
+
+ assert view |> element("#dropdown-trigger-01 div[role=listbox]") |> has_element?()
+ refute view |> element("#dropdown-trigger-01 div.hidden[role=listbox]") |> has_element?()
+ end
+
+ test "IconButton should select", %{conn: conn} do
+ {:ok, view, _html} = live(conn, "/example/DropdownExample.TriggerElements")
+
+ select = view |> element("#dropdown-trigger-01 div[aria-haspopup=true]")
+ # assert select |> render() =~ should we check icon presence here?
+
+ select |> render_click()
+
+ view
+ |> element("#dropdown-trigger-01 div[role=listbox] button:first-child")
+ |> render_click()
+
+ # assert select |> render() ("button[class=bg-heles]")"?? should it be checked based on bg-colour?
+
+ assert view |> element("#dropdown-trigger-01 div.hidden[role=listbox]") |> has_element?()
+ end
+
+ # TODO: should screenshot test be added down here or separate?
+end
From efef92d6997a2ad1cc3c3191480c88c116ce31bc Mon Sep 17 00:00:00 2001
From: phgrey
Date: Thu, 27 Jul 2023 14:07:44 +0200
Subject: [PATCH 05/11] all the examples test
---
test/moon_web/pages/examples_test.exs | 33 +++++++++++++++++++++++++++
1 file changed, 33 insertions(+)
create mode 100644 test/moon_web/pages/examples_test.exs
diff --git a/test/moon_web/pages/examples_test.exs b/test/moon_web/pages/examples_test.exs
new file mode 100644
index 000000000..a458015b7
--- /dev/null
+++ b/test/moon_web/pages/examples_test.exs
@@ -0,0 +1,33 @@
+defmodule MoonWeb.Pages.ExamplesTest do
+ use MoonWeb.ConnCase
+
+ use Phoenix.VerifiedRoutes,
+ endpoint: MoonWeb.Endpoint,
+ router: MoonWeb.Router,
+ statics: MoonWeb.static_paths()
+
+ test "all examples open", %{conn: conn} do
+ with {:ok, list} <- :application.get_key(:moon, :modules) do
+ list
+ |> Enum.filter(&(&1 |> Module.split() |> Enum.take(2) == ~w|MoonWeb Examples|))
+ |> Enum.each(fn example ->
+ path =
+ MoonWeb.Router.Helpers.live_path(
+ MoonWeb.Endpoint,
+ MoonWeb.Pages.ExamplePage,
+ "#{example}" |> String.replace("Elixir.MoonWeb.Examples.Design.", "")
+ )
+
+ try do
+ conn = get(conn, path)
+ assert response(conn, 200)
+ rescue
+ e ->
+ flunk(
+ "Error on example #{example}\n\n#{Map.get(e, :message, "Message not available")}"
+ )
+ end
+ end)
+ end
+ end
+end
From aa5a800e069717b28e15396e9dae804ca287ddb4 Mon Sep 17 00:00:00 2001
From: Triin Kullisaar <95503530+tkullisaar@users.noreply.github.com>
Date: Tue, 1 Aug 2023 10:14:25 +0300
Subject: [PATCH 06/11] dropdown tests + accordion tests started
---
lib/moon/design/dropdown/bottom_options.ex | 1 +
.../examples/accordion/default_test.exs | 65 +++++++++++++++++++
.../examples/dropdown/datepicker_test.exs | 5 ++
.../examples/dropdown/default_test.exs | 2 +
.../option_layouts/select_countries_test.exs | 0
.../option_layouts/select_language_test.exs | 0
.../dropdown/option_layouts/sort_by_test.exs | 0
.../option_layouts/with_checkbox_test.exs | 38 +++++++++++
.../option_layouts/with_icons_test.exs | 38 +++++++++++
.../option_layouts/with_radio_test.exs | 38 +++++++++++
.../dropdown/positions/bottom_end_test.exs | 45 +++++++++++++
.../dropdown/positions/bottom_start_test.exs | 45 +++++++++++++
.../dropdown/positions/bottom_test.exs | 38 +++++++++++
.../dropdown/positions/left_end_test.exs | 38 +++++++++++
.../dropdown/positions/left_start_test.exs | 45 +++++++++++++
.../examples/dropdown/positions/left_test.exs | 38 +++++++++++
.../dropdown/positions/right_end_test.exs | 38 +++++++++++
.../dropdown/positions/right_start_test.exs | 45 +++++++++++++
.../dropdown/positions/right_test.exs | 38 +++++++++++
.../dropdown/positions/top_end_test.exs | 38 +++++++++++
.../dropdown/positions/top_start_test.exs | 38 +++++++++++
.../examples/dropdown/positions/top_test.exs | 38 +++++++++++
.../dropdown/responsive_dropdown_test.exs | 38 +++++++++++
.../examples/dropdown/sizes/lg_test.exs | 38 +++++++++++
.../examples/dropdown/sizes/md_test.exs | 38 +++++++++++
.../examples/dropdown/sizes/sm_test.exs | 38 +++++++++++
.../dropdown/trigger_elements/button_test.exs | 2 +-
.../trigger_elements/chip_with_arrow_test.exs | 2 +-
.../trigger_elements/icon_button_test.exs | 2 +-
29 files changed, 826 insertions(+), 3 deletions(-)
create mode 100644 test/moon_web/examples/accordion/default_test.exs
delete mode 100644 test/moon_web/examples/dropdown/option_layouts/select_countries_test.exs
delete mode 100644 test/moon_web/examples/dropdown/option_layouts/select_language_test.exs
delete mode 100644 test/moon_web/examples/dropdown/option_layouts/sort_by_test.exs
create mode 100644 test/moon_web/examples/dropdown/option_layouts/with_checkbox_test.exs
create mode 100644 test/moon_web/examples/dropdown/option_layouts/with_icons_test.exs
create mode 100644 test/moon_web/examples/dropdown/option_layouts/with_radio_test.exs
diff --git a/lib/moon/design/dropdown/bottom_options.ex b/lib/moon/design/dropdown/bottom_options.ex
index 9d65f2b31..16cfdaa21 100644
--- a/lib/moon/design/dropdown/bottom_options.ex
+++ b/lib/moon/design/dropdown/bottom_options.ex
@@ -53,6 +53,7 @@ defmodule Moon.Design.Dropdown.BottomOptions do
{=@id}
data-testid={@testid}
:on-click-away={@on_close}
+ role="listbox"
>
{#if slot_assigned?(:option)}
{#for {option, index} <- Enum.with_index(make_list(@option))}
diff --git a/test/moon_web/examples/accordion/default_test.exs b/test/moon_web/examples/accordion/default_test.exs
new file mode 100644
index 000000000..879306016
--- /dev/null
+++ b/test/moon_web/examples/accordion/default_test.exs
@@ -0,0 +1,65 @@
+defmodule MoonWeb.Examples.Accordion.DefaultTest do
+ use MoonWeb.ConnCase, async: true
+
+ test "should expand and collapse 1st", %{conn: conn} do
+ {:ok, view, _html} = live(conn, "/example/AccordionExample.Default")
+
+ assert view
+ |> element("#simple-accordion button[value=0]")
+ |> render() =~ "Lorem"
+
+ view
+ |> element("#simple-accordion button[value=0]")
+ |> render_click()
+
+ assert view |> element("#simple-accordion div[role=region]") |> has_element?()
+
+ view
+ |> element("#simple-accordion button[value=0]")
+ |> render_click()
+
+ refute view |> element("#simple-accordion div[role=region]") |> has_element?()
+ end
+
+ test "should expand and collapse 2nd", %{conn: conn} do
+ {:ok, view, _html} = live(conn, "/example/AccordionExample.Default")
+
+ assert view
+ |> element("#simple-accordion button[value=1]")
+ |> render() =~ "Beerus bg"
+
+ view
+ |> element("#simple-accordion button[value=1]")
+ |> render_click()
+
+ assert view |> element("#simple-accordion div[role=region]") |> has_element?()
+
+ view
+ |> element("#simple-accordion button[value=1]")
+ |> render_click()
+
+ refute view |> element("#simple-accordion div[role=region]") |> has_element?()
+ end
+
+ test "should expand and collapse 3rd", %{conn: conn} do
+ {:ok, view, _html} = live(conn, "/example/AccordionExample.Default")
+
+ assert view
+ |> element("#simple-accordion button[value=2]")
+ |> render() =~ "Dolor"
+
+ view
+ |> element("#simple-accordion button[value=2]")
+ |> render_click()
+
+ assert view |> element("#simple-accordion div[role=region]") |> has_element?()
+
+ view
+ |> element("#simple-accordion button[value=2]")
+ |> render_click()
+
+ refute view |> element("#simple-accordion div[role=region]") |> has_element?()
+ end
+
+ # TODO: add screenshot test of default state and expanded state
+end
diff --git a/test/moon_web/examples/dropdown/datepicker_test.exs b/test/moon_web/examples/dropdown/datepicker_test.exs
index e69de29bb..54e49b289 100644
--- a/test/moon_web/examples/dropdown/datepicker_test.exs
+++ b/test/moon_web/examples/dropdown/datepicker_test.exs
@@ -0,0 +1,5 @@
+defmodule MoonWeb.Examples.Dropdown.DatepickerTest do
+ use MoonWeb.ConnCase, async: true
+
+ # TODO: add screenshot test of default state, hover state, open state, selected state
+end
diff --git a/test/moon_web/examples/dropdown/default_test.exs b/test/moon_web/examples/dropdown/default_test.exs
index f8a22bd3d..38b11494c 100644
--- a/test/moon_web/examples/dropdown/default_test.exs
+++ b/test/moon_web/examples/dropdown/default_test.exs
@@ -34,4 +34,6 @@ defmodule MoonWeb.Examples.Dropdown.DefaultTest do
assert view |> element("#dropdown-02 div.hidden[role=listbox]") |> has_element?()
end
+
+ # TODO: add screenshot test of default state, hover state, open state, selected state
end
diff --git a/test/moon_web/examples/dropdown/option_layouts/select_countries_test.exs b/test/moon_web/examples/dropdown/option_layouts/select_countries_test.exs
deleted file mode 100644
index e69de29bb..000000000
diff --git a/test/moon_web/examples/dropdown/option_layouts/select_language_test.exs b/test/moon_web/examples/dropdown/option_layouts/select_language_test.exs
deleted file mode 100644
index e69de29bb..000000000
diff --git a/test/moon_web/examples/dropdown/option_layouts/sort_by_test.exs b/test/moon_web/examples/dropdown/option_layouts/sort_by_test.exs
deleted file mode 100644
index e69de29bb..000000000
diff --git a/test/moon_web/examples/dropdown/option_layouts/with_checkbox_test.exs b/test/moon_web/examples/dropdown/option_layouts/with_checkbox_test.exs
new file mode 100644
index 000000000..4c9e8c8e6
--- /dev/null
+++ b/test/moon_web/examples/dropdown/option_layouts/with_checkbox_test.exs
@@ -0,0 +1,38 @@
+defmodule MoonWeb.Examples.Dropdown.OptionLayouts.WithCheckboxTest do
+ use MoonWeb.ConnCase, async: true
+
+ test "should open", %{conn: conn} do
+ {:ok, view, _html} = live(conn, "/example/DropdownExample.OptionLayouts")
+
+ assert view
+ |> element("#dropdown-options-03 div[aria-haspopup=true]")
+ |> has_element?()
+
+ assert view |> element("#dropdown-options-03 div.hidden[role=listbox]") |> has_element?()
+
+ view
+ |> element("#dropdown-options-03 div[aria-haspopup=true]")
+ |> render_click()
+
+ assert view |> element("#dropdown-options-03 div[role=listbox]") |> has_element?()
+ refute view |> element("#dropdown-options-03 div.hidden[role=listbox]") |> has_element?()
+ end
+
+ test "should select", %{conn: conn} do
+ {:ok, view, _html} = live(conn, "/example/DropdownExample.OptionLayouts")
+
+ select = view |> element("#dropdown-options-03 div[aria-haspopup=true]")
+
+ select |> render_click()
+
+ view
+ |> element("#dropdown-options-03 div[role=listbox] button:first-child")
+ |> render_click()
+
+ # TODO: assert select |> render() ("button[class=bg-heles]")" should it be checked based on bg-colour? and if checkbox is checked?
+
+ # assert view |> element("#dropdown-options-03 div.hidden[role=listbox]") |> has_element?()
+ end
+
+ # TODO: add screenshot test of default state, hover state, open state, selected state
+end
diff --git a/test/moon_web/examples/dropdown/option_layouts/with_icons_test.exs b/test/moon_web/examples/dropdown/option_layouts/with_icons_test.exs
new file mode 100644
index 000000000..236820e49
--- /dev/null
+++ b/test/moon_web/examples/dropdown/option_layouts/with_icons_test.exs
@@ -0,0 +1,38 @@
+defmodule MoonWeb.Examples.Dropdown.OptionLayouts.WithIconsTest do
+ use MoonWeb.ConnCase, async: true
+
+ test "should open", %{conn: conn} do
+ {:ok, view, _html} = live(conn, "/example/DropdownExample.OptionLayouts")
+
+ assert view
+ |> element("#dropdown-options-01 div[aria-haspopup=true]")
+ |> has_element?()
+
+ assert view |> element("#dropdown-options-01 div.hidden[role=listbox]") |> has_element?()
+
+ view
+ |> element("#dropdown-options-01 div[aria-haspopup=true]")
+ |> render_click()
+
+ assert view |> element("#dropdown-options-01 div[role=listbox]") |> has_element?()
+ refute view |> element("#dropdown-options-01 div.hidden[role=listbox]") |> has_element?()
+ end
+
+ test "should select", %{conn: conn} do
+ {:ok, view, _html} = live(conn, "/example/DropdownExample.OptionLayouts")
+
+ select = view |> element("#dropdown-options-01 div[aria-haspopup=true]")
+
+ select |> render_click()
+
+ view
+ |> element("#dropdown-options-01 div[role=listbox] button:first-child")
+ |> render_click()
+
+ # TODO: assert select |> render() ("button[class=bg-heles]")" should it be checked based on bg-colour?
+
+ assert view |> element("#dropdown-options-01 div.hidden[role=listbox]") |> has_element?()
+ end
+
+ # TODO: add screenshot test of default state, hover state, open state, selected state
+end
diff --git a/test/moon_web/examples/dropdown/option_layouts/with_radio_test.exs b/test/moon_web/examples/dropdown/option_layouts/with_radio_test.exs
new file mode 100644
index 000000000..a77e422ae
--- /dev/null
+++ b/test/moon_web/examples/dropdown/option_layouts/with_radio_test.exs
@@ -0,0 +1,38 @@
+defmodule MoonWeb.Examples.Dropdown.OptionLayouts.WithRadioTest do
+ use MoonWeb.ConnCase, async: true
+
+ test "should open", %{conn: conn} do
+ {:ok, view, _html} = live(conn, "/example/DropdownExample.OptionLayouts")
+
+ assert view
+ |> element("#dropdown-options-02 div[aria-haspopup=true]")
+ |> has_element?()
+
+ assert view |> element("#dropdown-options-02 div.hidden[role=listbox]") |> has_element?()
+
+ view
+ |> element("#dropdown-options-02 div[aria-haspopup=true]")
+ |> render_click()
+
+ assert view |> element("#dropdown-options-02 div[role=listbox]") |> has_element?()
+ refute view |> element("#dropdown-options-02 div.hidden[role=listbox]") |> has_element?()
+ end
+
+ test "should select", %{conn: conn} do
+ {:ok, view, _html} = live(conn, "/example/DropdownExample.OptionLayouts")
+
+ select = view |> element("#dropdown-options-02 div[aria-haspopup=true]")
+
+ select |> render_click()
+
+ view
+ |> element("#dropdown-options-02 div[role=listbox] button:first-child")
+ |> render_click()
+
+ # TODO: assert select |> render() ("button[class=bg-heles]")" should it be checked based on bg-colour? and if radio is checked?
+
+ assert view |> element("#dropdown-options-02 div.hidden[role=listbox]") |> has_element?()
+ end
+
+ # TODO: add screenshot test of default state, hover state, open state, selected state
+end
diff --git a/test/moon_web/examples/dropdown/positions/bottom_end_test.exs b/test/moon_web/examples/dropdown/positions/bottom_end_test.exs
index e69de29bb..8c1a79fb3 100644
--- a/test/moon_web/examples/dropdown/positions/bottom_end_test.exs
+++ b/test/moon_web/examples/dropdown/positions/bottom_end_test.exs
@@ -0,0 +1,45 @@
+defmodule MoonWeb.Examples.Dropdown.Positions.BottomEndTest do
+ use MoonWeb.ConnCase, async: true
+
+ test "should open", %{conn: conn} do
+ {:ok, view, _html} = live(conn, "/example/DropdownExample.Positions")
+
+ assert view
+ |> element("#drop-positions-bottom-end div[aria-haspopup=true]")
+ |> has_element?()
+
+ assert view
+ |> element("#drop-positions-bottom-end div.hidden[role=listbox]")
+ |> has_element?()
+
+ view
+ |> element("#drop-positions-bottom-end div[aria-haspopup=true]")
+ |> render_click()
+
+ assert view |> element("#drop-positions-bottom-end div[role=listbox]") |> has_element?()
+
+ refute view
+ |> element("#drop-positions-bottom-end div.hidden[role=listbox]")
+ |> has_element?()
+ end
+
+ test "should select", %{conn: conn} do
+ {:ok, view, _html} = live(conn, "/example/DropdownExample.Positions")
+
+ select = view |> element("#drop-positions-bottom-end div[aria-haspopup=true]")
+
+ select |> render_click()
+
+ view
+ |> element("#drop-positions-bottom-end div[role=listbox] button:first-child")
+ |> render_click()
+
+ # TODO: assert select |> render() ("button[class=bg-heles]")" should it be checked based on bg-colour?
+
+ assert view
+ |> element("#drop-positions-bottom-end div.hidden[role=listbox]")
+ |> has_element?()
+ end
+
+ # TODO: add screenshot test of default state, hover state, open state, selected state
+end
diff --git a/test/moon_web/examples/dropdown/positions/bottom_start_test.exs b/test/moon_web/examples/dropdown/positions/bottom_start_test.exs
index e69de29bb..f68179025 100644
--- a/test/moon_web/examples/dropdown/positions/bottom_start_test.exs
+++ b/test/moon_web/examples/dropdown/positions/bottom_start_test.exs
@@ -0,0 +1,45 @@
+defmodule MoonWeb.Examples.Dropdown.Positions.BottomStartTest do
+ use MoonWeb.ConnCase, async: true
+
+ test "should open", %{conn: conn} do
+ {:ok, view, _html} = live(conn, "/example/DropdownExample.Positions")
+
+ assert view
+ |> element("#drop-positions-bottom-start div[aria-haspopup=true]")
+ |> has_element?()
+
+ assert view
+ |> element("#drop-positions-bottom-start div.hidden[role=listbox]")
+ |> has_element?()
+
+ view
+ |> element("#drop-positions-bottom-start div[aria-haspopup=true]")
+ |> render_click()
+
+ assert view |> element("#drop-positions-bottom-start div[role=listbox]") |> has_element?()
+
+ refute view
+ |> element("#drop-positions-bottom-start div.hidden[role=listbox]")
+ |> has_element?()
+ end
+
+ test "should select", %{conn: conn} do
+ {:ok, view, _html} = live(conn, "/example/DropdownExample.Positions")
+
+ select = view |> element("#drop-positions-bottom-start div[aria-haspopup=true]")
+
+ select |> render_click()
+
+ view
+ |> element("#drop-positions-bottom-start div[role=listbox] button:first-child")
+ |> render_click()
+
+ # TODO: assert select |> render() ("button[class=bg-heles]")" should it be checked based on bg-colour?
+
+ assert view
+ |> element("#drop-positions-bottom-start div.hidden[role=listbox]")
+ |> has_element?()
+ end
+
+ # TODO: add screenshot test of default state, hover state, open state, selected state
+end
diff --git a/test/moon_web/examples/dropdown/positions/bottom_test.exs b/test/moon_web/examples/dropdown/positions/bottom_test.exs
index e69de29bb..28eb1ac11 100644
--- a/test/moon_web/examples/dropdown/positions/bottom_test.exs
+++ b/test/moon_web/examples/dropdown/positions/bottom_test.exs
@@ -0,0 +1,38 @@
+defmodule MoonWeb.Examples.Dropdown.Positions.BottomTest do
+ use MoonWeb.ConnCase, async: true
+
+ test "should open", %{conn: conn} do
+ {:ok, view, _html} = live(conn, "/example/DropdownExample.Positions")
+
+ assert view
+ |> element("#drop-positions-bottom div[aria-haspopup=true]")
+ |> has_element?()
+
+ assert view |> element("#drop-positions-bottom div.hidden[role=listbox]") |> has_element?()
+
+ view
+ |> element("#drop-positions-bottom div[aria-haspopup=true]")
+ |> render_click()
+
+ assert view |> element("#drop-positions-bottom div[role=listbox]") |> has_element?()
+ refute view |> element("#drop-positions-bottom div.hidden[role=listbox]") |> has_element?()
+ end
+
+ test "should select", %{conn: conn} do
+ {:ok, view, _html} = live(conn, "/example/DropdownExample.Positions")
+
+ select = view |> element("#drop-positions-bottom div[aria-haspopup=true]")
+
+ select |> render_click()
+
+ view
+ |> element("#drop-positions-bottom div[role=listbox] button:first-child")
+ |> render_click()
+
+ # TODO: assert select |> render() ("button[class=bg-heles]")" should it be checked based on bg-colour?
+
+ assert view |> element("#drop-positions-bottom div.hidden[role=listbox]") |> has_element?()
+ end
+
+ # TODO: add screenshot test of default state, hover state, open state, selected state
+end
diff --git a/test/moon_web/examples/dropdown/positions/left_end_test.exs b/test/moon_web/examples/dropdown/positions/left_end_test.exs
index e69de29bb..cc6d750f7 100644
--- a/test/moon_web/examples/dropdown/positions/left_end_test.exs
+++ b/test/moon_web/examples/dropdown/positions/left_end_test.exs
@@ -0,0 +1,38 @@
+defmodule MoonWeb.Examples.Dropdown.Positions.LeftEndTest do
+ use MoonWeb.ConnCase, async: true
+
+ test "should open", %{conn: conn} do
+ {:ok, view, _html} = live(conn, "/example/DropdownExample.Positions")
+
+ assert view
+ |> element("#drop-positions-left-end div[aria-haspopup=true]")
+ |> has_element?()
+
+ assert view |> element("#drop-positions-left-end div.hidden[role=listbox]") |> has_element?()
+
+ view
+ |> element("#drop-positions-left-end div[aria-haspopup=true]")
+ |> render_click()
+
+ assert view |> element("#drop-positions-left-end div[role=listbox]") |> has_element?()
+ refute view |> element("#drop-positions-left-end div.hidden[role=listbox]") |> has_element?()
+ end
+
+ test "should select", %{conn: conn} do
+ {:ok, view, _html} = live(conn, "/example/DropdownExample.Positions")
+
+ select = view |> element("#drop-positions-left-end div[aria-haspopup=true]")
+
+ select |> render_click()
+
+ view
+ |> element("#drop-positions-left-end div[role=listbox] button:first-child")
+ |> render_click()
+
+ # TODO: assert select |> render() ("button[class=bg-heles]")" should it be checked based on bg-colour?
+
+ assert view |> element("#drop-positions-left-end div.hidden[role=listbox]") |> has_element?()
+ end
+
+ # TODO: add screenshot test of default state, hover state, open state, selected state
+end
diff --git a/test/moon_web/examples/dropdown/positions/left_start_test.exs b/test/moon_web/examples/dropdown/positions/left_start_test.exs
index e69de29bb..445ce7b1b 100644
--- a/test/moon_web/examples/dropdown/positions/left_start_test.exs
+++ b/test/moon_web/examples/dropdown/positions/left_start_test.exs
@@ -0,0 +1,45 @@
+defmodule MoonWeb.Examples.Dropdown.Positions.LeftStartTest do
+ use MoonWeb.ConnCase, async: true
+
+ test "should open", %{conn: conn} do
+ {:ok, view, _html} = live(conn, "/example/DropdownExample.Positions")
+
+ assert view
+ |> element("#drop-positions-left-start div[aria-haspopup=true]")
+ |> has_element?()
+
+ assert view
+ |> element("#drop-positions-left-start div.hidden[role=listbox]")
+ |> has_element?()
+
+ view
+ |> element("#drop-positions-left-start div[aria-haspopup=true]")
+ |> render_click()
+
+ assert view |> element("#drop-positions-left-start div[role=listbox]") |> has_element?()
+
+ refute view
+ |> element("#drop-positions-left-start div.hidden[role=listbox]")
+ |> has_element?()
+ end
+
+ test "should select", %{conn: conn} do
+ {:ok, view, _html} = live(conn, "/example/DropdownExample.Positions")
+
+ select = view |> element("#drop-positions-left-start div[aria-haspopup=true]")
+
+ select |> render_click()
+
+ view
+ |> element("#drop-positions-left-start div[role=listbox] button:first-child")
+ |> render_click()
+
+ # TODO: assert select |> render() ("button[class=bg-heles]")" should it be checked based on bg-colour?
+
+ assert view
+ |> element("#drop-positions-left-start div.hidden[role=listbox]")
+ |> has_element?()
+ end
+
+ # TODO: add screenshot test of default state, hover state, open state, selected state
+end
diff --git a/test/moon_web/examples/dropdown/positions/left_test.exs b/test/moon_web/examples/dropdown/positions/left_test.exs
index e69de29bb..9525c0a98 100644
--- a/test/moon_web/examples/dropdown/positions/left_test.exs
+++ b/test/moon_web/examples/dropdown/positions/left_test.exs
@@ -0,0 +1,38 @@
+defmodule MoonWeb.Examples.Dropdown.Positions.LeftTest do
+ use MoonWeb.ConnCase, async: true
+
+ test "should open", %{conn: conn} do
+ {:ok, view, _html} = live(conn, "/example/DropdownExample.Positions")
+
+ assert view
+ |> element("#drop-positions-left div[aria-haspopup=true]")
+ |> has_element?()
+
+ assert view |> element("#drop-positions-left div.hidden[role=listbox]") |> has_element?()
+
+ view
+ |> element("#drop-positions-left div[aria-haspopup=true]")
+ |> render_click()
+
+ assert view |> element("#drop-positions-left div[role=listbox]") |> has_element?()
+ refute view |> element("#drop-positions-left div.hidden[role=listbox]") |> has_element?()
+ end
+
+ test "should select", %{conn: conn} do
+ {:ok, view, _html} = live(conn, "/example/DropdownExample.Positions")
+
+ select = view |> element("#drop-positions-left div[aria-haspopup=true]")
+
+ select |> render_click()
+
+ view
+ |> element("#drop-positions-left div[role=listbox] button:first-child")
+ |> render_click()
+
+ # TODO: assert select |> render() ("button[class=bg-heles]")" should it be checked based on bg-colour?
+
+ assert view |> element("#drop-positions-left div.hidden[role=listbox]") |> has_element?()
+ end
+
+ # TODO: add screenshot test of default state, hover state, open state, selected state
+end
diff --git a/test/moon_web/examples/dropdown/positions/right_end_test.exs b/test/moon_web/examples/dropdown/positions/right_end_test.exs
index e69de29bb..9ecfd7482 100644
--- a/test/moon_web/examples/dropdown/positions/right_end_test.exs
+++ b/test/moon_web/examples/dropdown/positions/right_end_test.exs
@@ -0,0 +1,38 @@
+defmodule MoonWeb.Examples.Dropdown.Positions.RightEndTest do
+ use MoonWeb.ConnCase, async: true
+
+ test "should open", %{conn: conn} do
+ {:ok, view, _html} = live(conn, "/example/DropdownExample.Positions")
+
+ assert view
+ |> element("#drop-positions-right-end div[aria-haspopup=true]")
+ |> has_element?()
+
+ assert view |> element("#drop-positions-right-end div.hidden[role=listbox]") |> has_element?()
+
+ view
+ |> element("#drop-positions-right-end div[aria-haspopup=true]")
+ |> render_click()
+
+ assert view |> element("#drop-positions-right-end div[role=listbox]") |> has_element?()
+ refute view |> element("#drop-positions-right-end div.hidden[role=listbox]") |> has_element?()
+ end
+
+ test "should select", %{conn: conn} do
+ {:ok, view, _html} = live(conn, "/example/DropdownExample.Positions")
+
+ select = view |> element("#drop-positions-right-end div[aria-haspopup=true]")
+
+ select |> render_click()
+
+ view
+ |> element("#drop-positions-right-end div[role=listbox] button:first-child")
+ |> render_click()
+
+ # TODO: assert select |> render() ("button[class=bg-heles]")" should it be checked based on bg-colour?
+
+ assert view |> element("#drop-positions-right-end div.hidden[role=listbox]") |> has_element?()
+ end
+
+ # TODO: add screenshot test of default state, hover state, open state, selected state
+end
diff --git a/test/moon_web/examples/dropdown/positions/right_start_test.exs b/test/moon_web/examples/dropdown/positions/right_start_test.exs
index e69de29bb..b9c5bcc71 100644
--- a/test/moon_web/examples/dropdown/positions/right_start_test.exs
+++ b/test/moon_web/examples/dropdown/positions/right_start_test.exs
@@ -0,0 +1,45 @@
+defmodule MoonWeb.Examples.Dropdown.Positions.RightStartTest do
+ use MoonWeb.ConnCase, async: true
+
+ test "should open", %{conn: conn} do
+ {:ok, view, _html} = live(conn, "/example/DropdownExample.Positions")
+
+ assert view
+ |> element("#drop-positions-right-start div[aria-haspopup=true]")
+ |> has_element?()
+
+ assert view
+ |> element("#drop-positions-right-start div.hidden[role=listbox]")
+ |> has_element?()
+
+ view
+ |> element("#drop-positions-right-start div[aria-haspopup=true]")
+ |> render_click()
+
+ assert view |> element("#drop-positions-right-start div[role=listbox]") |> has_element?()
+
+ refute view
+ |> element("#drop-positions-right-start div.hidden[role=listbox]")
+ |> has_element?()
+ end
+
+ test "should select", %{conn: conn} do
+ {:ok, view, _html} = live(conn, "/example/DropdownExample.Positions")
+
+ select = view |> element("#drop-positions-right-start div[aria-haspopup=true]")
+
+ select |> render_click()
+
+ view
+ |> element("#drop-positions-right-start div[role=listbox] button:first-child")
+ |> render_click()
+
+ # TODO: assert select |> render() ("button[class=bg-heles]")" should it be checked based on bg-colour?
+
+ assert view
+ |> element("#drop-positions-right-start div.hidden[role=listbox]")
+ |> has_element?()
+ end
+
+ # TODO: add screenshot test of default state, hover state, open state, selected state
+end
diff --git a/test/moon_web/examples/dropdown/positions/right_test.exs b/test/moon_web/examples/dropdown/positions/right_test.exs
index e69de29bb..8a4dfd612 100644
--- a/test/moon_web/examples/dropdown/positions/right_test.exs
+++ b/test/moon_web/examples/dropdown/positions/right_test.exs
@@ -0,0 +1,38 @@
+defmodule MoonWeb.Examples.Dropdown.Positions.RightTest do
+ use MoonWeb.ConnCase, async: true
+
+ test "should open", %{conn: conn} do
+ {:ok, view, _html} = live(conn, "/example/DropdownExample.Positions")
+
+ assert view
+ |> element("#drop-positions-right div[aria-haspopup=true]")
+ |> has_element?()
+
+ assert view |> element("#drop-positions-right div.hidden[role=listbox]") |> has_element?()
+
+ view
+ |> element("#drop-positions-right div[aria-haspopup=true]")
+ |> render_click()
+
+ assert view |> element("#drop-positions-right div[role=listbox]") |> has_element?()
+ refute view |> element("#drop-positions-right div.hidden[role=listbox]") |> has_element?()
+ end
+
+ test "should select", %{conn: conn} do
+ {:ok, view, _html} = live(conn, "/example/DropdownExample.Positions")
+
+ select = view |> element("#drop-positions-right div[aria-haspopup=true]")
+
+ select |> render_click()
+
+ view
+ |> element("#drop-positions-right div[role=listbox] button:first-child")
+ |> render_click()
+
+ # TODO: assert select |> render() ("button[class=bg-heles]")" should it be checked based on bg-colour?
+
+ assert view |> element("#drop-positions-right div.hidden[role=listbox]") |> has_element?()
+ end
+
+ # TODO: add screenshot test of default state, hover state, open state, selected state
+end
diff --git a/test/moon_web/examples/dropdown/positions/top_end_test.exs b/test/moon_web/examples/dropdown/positions/top_end_test.exs
index e69de29bb..27bf6c6f0 100644
--- a/test/moon_web/examples/dropdown/positions/top_end_test.exs
+++ b/test/moon_web/examples/dropdown/positions/top_end_test.exs
@@ -0,0 +1,38 @@
+defmodule MoonWeb.Examples.Dropdown.Positions.TopEndTest do
+ use MoonWeb.ConnCase, async: true
+
+ test "should open", %{conn: conn} do
+ {:ok, view, _html} = live(conn, "/example/DropdownExample.Positions")
+
+ assert view
+ |> element("#drop-positions-top-end div[aria-haspopup=true]")
+ |> has_element?()
+
+ assert view |> element("#drop-positions-top-end div.hidden[role=listbox]") |> has_element?()
+
+ view
+ |> element("#drop-positions-top-end div[aria-haspopup=true]")
+ |> render_click()
+
+ assert view |> element("#drop-positions-top-end div[role=listbox]") |> has_element?()
+ refute view |> element("#drop-positions-top-end div.hidden[role=listbox]") |> has_element?()
+ end
+
+ test "should select", %{conn: conn} do
+ {:ok, view, _html} = live(conn, "/example/DropdownExample.Positions")
+
+ select = view |> element("#drop-positions-top-end div[aria-haspopup=true]")
+
+ select |> render_click()
+
+ view
+ |> element("#drop-positions-top-end div[role=listbox] button:first-child")
+ |> render_click()
+
+ # TODO: assert select |> render() ("button[class=bg-heles]")" should it be checked based on bg-colour?
+
+ assert view |> element("#drop-positions-top-end div.hidden[role=listbox]") |> has_element?()
+ end
+
+ # TODO: add screenshot test of default state, hover state, open state, selected state
+end
diff --git a/test/moon_web/examples/dropdown/positions/top_start_test.exs b/test/moon_web/examples/dropdown/positions/top_start_test.exs
index e69de29bb..719be7859 100644
--- a/test/moon_web/examples/dropdown/positions/top_start_test.exs
+++ b/test/moon_web/examples/dropdown/positions/top_start_test.exs
@@ -0,0 +1,38 @@
+defmodule MoonWeb.Examples.Dropdown.Positions.TopStartTest do
+ use MoonWeb.ConnCase, async: true
+
+ test "should open", %{conn: conn} do
+ {:ok, view, _html} = live(conn, "/example/DropdownExample.Positions")
+
+ assert view
+ |> element("#drop-positions-top-start div[aria-haspopup=true]")
+ |> has_element?()
+
+ assert view |> element("#drop-positions-top-start div.hidden[role=listbox]") |> has_element?()
+
+ view
+ |> element("#drop-positions-top-start div[aria-haspopup=true]")
+ |> render_click()
+
+ assert view |> element("#drop-positions-top-start div[role=listbox]") |> has_element?()
+ refute view |> element("#drop-positions-top-start div.hidden[role=listbox]") |> has_element?()
+ end
+
+ test "should select", %{conn: conn} do
+ {:ok, view, _html} = live(conn, "/example/DropdownExample.Positions")
+
+ select = view |> element("#drop-positions-top-start div[aria-haspopup=true]")
+
+ select |> render_click()
+
+ view
+ |> element("#drop-positions-top-start div[role=listbox] button:first-child")
+ |> render_click()
+
+ # TODO: assert select |> render() ("button[class=bg-heles]")" should it be checked based on bg-colour?
+
+ assert view |> element("#drop-positions-top-start div.hidden[role=listbox]") |> has_element?()
+ end
+
+ # TODO: add screenshot test of default state, hover state, open state, selected state
+end
diff --git a/test/moon_web/examples/dropdown/positions/top_test.exs b/test/moon_web/examples/dropdown/positions/top_test.exs
index e69de29bb..b40b96376 100644
--- a/test/moon_web/examples/dropdown/positions/top_test.exs
+++ b/test/moon_web/examples/dropdown/positions/top_test.exs
@@ -0,0 +1,38 @@
+defmodule MoonWeb.Examples.Dropdown.Positions.TopTest do
+ use MoonWeb.ConnCase, async: true
+
+ test "should open", %{conn: conn} do
+ {:ok, view, _html} = live(conn, "/example/DropdownExample.Positions")
+
+ assert view
+ |> element("#drop-positions-top div[aria-haspopup=true]")
+ |> has_element?()
+
+ assert view |> element("#drop-positions-top div.hidden[role=listbox]") |> has_element?()
+
+ view
+ |> element("#drop-positions-top div[aria-haspopup=true]")
+ |> render_click()
+
+ assert view |> element("#drop-positions-top div[role=listbox]") |> has_element?()
+ refute view |> element("#drop-positions-top div.hidden[role=listbox]") |> has_element?()
+ end
+
+ test "should select", %{conn: conn} do
+ {:ok, view, _html} = live(conn, "/example/DropdownExample.Positions")
+
+ select = view |> element("#drop-positions-top div[aria-haspopup=true]")
+
+ select |> render_click()
+
+ view
+ |> element("#drop-positions-top div[role=listbox] button:first-child")
+ |> render_click()
+
+ # TODO: assert select |> render() ("button[class=bg-heles]")" should it be checked based on bg-colour?
+
+ assert view |> element("#drop-positions-top div.hidden[role=listbox]") |> has_element?()
+ end
+
+ # TODO: add screenshot test of default state, hover state, open state, selected state
+end
diff --git a/test/moon_web/examples/dropdown/responsive_dropdown_test.exs b/test/moon_web/examples/dropdown/responsive_dropdown_test.exs
index e69de29bb..ce095827f 100644
--- a/test/moon_web/examples/dropdown/responsive_dropdown_test.exs
+++ b/test/moon_web/examples/dropdown/responsive_dropdown_test.exs
@@ -0,0 +1,38 @@
+defmodule MoonWeb.Examples.Dropdown.ResponsiveDropdownTest do
+ use MoonWeb.ConnCase, async: true
+
+ test "should open", %{conn: conn} do
+ {:ok, view, _html} = live(conn, "/example/DropdownExample.ResponsiveDropdown")
+
+ assert view
+ |> element("#responsive-dropdown div[aria-haspopup=true]")
+ |> has_element?()
+
+ assert view |> element("#responsive-dropdown div.hidden[role=listbox]") |> has_element?()
+
+ view
+ |> element("#responsive-dropdown div[aria-haspopup=true]")
+ |> render_click()
+
+ assert view |> element("#responsive-dropdown div[role=listbox]") |> has_element?()
+ refute view |> element("#responsive-dropdown div.hidden[role=listbox]") |> has_element?()
+ end
+
+ test "should select", %{conn: conn} do
+ {:ok, view, _html} = live(conn, "/example/DropdownExample.ResponsiveDropdown")
+
+ select = view |> element("#responsive-dropdown div[aria-haspopup=true]")
+
+ select |> render_click()
+
+ view
+ |> element("#responsive-dropdown div[role=listbox] button:first-child")
+ |> render_click()
+
+ # TODO: assert select |> render() ("button[class=bg-heles]")" should it be checked based on bg-colour? and if checkbox is checked?
+
+ # assert view |> element("#responsive-dropdown div.hidden[role=listbox]") |> has_element?()
+ end
+
+ # TODO: add screenshot test of default state, hover state, open state, selected state
+end
diff --git a/test/moon_web/examples/dropdown/sizes/lg_test.exs b/test/moon_web/examples/dropdown/sizes/lg_test.exs
index e69de29bb..d0787f4b2 100644
--- a/test/moon_web/examples/dropdown/sizes/lg_test.exs
+++ b/test/moon_web/examples/dropdown/sizes/lg_test.exs
@@ -0,0 +1,38 @@
+defmodule MoonWeb.Examples.Dropdown.Sizes.LargeTest do
+ use MoonWeb.ConnCase, async: true
+
+ test "should open", %{conn: conn} do
+ {:ok, view, _html} = live(conn, "/example/DropdownExample.Sizes")
+
+ assert view
+ |> element("#drop-sizes-lg div[aria-haspopup=true]")
+ |> has_element?()
+
+ assert view |> element("#drop-sizes-lg div.hidden[role=listbox]") |> has_element?()
+
+ view
+ |> element("#drop-sizes-lg div[aria-haspopup=true]")
+ |> render_click()
+
+ assert view |> element("#drop-sizes-lg div[role=listbox]") |> has_element?()
+ refute view |> element("#drop-sizes-lg div.hidden[role=listbox]") |> has_element?()
+ end
+
+ test "should select", %{conn: conn} do
+ {:ok, view, _html} = live(conn, "/example/DropdownExample.Sizes")
+
+ select = view |> element("#drop-sizes-lg div[aria-haspopup=true]")
+
+ select |> render_click()
+
+ view
+ |> element("#drop-sizes-lg div[role=listbox] button:first-child")
+ |> render_click()
+
+ # TODO: assert select |> render() ("button[class=bg-heles]")" should it be checked based on bg-colour? and if checkbox is checked?
+
+ # assert view |> element("#drop-sizes-lg div.hidden[role=listbox]") |> has_element?()
+ end
+
+ # TODO: add screenshot test of default state, hover state, open state, selected state
+end
diff --git a/test/moon_web/examples/dropdown/sizes/md_test.exs b/test/moon_web/examples/dropdown/sizes/md_test.exs
index e69de29bb..302225878 100644
--- a/test/moon_web/examples/dropdown/sizes/md_test.exs
+++ b/test/moon_web/examples/dropdown/sizes/md_test.exs
@@ -0,0 +1,38 @@
+defmodule MoonWeb.Examples.Dropdown.Sizes.MediumTest do
+ use MoonWeb.ConnCase, async: true
+
+ test "should open", %{conn: conn} do
+ {:ok, view, _html} = live(conn, "/example/DropdownExample.Sizes")
+
+ assert view
+ |> element("#drop-sizes-md div[aria-haspopup=true]")
+ |> has_element?()
+
+ assert view |> element("#drop-sizes-md div.hidden[role=listbox]") |> has_element?()
+
+ view
+ |> element("#drop-sizes-md div[aria-haspopup=true]")
+ |> render_click()
+
+ assert view |> element("#drop-sizes-md div[role=listbox]") |> has_element?()
+ refute view |> element("#drop-sizes-md div.hidden[role=listbox]") |> has_element?()
+ end
+
+ test "should select", %{conn: conn} do
+ {:ok, view, _html} = live(conn, "/example/DropdownExample.Sizes")
+
+ select = view |> element("#drop-sizes-md div[aria-haspopup=true]")
+
+ select |> render_click()
+
+ view
+ |> element("#drop-sizes-md div[role=listbox] button:first-child")
+ |> render_click()
+
+ # TODO: assert select |> render() ("button[class=bg-heles]")" should it be checked based on bg-colour? and if checkbox is checked?
+
+ # assert view |> element("#drop-sizes-md div.hidden[role=listbox]") |> has_element?()
+ end
+
+ # TODO: add screenshot test of default state, hover state, open state, selected state
+end
diff --git a/test/moon_web/examples/dropdown/sizes/sm_test.exs b/test/moon_web/examples/dropdown/sizes/sm_test.exs
index e69de29bb..94cf48991 100644
--- a/test/moon_web/examples/dropdown/sizes/sm_test.exs
+++ b/test/moon_web/examples/dropdown/sizes/sm_test.exs
@@ -0,0 +1,38 @@
+defmodule MoonWeb.Examples.Dropdown.Sizes.SmallTest do
+ use MoonWeb.ConnCase, async: true
+
+ test "should open", %{conn: conn} do
+ {:ok, view, _html} = live(conn, "/example/DropdownExample.Sizes")
+
+ assert view
+ |> element("#drop-sizes-sm div[aria-haspopup=true]")
+ |> has_element?()
+
+ assert view |> element("#drop-sizes-sm div.hidden[role=listbox]") |> has_element?()
+
+ view
+ |> element("#drop-sizes-sm div[aria-haspopup=true]")
+ |> render_click()
+
+ assert view |> element("#drop-sizes-sm div[role=listbox]") |> has_element?()
+ refute view |> element("#drop-sizes-sm div.hidden[role=listbox]") |> has_element?()
+ end
+
+ test "should select", %{conn: conn} do
+ {:ok, view, _html} = live(conn, "/example/DropdownExample.Sizes")
+
+ select = view |> element("#drop-sizes-sm div[aria-haspopup=true]")
+
+ select |> render_click()
+
+ view
+ |> element("#drop-sizes-sm div[role=listbox] button:first-child")
+ |> render_click()
+
+ # TODO: assert select |> render() ("button[class=bg-heles]")" should it be checked based on bg-colour? and if checkbox is checked?
+
+ # assert view |> element("#drop-sizes-sm div.hidden[role=listbox]") |> has_element?()
+ end
+
+ # TODO: add screenshot test of default state, hover state, open state, selected state
+end
diff --git a/test/moon_web/examples/dropdown/trigger_elements/button_test.exs b/test/moon_web/examples/dropdown/trigger_elements/button_test.exs
index 8afa578b4..c723becde 100644
--- a/test/moon_web/examples/dropdown/trigger_elements/button_test.exs
+++ b/test/moon_web/examples/dropdown/trigger_elements/button_test.exs
@@ -33,5 +33,5 @@ defmodule MoonWeb.Examples.Dropdown.TriggerElements.ButtonTest do
assert view |> element("#dropdown-trigger-02 div.hidden[role=listbox]") |> has_element?()
end
- # TODO: should screenshot test be added down here or separate?
+ # TODO: add screenshot test of default state, hover state, open non-selected state, open selected state
end
diff --git a/test/moon_web/examples/dropdown/trigger_elements/chip_with_arrow_test.exs b/test/moon_web/examples/dropdown/trigger_elements/chip_with_arrow_test.exs
index c7e8fe713..4294b9514 100644
--- a/test/moon_web/examples/dropdown/trigger_elements/chip_with_arrow_test.exs
+++ b/test/moon_web/examples/dropdown/trigger_elements/chip_with_arrow_test.exs
@@ -36,5 +36,5 @@ defmodule MoonWeb.Examples.Dropdown.TriggerElements.ChipWithArrowTest do
assert view |> element("#dropdown-trigger-03 div.hidden[role=listbox]") |> has_element?()
end
- # TODO: should screenshot test be added down here or separate?
+ # TODO: add screenshot test of default state, hover state, open non-selected state, open selected state
end
diff --git a/test/moon_web/examples/dropdown/trigger_elements/icon_button_test.exs b/test/moon_web/examples/dropdown/trigger_elements/icon_button_test.exs
index 2e300ca24..0ac9c42ff 100644
--- a/test/moon_web/examples/dropdown/trigger_elements/icon_button_test.exs
+++ b/test/moon_web/examples/dropdown/trigger_elements/icon_button_test.exs
@@ -36,5 +36,5 @@ defmodule MoonWeb.Examples.Dropdown.TriggerElements.IconButtonTest do
assert view |> element("#dropdown-trigger-01 div.hidden[role=listbox]") |> has_element?()
end
- # TODO: should screenshot test be added down here or separate?
+ # TODO: add screenshot test of default state, hover state, open non-selected state, open selected state
end
From 5b5aac14f4dfc567ef5c6b1dcf760c9ce624527d Mon Sep 17 00:00:00 2001
From: Triin Kullisaar <95503530+tkullisaar@users.noreply.github.com>
Date: Wed, 2 Aug 2023 17:02:40 +0300
Subject: [PATCH 07/11] fixing some existing tests, adding new
---
lib/moon/design/accordion/header.ex | 2 +
.../design/bottom_sheet_example/default.ex | 2 +-
.../design/drawer_example/positions.ex | 8 +-
.../design/drawer_example/with_close.ex | 9 +-
.../accordion/content_outside_test.exs | 123 ++++++++++++++++
.../examples/accordion/default_test.exs | 80 +++++++----
.../examples/accordion/disabled_item_test.exs | 85 +++++++++++
.../accordion/on_change_event_test.exs | 69 +++++++++
.../accordion/open_by_default_test.exs | 41 ++++++
.../examples/accordion/single_open_test.exs | 69 +++++++++
.../examples/accordion/sizes_test.exs | 133 ++++++++++++++++++
test/moon_web/examples/alert/default_test.exs | 3 +
.../examples/alert/handle_close_test.exs | 25 ++++
.../moon_web/examples/avatar/default_test.exs | 3 +
.../bottom_sheet/custom_height_test.exs | 30 ++++
.../examples/bottom_sheet/default_test.exs | 26 ++++
.../bottom_sheet/optional_extras_test.exs | 29 ++++
.../examples/bottom_sheet/responsive_test.exs | 30 ++++
test/moon_web/examples/chip/active_test.exs | 3 +
test/moon_web/examples/chip/default_test.exs | 3 +
.../moon_web/examples/chip/is_stroke_test.exs | 3 +
.../chip/is_stroke_with_icons_test.exs | 3 +
test/moon_web/examples/chip/sizes_test.exs | 3 +
test/moon_web/examples/chip/variants_test.exs | 3 +
.../examples/chip/with_icons_test.exs | 3 +
.../examples/chip/with_on_click_test.exs | 17 +++
.../moon_web/examples/drawer/default_test.exs | 22 +++
.../examples/drawer/positions_test.exs | 71 ++++++++++
.../examples/drawer/with_backdrop_test.exs | 23 +++
.../examples/drawer/with_close_test.exs | 29 ++++
.../moon_web/examples/loader/colours_test.exs | 11 ++
.../moon_web/examples/loader/default_test.exs | 10 ++
test/moon_web/examples/loader/sizes_test.exs | 13 ++
33 files changed, 951 insertions(+), 33 deletions(-)
create mode 100644 test/moon_web/examples/accordion/content_outside_test.exs
create mode 100644 test/moon_web/examples/accordion/disabled_item_test.exs
create mode 100644 test/moon_web/examples/accordion/on_change_event_test.exs
create mode 100644 test/moon_web/examples/accordion/open_by_default_test.exs
create mode 100644 test/moon_web/examples/accordion/single_open_test.exs
create mode 100644 test/moon_web/examples/accordion/sizes_test.exs
create mode 100644 test/moon_web/examples/alert/default_test.exs
create mode 100644 test/moon_web/examples/alert/handle_close_test.exs
create mode 100644 test/moon_web/examples/avatar/default_test.exs
create mode 100644 test/moon_web/examples/bottom_sheet/custom_height_test.exs
create mode 100644 test/moon_web/examples/bottom_sheet/default_test.exs
create mode 100644 test/moon_web/examples/bottom_sheet/optional_extras_test.exs
create mode 100644 test/moon_web/examples/bottom_sheet/responsive_test.exs
create mode 100644 test/moon_web/examples/chip/active_test.exs
create mode 100644 test/moon_web/examples/chip/default_test.exs
create mode 100644 test/moon_web/examples/chip/is_stroke_test.exs
create mode 100644 test/moon_web/examples/chip/is_stroke_with_icons_test.exs
create mode 100644 test/moon_web/examples/chip/sizes_test.exs
create mode 100644 test/moon_web/examples/chip/variants_test.exs
create mode 100644 test/moon_web/examples/chip/with_icons_test.exs
create mode 100644 test/moon_web/examples/chip/with_on_click_test.exs
create mode 100644 test/moon_web/examples/drawer/default_test.exs
create mode 100644 test/moon_web/examples/drawer/positions_test.exs
create mode 100644 test/moon_web/examples/drawer/with_backdrop_test.exs
create mode 100644 test/moon_web/examples/drawer/with_close_test.exs
create mode 100644 test/moon_web/examples/loader/colours_test.exs
create mode 100644 test/moon_web/examples/loader/default_test.exs
create mode 100644 test/moon_web/examples/loader/sizes_test.exs
diff --git a/lib/moon/design/accordion/header.ex b/lib/moon/design/accordion/header.ex
index 07acd74a5..1481dc391 100644
--- a/lib/moon/design/accordion/header.ex
+++ b/lib/moon/design/accordion/header.ex
@@ -30,6 +30,8 @@ defmodule Moon.Design.Accordion.Header do
data-testid={@testid}
type="button"
aria-expanded={"#{@is_open}"}
+ is-content-outside={"#{@is_content_outside}"}
+ size={"#{@size}"}
:on-click={@on_change}
{=@value}
{=@disabled}
diff --git a/lib/moon_web/examples/design/bottom_sheet_example/default.ex b/lib/moon_web/examples/design/bottom_sheet_example/default.ex
index 5ed1a8b44..6c812cd58 100644
--- a/lib/moon_web/examples/design/bottom_sheet_example/default.ex
+++ b/lib/moon_web/examples/design/bottom_sheet_example/default.ex
@@ -30,7 +30,7 @@ defmodule MoonWeb.Examples.Design.BottomSheetExample.Default do
diff --git a/lib/moon_web/examples/design/drawer_example/positions.ex b/lib/moon_web/examples/design/drawer_example/positions.ex
index 75ad1f20d..88134f124 100644
--- a/lib/moon_web/examples/design/drawer_example/positions.ex
+++ b/lib/moon_web/examples/design/drawer_example/positions.ex
@@ -10,7 +10,7 @@ defmodule MoonWeb.Examples.Design.DrawerExample.Positions do
def render(assigns) do
~F"""
-