Skip to content
This repository
Browse code

encorporating feedback from PR

  • Loading branch information...
commit 8b973bcca871bf3f4268dd9768e2cfb53cf230d5 1 parent 47218d0
Drew Folta authored
2  lib/app/autoload/mojito-client.client.js
@@ -339,7 +339,7 @@ YUI.add('mojito-client', function(Y, NAME) {
339 339
                     globalHookHandler: globalHookHandler
340 340
                 };
341 341
 
342  
-            this.page.staticAppConfig = config.appConfig;
  342
+            this.page.staticAppConfig = appConfig;
343 343
 
344 344
             fireLifecycle('pre-init', forwardConfig);
345 345
             // if we didn't originaly have hooks enabled, copy back from config object.
14  tests/base/mojito-test.js
@@ -65,7 +65,19 @@ YUI.add('mojito-hb', function(Y, NAME) {});
65 65
 
66 66
 /* AUTOLOAD */
67 67
 YUI.add('mojito-action-context', function(Y, NAME) {});
68  
-YUI.add('mojito-dispatcher', function(Y, NAME) {});
  68
+YUI.add('mojito-dispatcher', function(Y, NAME) {
  69
+    // We need to grab the output handler while testing lib/mojito.js.
  70
+    var mock = {
  71
+        init: function(store) {
  72
+            return {
  73
+                dispatch: function(command, outputHandler) {
  74
+                    mock.outputHandler = outputHandler;
  75
+                }
  76
+            };
  77
+        }
  78
+    };
  79
+    Y.namespace('mojito').Dispatcher = mock;
  80
+});
69 81
 YUI.add('mojito-mojit-proxy', function(Y, NAME) {});
70 82
 YUI.add('mojito-output-handler', function(Y, NAME) {});
71 83
 YUI.add('mojito-perf', function(Y, NAME) {});
9  tests/unit/lib/app/autoload/test-action-context.common.js
@@ -3,7 +3,7 @@
3 3
  * Copyrights licensed under the New BSD License.
4 4
  * See the accompanying LICENSE file for terms.
5 5
  */
6  
-YUI().use('mojito-action-context', 'test', function (Y) {
  6
+YUI().use('mojito-action-context', 'mojito-tests', 'test', function (Y) {
7 7
 
8 8
     var suite = new Y.Test.Suite('mojito-action-context tests'),
9 9
         acStash = {},
@@ -197,7 +197,11 @@ YUI().use('mojito-action-context', 'test', function (Y) {
197 197
                         views: 'views'
198 198
                     }
199 199
                 },
200  
-                adapter: Y.Mock(),
  200
+                adapter: {
  201
+                    page: {
  202
+                        staticAppConfig: {foo: 'bar'}
  203
+                    }
  204
+                },
201 205
                 models: {},
202 206
                 controller: {index: function() {}},
203 207
                 store: store
@@ -206,6 +210,7 @@ YUI().use('mojito-action-context', 'test', function (Y) {
206 210
             A.areSame('Type', ac.type, 'bad type');
207 211
             A.areSame('index', ac.action, 'bad action');
208 212
             A.areSame('context', ac.context, 'bad context');
  213
+            Y.TEST_CMP({foo: 'bar'}, ac.staticAppConfig, 'bad staticAppConfig');
209 214
 
210 215
             A.areSame('the dispatcher', ac.dispatcher,
211 216
                 "dispatcher wasn't stashed.");
53  tests/unit/lib/test-mojito.js
@@ -336,7 +336,7 @@ YUI().use('mojito', 'mojito-test-extra', 'test', function (Y) {
336 336
                     _options: {verbose: false}
337 337
                 };
338 338
 
339  
-            cb = function(/*err, app*/) {};
  339
+            cb = function(err, app) {};
340 340
 
341 341
             Y.Mock.expect(app, {
342 342
                 method: 'listen',
@@ -615,14 +615,24 @@ YUI().use('mojito', 'mojito-test-extra', 'test', function (Y) {
615 615
         name: '_configureAppInstance suite',
616 616
 
617 617
         'test configureAppInstance': function () {
618  
-            var appwtf = {
  618
+            var dispatcher,
  619
+                madeY,      // the Y instance made in mojito.js
  620
+                appwtf = {
619 621
                     store: {
  622
+                        getAllURLDetails: function () {
  623
+                            return {};
  624
+                        },
620 625
                         getAppConfig: function () {
621 626
                             A.isTrue(true);
622 627
                             return {
623 628
                                 debugMemory: true,
624  
-                                middleware: ['mojito-router'],
625  
-                                perf: {}
  629
+                                middleware: ['mojito-handler-dispatcher']
  630
+                            };
  631
+                        },
  632
+                        getStaticAppConfig: function () {
  633
+                            return {
  634
+                                debugMemory: true,
  635
+                                middleware: ['mojito-handler-dispatcher']
626 636
                             };
627 637
                         },
628 638
                         getStaticContext: function () {
@@ -632,21 +642,36 @@ YUI().use('mojito', 'mojito-test-extra', 'test', function (Y) {
632 642
                             getConfigShared: function () {
633 643
                                 return {};
634 644
                             },
  645
+                            getModulesConfig: function () {
  646
+                                return {
  647
+                                    modules: {
  648
+                                        'mojito-hooks': {
  649
+                                            fullpath: __dirname + '/../../base/mojito-test.js'
  650
+                                        },
  651
+                                        'mojito-dispatcher': {
  652
+                                            fullpath: __dirname + '/../../base/mojito-test.js'
  653
+                                        }
  654
+                                    }
  655
+                                };
  656
+                            },
  657
+                            getYUIURLDetails: function () {
  658
+                                return {};
  659
+                            }
635 660
                         }
636 661
                     },
637  
-                    use: function () {}
  662
+                    use: function (x) {
  663
+                        dispatcher = x;
  664
+                    }
638 665
                 };
639 666
 
640  
-            Y.namespace('mojito.Dispatcher').init = function(store) {
641  
-                Y.isObject(store);
642  
-                return {
643  
-                    dispatch: function (cmd, outputHandler) {}
644  
-                };
  667
+            Mojito.Server.prototype._configureLogger = function(y) {
  668
+                madeY = y;
645 669
             };
646  
-
647  
-            try {
648  
-                Mojito.Server.prototype._configureAppInstance(appwtf);
649  
-            } catch (err) {}
  670
+            Mojito.Server.prototype._configureAppInstance(appwtf);
  671
+            dispatcher({command: {}}, {}, function() {});
  672
+            A.isObject(madeY.mojito.Dispatcher.outputHandler);
  673
+            A.isObject(madeY.mojito.Dispatcher.outputHandler.page);
  674
+            A.isObject(madeY.mojito.Dispatcher.outputHandler.page.staticAppConfig);
650 675
         }
651 676
 
652 677
     }));

0 notes on commit 8b973bc

Please sign in to comment.
Something went wrong with that request. Please try again.