Skip to content

Commit

Permalink
Fix :fn/enabled (#662)
Browse files Browse the repository at this point in the history
* Fix :fn/enabled

* Fix :fn/enabled and :fn/disabled unit tests
  • Loading branch information
dgr authored Sep 13, 2024
1 parent f2003d4 commit 5820ec6
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ A release with an intentional breaking changes is marked with:
** {issue}647[#647]: Fix logic bug in `intersects?`. Added tests to test suite. ({person}dgr[@dgr])
** {issue}649[#649]: When supplied a vector argument for `q-text`, `fill-multi` and `fill-human-multi` now fill fields in the order that fields appear in the vector. Previously, the order was not guaranteed. ({person}dgr[@dgr])
** {issue}657[#657]: Make `set-<xyz>-timeout` functions resilient to reasonable non-integer timeouts (e.g., rationals, doubles, etc.). ({person}dgr[@dgr])
** {issue}661[#661]: Fix `:fn/enabled`. ({person}dgr[@dgr])
* Docs
** {issue}656[#656]: Correctly describe behavior when query's parameter is a string. The User Guide and `query` doc strings say that a string passed to `query` is interpreted as an XPath expression. In fact, `query` interprets this as either XPath or CSS depending on the setting of the driver's `:locator` parameter, which can be changed. ({person}dgr[@dgr])

Expand Down
2 changes: 1 addition & 1 deletion src/etaoin/impl/xpath.clj
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@

(defmethod clause :fn/enabled
[[_ bool]]
(node-boolean "@enabled" bool))
(node-boolean "@disabled" (not bool)))

(defmethod clause :fn/index
[[_ idx]]
Expand Down
9 changes: 6 additions & 3 deletions test/etaoin/unit/xpath_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,13 @@

[{:tag :input :fn/disabled true} ".//input[@disabled=true()]"]

[{:tag :input :fn/enabled false} ".//input[@enabled=false()]"]
[{:tag :input :fn/enabled false} ".//input[@disabled=true()]"]

[{:tag :a :fn/link "yandex"} ".//a[contains(@href, \"yandex\")]"]
])
[{:tag :input :fn/disabled false} ".//input[@disabled=false()]"]

[{:tag :input :fn/enabled true} ".//input[@disabled=false()]"]

[{:tag :a :fn/link "yandex"} ".//a[contains(@href, \"yandex\")]"]])

(deftest test-xpath-expand
(doseq [[q xpath] xpath-samples]
Expand Down

0 comments on commit 5820ec6

Please sign in to comment.