File tree Expand file tree Collapse file tree 6 files changed +17
-44
lines changed Expand file tree Collapse file tree 6 files changed +17
-44
lines changed Original file line number Diff line number Diff line change @@ -67,10 +67,7 @@ my-app
6767| └── favicon.ico
6868└── src
6969 ├── app
70- | ├── cards
71- | | ├── devcards_runner.cljs
72- | | ├── helpers.cljs
73- | | └── test_runner.cljs
70+ | ├── cards.cljs
7471 | ├── core.cljs
7572 | ├── hello.cljs
7673 | └── hello_cards.cljs
Original file line number Diff line number Diff line change 44 :output-dir " public/js"
55 :target :browser }
66 :cards {:asset-path " /js"
7- :modules {:main {:init-fn app.cards.devcards-runner /main}}
7+ :modules {:main {:init-fn app.cards/main}}
88 :compiler-options {:devcards true }
99 :output-dir " public/js"
1010 :target :browser }
11- :test {:main app.cards.test-runner/main
11+ :test {:ns-regexp " app.cards"
1212 :output-to " out/test.js"
1313 :target :node-test }
1414 :e2e {:ns-regexp " e2e.*"
Original file line number Diff line number Diff line change 1- (ns app.cards.devcards-runner
1+ (ns app.cards
22 (:require [cljsjs.react]
33 [cljsjs.react.dom]
44 ; devcards needs cljsjs.react and cljsjs.react.dom to be imported
55 ; separately for shadow-cljs to add shims.
66 [devcards.core :refer [start-devcard-ui!]]
7+ [" jsdom-global" :as jsdom-global]
78 ; Import all namespaces with cards here to load them.
89 [app.hello-cards]))
910
11+ ; Set jsdom to mock a dom environment for node testing.
12+ (jsdom-global )
13+
1014(defn ^:export main
1115 " Start the devcards UI."
1216 []
Load Diff This file was deleted.
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 33 [devcards.core :as dc :refer [defcard deftest ]]
44 [cljs.test :include-macros true :refer [is]]
55 [" @testing-library/react" :refer [render cleanup fireEvent]]
6- [app.hello :refer [click-counter hello]]
7- [app.cards.helpers :refer [testing-container]]))
6+ [app.hello :refer [click-counter hello]]))
7+
8+ (defn testing-container
9+ " The container that should be used to render testing-library react components.
10+ We want to provide our own container so that the rendered devcards aren't used."
11+ []
12+ (let [app-div (js/document.createElement " div" )]
13+ (.setAttribute app-div " id" " testing-lib" )
14+ (js/document.body.appendChild app-div)))
815
916(defcard
1017 " This is a live interactive development environment using [Devcards](https://github.com/bhauman/devcards).
You can’t perform that action at this time.
0 commit comments