~matsubara/juju-gui/tarmac-test

« back to all changes in this revision

Viewing changes to test/test_app.js

  • Committer: Matthew Scott
  • Date: 2013-01-09 17:23:33 UTC
  • mfrom: (307 juju-gui)
  • mto: This revision was merged to the branch mainline in revision 312.
  • Revision ID: matthew.scott@canonical.com-20130109172333-ad6ndevmn5p44dz0
Merging with trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
  return app;
32
32
}
33
33
 
34
 
YUI(GlobalConfig).use(['juju-gui', 'juju-tests-utils'], function(Y) {
 
34
(function() {
 
35
 
35
36
  describe('Application basics', function() {
36
 
    var app, container;
 
37
    var Y, app, container;
 
38
 
 
39
    before(function(done) {
 
40
      Y = YUI(GlobalConfig).use(
 
41
          ['juju-gui', 'juju-tests-utils', 'juju-view-utils'],
 
42
          function(Y) {
 
43
            done();
 
44
          });
 
45
    });
37
46
 
38
47
    beforeEach(function() {
39
48
      container = Y.one('#main')
116
125
    });
117
126
 
118
127
  });
119
 
});
120
 
 
121
 
YUI(GlobalConfig).use(['juju-gui', 'juju-tests-utils'], function(Y) {
 
128
})();
 
129
 
 
130
 
 
131
 
 
132
(function() {
122
133
 
123
134
  describe('Application Connection State', function() {
124
 
    var container;
 
135
    var container, Y;
125
136
 
126
 
    before(function() {
127
 
      container = Y.Node.create('<div id="test" class="container"></div>');
 
137
    before(function(done) {
 
138
      Y = YUI(GlobalConfig).use(['juju-gui', 'juju-tests-utils'],
 
139
          function(Y) {
 
140
            container = Y.Node.create(
 
141
                '<div id="test" class="container"></div>');
 
142
            done();
 
143
          });
128
144
    });
129
145
 
130
146
    it('should be able to handle env connection status changes', function() {
131
147
      var juju = Y.namespace('juju'),
132
 
          conn = new (Y.namespace('juju-tests.utils')).SocketStub(),
 
148
          conn = new(Y.namespace('juju-tests.utils')).SocketStub(),
133
149
          env = new juju.Environment({conn: conn}),
134
150
          app = new Y.juju.App({env: env, container: container}),
135
151
          reset_called = false,
136
152
          noop = function() {return this;};
137
153
 
138
 
 
139
154
      // mock the db
140
155
      app.db = {
141
156
        // mock out notifications
166
181
    });
167
182
 
168
183
  });
169
 
});
170
 
 
171
 
YUI(GlobalConfig).use(['juju-models', 'juju-gui', 'datasource-local',
172
 
  'juju-tests-utils', 'json-stringify'], function(Y) {
 
184
})();
 
185
 
 
186
 
 
187
(function() {
 
188
 
173
189
  describe('Application prefetching', function() {
174
 
    var models, conn, env, app, container, charm_store, data, juju;
 
190
    var Y, models, conn, env, app, container, charm_store, data, juju;
175
191
 
176
 
    before(function() {
177
 
      models = Y.namespace('juju.models');
 
192
    before(function(done) {
 
193
      console.log('Loading App prefetch test code');
 
194
      Y = YUI(GlobalConfig).use(
 
195
          ['juju-gui', 'datasource-local',
 
196
           'juju-views', 'juju-templates',
 
197
           'juju-tests-utils', 'json-stringify'], function(Y) {
 
198
            models = Y.namespace('juju.models');
 
199
            done();
 
200
          });
178
201
    });
179
202
 
180
203
    beforeEach(function() {
243
266
      get_endpoints_count.should.equal(2);
244
267
    });
245
268
  });
246
 
});
 
269
})();