Permalink
Browse files

Added tests for this, including use of self-call

  • Loading branch information...
1 parent 0725508 commit db0025a935afc67b6d46cc8d21521a9626a768be @fogus fogus committed Sep 16, 2011
Showing with 12 additions and 1 deletion.
  1. +12 −1 test/cljs/cljs/core_test.cljs
@@ -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.