<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>specs/spec_helper.js</filename>
    </added>
    <added>
      <filename>specs/suite.html</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -29,9 +29,9 @@ Screw.Unit(function() {
             MBX.JsController.destroyController('PrototypeTestController');
         });
         
-        it(&quot;should call afterCreate if it exists&quot;, function () {
+        it(&quot;should call initialize if it exists&quot;, function () {
             var thisController = MBX.JsController.create(&quot;ATestController&quot;, {
-                afterCreate: function () {
+                initialize: function () {
                     this.anAfterCreateAttr = &quot;cool&quot;;
                 }
             });
@@ -39,6 +39,35 @@ Screw.Unit(function() {
             MBX.JsController.destroyController(&quot;ATestController&quot;);
         });
         
+        describe(&quot;loosely coupled controllers&quot;, function () {
+            var MyModel;
+            before(function() {
+                Screw.MBXlooselyCoupledFired = false;
+                MyModel = MBX.JsModel.create(&quot;MyModel&quot;);
+                MyController = MBX.JsController.create(&quot;MyModelController&quot;, {
+                    model: MyModel,
+                    looselyCoupled: true,
+                    onInstanceCreate: function () {
+                        Screw.MBXlooselyCoupledFired = true;
+                    }
+                });
+            });
+            
+            after(function () {
+                MBX.JsModel.destroyModel(&quot;MyModel&quot;);
+            });
+            
+            it(&quot;should defer the subscription when loosely coupled&quot;, function (me) {
+                MyModel.create();
+                expect(Screw.MBXlooselyCoupledFired).to(be_false);
+                using(me).wait(2).and_then(function () {
+                    expect(Screw.MBXlooselyCoupledFired).to(be_true);
+                });
+            });
+            
+            
+        });
+        
         describe(&quot;a new controller with a model&quot;, function () {
            var MyModel;
            before(function () {
@@ -62,10 +91,6 @@ Screw.Unit(function() {
                expect(eventSubscriptions[2]).to(equal, [MBX, MyModel.Event.destroyInstance]);
            });
            
-           it(&quot;should be able to find an instance given a valid DOM element&quot;, function () {
-               var el = $$(&quot;.mymodel .mymodel_&quot;)
-           });
-           
            describe(&quot;callbacks&quot;, function () {
               var lastCallback, instance;
               before(function () {</diff>
      <filename>specs/specs/js_controller_spec.js</filename>
    </modified>
    <modified>
      <diff>@@ -9,6 +9,16 @@ Screw.Unit(function() {
             expect(MBX.JsModel.Event.newModel).to_not(be_null);
         });
         
+        it(&quot;should call initialize on the model if it exists&quot;, function () {
+            var called = false;
+            MyModel = MBX.JsModel.create(&quot;MyModel&quot;, {
+                initialize: function () {
+                    called = true;
+                }
+            });
+            expect(called).to(be_true);
+        });
+        
         it(&quot;should allow you to specify an afterCreate that gets executed after an instance is created&quot;, function () {
             MyModel = MBX.JsModel.create(&quot;MyModel&quot;, {
                 instanceMethods: {</diff>
      <filename>specs/specs/js_model_spec.js</filename>
    </modified>
    <modified>
      <diff>@@ -22,6 +22,16 @@ Screw.Unit(function() {
             expect(MyView.newAttr).to(equal, &quot;cool&quot;);
         });
         
+        it(&quot;should call initialize&quot;, function () {
+            var called = false;
+            MyModel = MBX.JsView.create({
+                initialize: function () {
+                    called = true;
+                }
+            });
+            expect(called).to(be_true);
+        });
+        
         describe(&quot;extended prototype elements&quot;, function () {
             
             it(&quot;should extend elements&quot;, function () {
@@ -272,5 +282,28 @@ Screw.Unit(function() {
              
         });
         
+        describe(&quot;loosely coupled view&quot;, function () {
+            before(function() {
+                Screw.MBXlooselyCoupledViewFired = false;
+                MyController = MBX.JsView.create({
+                    model: MyModel,
+                    looselyCoupled: true,
+                    onInstanceCreate: function () {
+                        Screw.MBXlooselyCoupledViewFired = true;
+                    }
+                });
+            });
+            
+            it(&quot;should defer the subscription when loosely coupled&quot;, function (me) {
+                MyModel.create();
+                expect(Screw.MBXlooselyCoupledViewFired).to(be_false);
+                using(me).wait(2).and_then(function () {
+                    expect(Screw.MBXlooselyCoupledViewFired).to(be_true);
+                });
+            });
+            
+            
+        });
+        
     });
 });</diff>
      <filename>specs/specs/js_view_spec.js</filename>
    </modified>
    <modified>
      <diff>@@ -31,11 +31,6 @@ Screw.Unit(function() {
                 queue.add(function () {
                     called++;
                 });
-                
-                // make the event fire right away even though we're allowing the eventhandler
-                // to defer this
-                //TH.setTimeout.mock();
-                
                 expect(MBX.QueueController.subscriptions[queue.primaryKey()]).to_not(be_null);
                 MBX.EventHandler.fireCustom(queue, &quot;timer_complete&quot;, {
                     queue: queue</diff>
      <filename>specs/specs/queue_controller_spec.js</filename>
    </modified>
    <modified>
      <diff>@@ -128,7 +128,7 @@ MBX.JsController = (function () {
             var newEvent = this.model.Event.newInstance;
             var destroyEvent = this.model.Event.destroyInstance;
             var attributeEvent = this.model.Event.changeAttribute;
-            var defer = this.loosleyCoupled;
+            var defer = this.looselyCoupled;
 
             this.eventSubscriptions = [];
             this.eventSubscriptions.push(MBX.EventHandler.subscribe(MBX, changeEvent, this._onInstanceChange.bind(this), {defer: defer}));
@@ -174,7 +174,7 @@ MBX.JsController = (function () {
     
     /**
         Controllers allow some decently powerful hooks. You can specify a model, and an
-        onAfterCreate, onInstanceChange, onInstanceDestroy, onInstanceCreate.
+        onInstanceChange, onInstanceDestroy, onInstanceCreate.
         
         If your controller listens to a model, but you are not dependent on real-time updates,
         you can add the option &quot;looselyCoupled: true&quot; and all updates will be done with
@@ -215,8 +215,8 @@ MBX.JsController = (function () {
             throw new Error(&quot;A controller with the name of &quot; + name + &quot; is already in use&quot;);
         }
         var controller = new JsController(name, opts);
-        if (typeof controller.afterCreate == &quot;function&quot;) {
-            controller.afterCreate();
+        if (typeof controller.initialize == &quot;function&quot;) {
+            controller.initialize();
         }
         return controller;
     };</diff>
      <filename>src/js_controller.js</filename>
    </modified>
    <modified>
      <diff>@@ -69,8 +69,8 @@ MBX.JsView = (function () {
             this._subscribeToEvents();
         }
         
-        if (typeof this.afterCreate == 'function') {
-            this.afterCreate();
+        if (typeof this.initialize == 'function') {
+            this.initialize();
         }
     };
     </diff>
      <filename>src/js_view.js</filename>
    </modified>
  </modified>
  <removed type="array">
    <removed>
      <filename>specs/mvc_spec_helper.js</filename>
    </removed>
    <removed>
      <filename>specs/mvc_suite.html</filename>
    </removed>
  </removed>
  <parents type="array">
    <parent>
      <id>7b9cb934e01d924c190c8be13323826e9341a8a3</id>
    </parent>
  </parents>
  <author>
    <name>topper</name>
    <email>topper@toppingdesign.com</email>
  </author>
  <url>http://github.com/tobowers/mamoo/commit/3d05bbe727bc547e0eecc4bb4a2748d1d35c28e3</url>
  <id>3d05bbe727bc547e0eecc4bb4a2748d1d35c28e3</id>
  <committed-date>2009-03-15T09:18:09-07:00</committed-date>
  <authored-date>2009-03-15T09:18:09-07:00</authored-date>
  <message>spec out the looselyCoupled options on controllers and views</message>
  <tree>8c07e8e4076758702d22653aa14492a7a826fbf3</tree>
  <committer>
    <name>topper</name>
    <email>topper@toppingdesign.com</email>
  </committer>
</commit>
