Skip to content

Commit

Permalink
Revert macro attempt leftover
Browse files Browse the repository at this point in the history
  • Loading branch information
ulisesmac committed Oct 25, 2023
1 parent cb2dfa7 commit 945a0fd
Showing 1 changed file with 7 additions and 25 deletions.
32 changes: 7 additions & 25 deletions src/test_helpers/component.cljs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
(ns test-helpers.component
"Helpers for writing component tests using React Native Testing Library."
(:require-macros [test-helpers.component])
(:require ["@testing-library/react-native" :as rtl]
[camel-snake-kebab.core :as camel-snake-kebab]
[oops.core :as oops]
[quo.theme :as quo.theme]
[reagent.core :as reagent]
[utils.i18n :as i18n]))
(:require-macros test-helpers.component)
(:require
["@testing-library/react-native" :as rtl]
[camel-snake-kebab.core :as camel-snake-kebab]
[quo.theme :as quo.theme]
[reagent.core :as reagent]
[utils.i18n :as i18n]))

;;;; React Native Testing Library

Expand Down Expand Up @@ -233,21 +233,3 @@
([element prop] (has-prop element prop js/undefined))
([element prop value]
(.toHaveProp (js/expect element) (camel-snake-kebab/->camelCaseString prop) value)))

(defn get-rerender-fn
"Rerenders a component.
Takes a JS Object representing a component and returns a function that accepts hiccup
representing the component to rerender with, optionally, the new props.
e.g.
(let [rerender-fn (h/get-rerender-fn
(h/render [my-component {:prop-1 :A
:prop-2 :B}]))]
;; Rerenders `my-component` with the new props
(rerender-fn [my-component {:prop-1 :new-A
:prop-2 :new-B}]))
"
[component]
(fn [component-updated]
(let [rerender-fn (oops/oget component "rerender")
react-element (reagent/as-element component-updated)]
(rerender-fn react-element))))

0 comments on commit 945a0fd

Please sign in to comment.