Skip to content

Commit 5820ec6

Browse files
authored
Fix :fn/enabled (#662)
* Fix :fn/enabled * Fix :fn/enabled and :fn/disabled unit tests
1 parent f2003d4 commit 5820ec6

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

CHANGELOG.adoc

+1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ A release with an intentional breaking changes is marked with:
3030
** {issue}647[#647]: Fix logic bug in `intersects?`. Added tests to test suite. ({person}dgr[@dgr])
3131
** {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])
3232
** {issue}657[#657]: Make `set-<xyz>-timeout` functions resilient to reasonable non-integer timeouts (e.g., rationals, doubles, etc.). ({person}dgr[@dgr])
33+
** {issue}661[#661]: Fix `:fn/enabled`. ({person}dgr[@dgr])
3334
* Docs
3435
** {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])
3536

src/etaoin/impl/xpath.clj

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979

8080
(defmethod clause :fn/enabled
8181
[[_ bool]]
82-
(node-boolean "@enabled" bool))
82+
(node-boolean "@disabled" (not bool)))
8383

8484
(defmethod clause :fn/index
8585
[[_ idx]]

test/etaoin/unit/xpath_test.clj

+6-3
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,13 @@
2222

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

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

27-
[{:tag :a :fn/link "yandex"} ".//a[contains(@href, \"yandex\")]"]
28-
])
27+
[{:tag :input :fn/disabled false} ".//input[@disabled=false()]"]
28+
29+
[{:tag :input :fn/enabled true} ".//input[@disabled=false()]"]
30+
31+
[{:tag :a :fn/link "yandex"} ".//a[contains(@href, \"yandex\")]"]])
2932

3033
(deftest test-xpath-expand
3134
(doseq [[q xpath] xpath-samples]

0 commit comments

Comments
 (0)