Skip to content

Commit

Permalink
fix :fn/text && :fn/has-text (#284)
Browse files Browse the repository at this point in the history
* fix :fn/text && :fn/has-text
  • Loading branch information
Uunnamed authored Aug 13, 2020
1 parent 47fdc17 commit 770b8ba
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions resources/html/test.html
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ <h3>Find text with quote</h3>
<div id="wc3-barks">
<p>
<span class="crypt-lord">
<!-- -->
From the depths I've come!
</span>
</p>
Expand Down
2 changes: 1 addition & 1 deletion src/etaoin/xpath.clj
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@

(defmethod clause :fn/has-text
[[_ text]]
(node-contains "text()" text))
(node-contains "string()" text))

(defmethod clause :fn/has-class
[[_ class]]
Expand Down
2 changes: 2 additions & 0 deletions test/etaoin/api_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -688,6 +688,8 @@
(-> (has-text? "'quote") is)))

(deftest test-has-text
(testing "test :fn/has-text"
(is (boolean (query *driver* {:fn/has-text "From the depth"}))))
(testing "gloval"
(is (has-text? *driver* "From the depths I've come!"))
(is (has-text? *driver* "I've come from the dark")))
Expand Down
2 changes: 1 addition & 1 deletion test/etaoin/xpath_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

[{:tag :button :fn/text "Press Me"} ".//button[text()=\"Press Me\"]"]

[{:fn/has-text "download"} ".//*[contains(text(), \"download\")]"]
[{:fn/has-text "download"} ".//*[contains(string(), \"download\")]"]

[{:tag :div :fn/has-class "overlay"} ".//div[contains(@class, \"overlay\")]"]

Expand Down

0 comments on commit 770b8ba

Please sign in to comment.