Make element/3 support html input

29 views
Skip to first unread message

Boris Kuznetsov

unread,
Apr 1, 2021, 3:49:30 AM4/1/21
to phoeni...@googlegroups.com
Hey,

I’m writing tests for Phoenix LiveView and found out that element/3 function is quite convenient to assert that page has certain elements.

Right now I can write something like this

assert view |> element(“table td", "text") |> has_element?()

The issue I have is I want to test a result of change_element/2 function like this as well

html = 
  view 
  |> element("#filter-form") 
  |> render_change(%{filter: %{days: "14"}})
  |> element("table td", “text") 
  |> has_element?()

For now I can use Floki to write something like this 

Floki.find(“.target") |> Emum.find(&has_test(&1, "text"))

It would be great if it would be possible to use element/2 with html input.
Reply all
Reply to author
Forward
0 new messages