TestSelector.Test.FlokiHelpers.find_test_value
You're seeing just the function
find_test_value
, go back to TestSelector.Test.FlokiHelpers module for more information.
Specs
find_test_value(String.t() | Floki.html_tree(), String.t()) :: Floki.html_tree()
Same as find_test_values/2
, but instead of returning a list of elements only
the first elements is returned.
Examples
iex> text = ~S(<a test-selector="hello" test-value="world"></a><a test-selector="foo" test-value="bar"></a>)
iex> find_test_value(text, "bar")
{"a", [{"test-selector", "foo"}, {"test-value", "bar"}], []}
iex> tree = [{"a", [{"test-selector", "hello"}, {"test-value", "world"}], []}, {"a", [{"test-selector", "foo"}, {"test-value", "bar"}], []}]
iex> find_test_value(tree, "world")
{"a", [{"test-selector", "hello"}, {"test-value", "world"}], []}