mirror of
https://github.com/plausible/analytics.git
synced 2024-11-23 11:12:15 +03:00
b3ff695797
* Add Heroicons dependency
* Add name_of/1 html helper
Currently with Floki there's no way to query for
`[name=foo[some]]` selector
* Update changelog
* Make goal deletion possible with only goal id
* Remove stale goal controllers
* Improve ComboBox component
- make sure the list options are always of the parent input width
- allow passing a suggestion function instead of a module
* Stale fixup
* Update routes
* Use the new goals route in funnel settings
* Use a function in the funnel combo
* Use function in the props combo
* Remove old goals form
* Implement new goal settings
* Update moduledoc
* Fix revenue switch in dark mode
* Connect live socket on goal settings page
* Fixup
* Use Heroicons.trash icon
* Tweak goals search input
* Remove unused alias
* Fix search/button alignment
* Fix backspace icon alignment
* Delegate :superadmin check to get_for_user/3
I'll do props settings separately, it's work in progress
in a branch on top of this one already. cc @ukutaht
* Rename socket assigns
* Fixup to 5c9f58e
* Fixup
* Render ComboBox suggestions asynchronously
This commit:
- prevents redundant work by checking the socket connection
- allows passing no options to the ComboBox component,
so that when combined with the `async` option, the options
are asynchronously initialized post-render
- allows updating the suggestions asynchronously with the
`async` option set to `true` - helpful in case of DB
queries used for suggestions
* Update tests
* Throttle comboboxes
* Update tests
* Dim the search input
* Use debounce=200 in ComboBox component
* Move creatable option to the top
* Ensure there's always a leading slash for goals
* Test pageview goals with leading / missing
* Make the modal scrollable on small viewports
45 lines
888 B
Elixir
45 lines
888 B
Elixir
defmodule Plausible.Test.Support.HTML do
|
|
@moduledoc """
|
|
Floki wrappers to help make assertions about HTML/DOM structures
|
|
"""
|
|
|
|
def element_exists?(html, selector) do
|
|
html
|
|
|> find(selector)
|
|
|> Enum.empty?()
|
|
|> Kernel.not()
|
|
end
|
|
|
|
def find(html, value) do
|
|
html
|
|
|> Floki.parse_document!()
|
|
|> Floki.find(value)
|
|
end
|
|
|
|
def submit_button(html, form) do
|
|
find(html, "#{form} button[type=\"submit\"]")
|
|
end
|
|
|
|
def form_exists?(html, action_path) do
|
|
element_exists?(html, "form[action=\"" <> action_path <> "\"]")
|
|
end
|
|
|
|
def text_of_element(html, element) do
|
|
html
|
|
|> find(element)
|
|
|> Floki.text()
|
|
|> String.trim()
|
|
end
|
|
|
|
def text_of_attr(element, attr) do
|
|
element
|
|
|> Floki.attribute(attr)
|
|
|> Floki.text()
|
|
|> String.trim()
|
|
end
|
|
|
|
def name_of(element) do
|
|
List.first(Floki.attribute(element, "name"))
|
|
end
|
|
end
|