Skip to content

Commit

Permalink
Added tests for this, including use of self-call
Browse files Browse the repository at this point in the history
  • Loading branch information
fogus committed Sep 30, 2011
1 parent 0725508 commit db0025a
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion test/cljs/cljs/core_test.cljs
Expand Up @@ -726,5 +726,16 @@
(assert (= (assoc fred :lastname "Flintstone") {:firstname "Fred" :lastname "Flintstone"}))
(assert (= (assoc fred :wife :ethel) {:firstname "Fred" :lastname "Mertz" :wife :ethel}))
(assert (= (dissoc ethel :husband) {:firstname "Ethel" :lastname "Mertz"}))

;; extend-object
(let [obj (js* "{}")]
(extend-object obj
{:foo #(do 42)
:bar #(+ 100 (. js/this (foo)))
:baz #(+ % %2)})

(assert (= 42 (. obj (foo))))
(assert (= 142 (. obj (bar))))
(assert (= 3 (. obj baz 1 2))))

:ok)
:ok)

0 comments on commit db0025a

Please sign in to comment.