Skip to content

Commit

Permalink
allow nil app node id
Browse files Browse the repository at this point in the history
  • Loading branch information
Bruce Hauman committed Jun 24, 2018
1 parent 52a238c commit d844f4a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ browser you can use `cljs-test-display`.

<img src="https://s3.amazonaws.com/bhauman-blog-images/cljs-test-display-tab.png" width="500"/>

* Numbered stacktraces for exceptions in the dev console
* Numbered stacktraces for test exceptions in the dev console

<img src="https://s3.amazonaws.com/bhauman-blog-images/cljs-test-display-error-stacktrace.png" width="500"/>

Expand All @@ -40,6 +40,7 @@ browser you can use `cljs-test-display`.
* Straightforward integration

```clojure
;; where "app" is the HTML node where you want to mount the tests
(cljs.test/run-tests
(cljs-test.display.core/init! "app") ;;<-- initialize cljs-test-display here
'example.foo-test
Expand Down
14 changes: 7 additions & 7 deletions src/cljs_test_display/core.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -400,17 +400,17 @@
'example.core-other-test)"
([] (init! nil))
([app-node-id]
(assert (or (string? app-node-id)
(symbol? app-node-id)
(keyword? app-node-id))
"Must provide an something we can call cljs.core/name on.")
(assert (gdom/getElement (name app-node-id))
(when app-node-id
(assert (or (string? app-node-id)
(symbol? app-node-id)
(keyword? app-node-id))
"Must provide an something we can call cljs.core/name on.")
(set! root-node-id (name app-node-id)))
(assert (gdom/getElement (name root-node-id))
(str "cljs-test-display: Element with id "
(pr-str root-node-id)
" does not exist."))
(when notifications (notify/ask-permission!))
(when app-node-id
(set! root-node-id (name app-node-id)))
(insert-style!)
(register-document-events!)
(set! (.-innerHTML (root-app-node)) "")
Expand Down

0 comments on commit d844f4a

Please sign in to comment.