Skip to content

Commit 323deb7

Browse files
author
spicychickensauce
committed
Remove API guidance test function
1 parent 1b73ce7 commit 323deb7

File tree

1 file changed

+0
-34
lines changed

1 file changed

+0
-34
lines changed

test/lazy_html_test.exs

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -319,40 +319,6 @@ defmodule LazyHTMLTest do
319319
lazy_html = LazyHTML.from_tree([{"html", [], [{"body", [], [{"div", [], []}]}]}])
320320
assert lazy_html |> LazyHTML.query("div") |> ancestor_chain() == ["html", "body", "div"]
321321
end
322-
323-
defp get_css_path(node, acc) do
324-
1 = Enum.count(node)
325-
parent = LazyHTML.parent_node(node)
326-
[tag] = LazyHTML.tag(node)
327-
[i] = LazyHTML.nth_child(node)
328-
329-
if Enum.count(parent) > 0 do
330-
get_css_path(parent, [{tag, i} | acc])
331-
else
332-
[{tag, i} | acc] |> Enum.map_join(" > ", fn {tag, i} -> "#{tag}:nth-child(#{i})" end)
333-
end
334-
end
335-
336-
test "construct nth-child selector by traversing parents" do
337-
lazy_html =
338-
LazyHTML.from_fragment("""
339-
<div>
340-
<div class="wibble">
341-
<span>wibble</span>
342-
</div>
343-
<div class="wobble">
344-
<span>wobble</span>
345-
</div>
346-
</div>
347-
""")
348-
349-
span = LazyHTML.query(lazy_html, ".wobble span")
350-
path = get_css_path(span, [])
351-
assert path == "div:nth-child(1) > div:nth-child(2) > span:nth-child(1)"
352-
353-
span2 = LazyHTML.query(lazy_html, path)
354-
assert LazyHTML.text(span) == LazyHTML.text(span2)
355-
end
356322
end
357323

358324
describe "nth_child/1" do

0 commit comments

Comments
 (0)