Skip to content

Commit 2677840

Browse files
committed
Add assertion: find-in-text in a child selector
1 parent 3404b2e commit 2677840

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

test/cljc/hickory/test/select.cljc

+9-1
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,15 @@
230230
(= :h1 (-> selection first :tag)))))
231231
(let [selection (select/select (select/find-in-text #"Div") htree)]
232232
(is (and (= 1 (count selection))
233-
(= :div (-> selection first :tag))))))
233+
(= :div (-> selection first :tag)))))
234+
(let [selection-locs (select/select-locs
235+
(select/child (select/tag :body)
236+
(select/find-in-text #"Paragraph"))
237+
htree)
238+
selection (mapv zip/node selection-locs)]
239+
(is (and (= 1 (count selection))
240+
(= :p (-> selection first :tag))
241+
(= :body (-> selection-locs first zip/up zip/node :tag))))))
234242
(let [htree (hickory/as-hickory (hickory/parse html2))]
235243
(let [selection (select/select (select/find-in-text #"Paragraph") htree)]
236244
(is (and (= 8 (count selection))

0 commit comments

Comments
 (0)