             [cljs.pprint :refer [pprint write]]
             [cljs-morphic.morph :refer [redefine
                                         move-morph without set-prop add-morphs-to add-morph
-                                        submorphs properties description changes $morph it morph-lens]])
+                                        submorphs properties description optimization changes $morph it morph-lens =>]])
   (:require-macros [cljs.test :refer (is deftest run-tests testing)]
                    [cljs-morphic.macros :refer [rectangle ellipse image]]))
 

  
  (testing "Redefining the submorphs of an abstraction causes the abstraction to be redefined."
    (is (= (-> expression-world
             (set-prop "miso" :position {:x 0 :y 0})
             (fetch [($morph "c") submorphs 0 description]))
           (with-out-str 
             (pprint '(-> (japanese-kitchen {:x 42 :y 42})
                        (set-prop "miso" :position {:x 0 :y 0}))))))
    (is (= (-> expression-world 
             (add-morph "miso" (ellipse {:id "sakana" :fill "blue"}))
             (fetch [($morph "c") submorphs 0 description]))

(deftest test-loop-mapping
  (testing "Changing an unbound property of a looped morph, alters the prototype"
    (is (= (-> expression-world
             (putback [($morph "b") submorphs 0 submorphs 1 properties :position] {:x 0 :y 0})
             (putback [($morph "b") submorphs 0 submorphs 1 properties :fill] "red")
             (fetch optimization))
           (with-out-str 
             (pprint '(rectangle {:id "world" :position {:x 0 :y 0}}
                                 (ellipse {:id "b" :position {:x 42 :y 42}}
                                          (map (fn [a b]
                                                 (ellipse {:id (str a b)
                                                           :extent {:x a :y b}
                                                           :position {:x 0 :y 0}
                                                           :fill "red"})) (range 3) (range 3))
                                          (ellipse {:id "tea" :fill "black"})
                                          (ellipse {:id "milk" :fill "white"}))
