Skip to content

Commit

Permalink
Add assertion: find-in-text in a child selector
Browse files Browse the repository at this point in the history
  • Loading branch information
Mertzenich committed Mar 2, 2024
1 parent 3404b2e commit 2677840
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion test/cljc/hickory/test/select.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,15 @@
(= :h1 (-> selection first :tag)))))
(let [selection (select/select (select/find-in-text #"Div") htree)]
(is (and (= 1 (count selection))
(= :div (-> selection first :tag))))))
(= :div (-> selection first :tag)))))
(let [selection-locs (select/select-locs
(select/child (select/tag :body)
(select/find-in-text #"Paragraph"))
htree)
selection (mapv zip/node selection-locs)]
(is (and (= 1 (count selection))
(= :p (-> selection first :tag))
(= :body (-> selection-locs first zip/up zip/node :tag))))))
(let [htree (hickory/as-hickory (hickory/parse html2))]
(let [selection (select/select (select/find-in-text #"Paragraph") htree)]
(is (and (= 8 (count selection))
Expand Down

0 comments on commit 2677840

Please sign in to comment.