Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Cleanup based on kibit output, thank you @jonase

  • Loading branch information...
commit 356016548b64f30d68c98680ae78238c17b4decd 1 parent c9ea592
@semperos authored
View
8 src/clj_webdriver/cache.clj
@@ -136,19 +136,19 @@
(let [excludes (get-in driver [:cache-spec :exclude])]
(if (element? query)
;; WebElement
- (let [excludes (remove #(map? %) excludes)]
+ (let [excludes (remove map? excludes)]
(not (some #{true} (map (fn [f] (f query)) excludes))))
;; xpath, css or ancestry
- (let [excludes (remove #(fn? %) excludes)]
+ (let [excludes (remove fn? excludes)]
(not (some (fn [exclude-item] (= query exclude-item)) excludes)))))
;; handle includes
(let [includes (get-in driver [:cache-spec :include])]
(if (element? query)
;; WebElement
- (let [includes (remove #(map? %) includes)]
+ (let [includes (remove map? includes)]
(some #{true} (map (fn [f] (f query)) includes)))
;; xpath, css or ancestry
- (let [includes (remove #(fn? %) includes)]
+ (let [includes (remove fn? includes)]
(some (fn [include-item] (= query include-item)) includes))))))))
(defn set-status
View
2  src/clj_webdriver/core.clj
@@ -206,7 +206,7 @@
(vector? bindings) "a vector for its binding"
(even? (count bindings)) "an even number of forms in binding vector")
(cond
- (= (count bindings) 0) `(do ~@body)
+ (zero? (count bindings)) `(do ~@body)
(symbol? (bindings 0)) `(let ~(subvec bindings 0 2)
(try
(with-driver ~(subvec bindings 2) ~@body)
View
4 src/clj_webdriver/core_by.clj
@@ -57,7 +57,7 @@
(let [expr (str expr)]
(if (re-find #"\s" expr)
(let [classes (string/split expr #"\s+")
- class-query (apply str (interpose "." classes))]
+ class-query (string/join "." classes)]
(by-css (str "*." class-query)))
(By/className (name expr)))))
@@ -71,7 +71,7 @@
(cond
(= :class attr) (if (re-find #"\s" value)
(let [classes (string/split value #"\s+")
- class-query (apply str (interpose "." classes))]
+ class-query (string/join "." classes)]
(by-css (str (name tag) class-query)))
(by-class-name value))
(= :id attr) (by-id value)
View
10 src/clj_webdriver/core_driver.clj
@@ -231,12 +231,10 @@
(find-elements
([driver attr-val]
- (if (and (or
- (map? attr-val)
- (vector? attr-val))
- (empty? attr-val))
- ;; Return nil, not everything
- nil
+ (when-not (and (or
+ (map? attr-val)
+ (vector? attr-val))
+ (empty? attr-val))
(try
(cond
;; Accept by-clauses
View
5 src/clj_webdriver/core_element.clj
@@ -25,9 +25,8 @@
"truespeed", "willvalidate"]
webdriver-result (.getAttribute (:webelement element) (name attr))]
(if (some #{attr} boolean-attrs)
- (if (= webdriver-result "true")
- attr
- nil)
+ (when (= webdriver-result "true")
+ attr)
webdriver-result))))
(click [element]
Please sign in to comment.
Something went wrong with that request. Please try again.