From a700224986c98563fde68bf0d4a12f62cb7cd415 Mon Sep 17 00:00:00 2001 From: Andrew Suzuki Date: Mon, 13 Jun 2016 10:27:07 -0400 Subject: [PATCH] more test setup --- Makefile | 7 +++++-- README.md | 3 ++- src/cljs/ulysses/utils.cljs | 4 ++-- test/cljs/ulysses/core_test.cljs | 2 +- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index ecbafbe..3a60616 100644 --- a/Makefile +++ b/Makefile @@ -46,6 +46,9 @@ start: @lein figwheel test: - lein doo phantom test + lein doo phantom test once -.PHONY: help clean build-cljs install sass-dev sass-watch build start test +test-watch: + lein doo phantom test auto + +.PHONY: help clean build-cljs install sass-dev sass-watch build start test test-watch diff --git a/README.md b/README.md index ab93664..14b8426 100644 --- a/README.md +++ b/README.md @@ -79,7 +79,8 @@ rebuild when a file changes. also builds sourcemaps. ```sh # npm install -g phantomjs-prebuilt -make test +make test # execute tests once and exit +make test-watch # execute tests on file changes ``` the above command assumes that you have [phantomjs](https://www.npmjs.com/package/phantomjs) installed. however, please note that [doo](https://github.com/bensu/doo) can be configured to run cljs.test in many other js environments (phantom, chrome, ie, safari, opera, slimer, node, rhino, or nashorn). diff --git a/src/cljs/ulysses/utils.cljs b/src/cljs/ulysses/utils.cljs index 8ebcbef..84be88e 100644 --- a/src/cljs/ulysses/utils.cljs +++ b/src/cljs/ulysses/utils.cljs @@ -273,8 +273,8 @@ "get the :width and :height of the current document" [] (let [d js/document - body (.-body d) - de (.-documentElement d)] + body (or (.-body d) #js {}) + de (or (.-documentElement d) #js {})] {:width (max (.-scrollWidth body) (.-offsetWidth body) (.-clientWidth de) (.-scrollWidth de) (.-offsetWidth de)) diff --git a/test/cljs/ulysses/core_test.cljs b/test/cljs/ulysses/core_test.cljs index d75bb75..2051463 100644 --- a/test/cljs/ulysses/core_test.cljs +++ b/test/cljs/ulysses/core_test.cljs @@ -4,4 +4,4 @@ (deftest fake-test (testing "fake description" - (is (= 1 2)))) + (is (= 2 2))))