~teknico/juju-gui/1086512-revise-docs

« back to all changes in this revision

Viewing changes to test/test_application_notifications.js

  • Committer: Nicola Larosa
  • Date: 2012-12-12 07:52:13 UTC
  • mfrom: (274.1.1 juju-gui)
  • Revision ID: nicola.larosa@canonical.com-20121212075213-x72atd86vf3t239o
MergedĀ fromĀ trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
195
195
        assertNotificationNumber('2');
196
196
      });
197
197
 
198
 
  it('should show notification for "add_relation" and "remove_relation"' +
 
198
  it.skip('should show notification for "add_relation" and "remove_relation"' +
199
199
      ' exceptions (environment view)', function() {
200
200
        var view = new views.environment({
201
201
          db: db,
204
204
        db.relations.remove = NO_OP;
205
205
 
206
206
        view.service_click_actions._addRelationCallback.apply(view,
207
 
       [view, 'relation_id', ERR_EV]);
 
207
            [view, 'relation_id', ERR_EV]);
208
208
 
209
209
        assertNotificationNumber('1');
210
210
 
219
219
        assertNotificationNumber('2');
220
220
      });
221
221
 
222
 
  it('should show notification for "add_relation" and "destroy_service"' +
 
222
  it.skip('should show notification for "add_relation" and "destroy_service"' +
223
223
      ' exceptions (environment view)', function() {
224
224
        var fakeLink = (function() {
225
225
          var link = [{}, {}];
234
234
          };
235
235
          return link;
236
236
        })(),
237
 
       env = {
238
 
               destroy_service: function(service, callback) {
239
 
                 callback(ERR_EV);
240
 
               },
241
 
               add_relation: function(endpoint_a, endpoint_b, callback) {
242
 
                 callback(ERR_EV);
243
 
               }
244
 
             },
245
 
             view = {
246
 
               set: NO_OP,
247
 
               drawRelation: NO_OP,
248
 
               cancelRelationBuild: NO_OP,
 
237
            env = {
 
238
              destroy_service: function(service, callback) {
 
239
                callback(ERR_EV);
 
240
              },
 
241
              add_relation: function(endpoint_a, endpoint_b, callback) {
 
242
                callback(ERR_EV);
 
243
              }
 
244
            },
 
245
            view = {
 
246
              set: NO_OP,
 
247
              drawRelation: NO_OP,
 
248
              cancelRelationBuild: NO_OP,
249
249
 
250
 
               vis: {
251
 
                 selectAll: function() {
252
 
                   return {
253
 
                     data: function() {return fakeLink;}
254
 
                   };
255
 
                 }
256
 
               },
257
 
               removeSVGClass: NO_OP,
258
 
               db: db,
259
 
               destroy_service: {
260
 
                 get: NO_OP
261
 
               },
262
 
               env: env,
263
 
               get: function(key) {
264
 
                 if ('getModelURL' === key) {
265
 
                   return NO_OP;
266
 
                 }
267
 
                 if ('updateEndpoints' === key) {
268
 
                   return NO_OP;
269
 
                 }
270
 
                 if ('env' === key) {
271
 
                   return env;
272
 
                 }
273
 
                 if ('addRelationStart_service' === key) {
274
 
                   return {};
275
 
                 }
276
 
                 if ('db' === key) {
277
 
                   return db;
278
 
                 }
279
 
                 if ('destroy_service' === key) {
280
 
                   return {
281
 
                     get: NO_OP
282
 
                   };
283
 
                 }
284
 
                 return null;
285
 
               },
286
 
               container: viewContainer,
287
 
               _addRelationCallback: function() {
288
 
                 // Executing the "views.environment.prototype
289
 
                 // .service_click_actions._addRelationCallback" function
290
 
                 //instead.
291
 
                 views.environment.prototype.service_click_actions
 
250
              vis: {
 
251
                selectAll: function() {
 
252
                  return {
 
253
                    data: function() {return fakeLink;}
 
254
                  };
 
255
                }
 
256
              },
 
257
              removeSVGClass: NO_OP,
 
258
              db: db,
 
259
              destroy_service: {
 
260
                get: NO_OP
 
261
              },
 
262
              env: env,
 
263
              get: function(key) {
 
264
                if ('getModelURL' === key) {
 
265
                  return NO_OP;
 
266
                }
 
267
                if ('updateEndpoints' === key) {
 
268
                  return NO_OP;
 
269
                }
 
270
                if ('env' === key) {
 
271
                  return env;
 
272
                }
 
273
                if ('addRelationStart_service' === key) {
 
274
                  return {};
 
275
                }
 
276
                if ('db' === key) {
 
277
                  return db;
 
278
                }
 
279
                if ('destroy_service' === key) {
 
280
                  return {
 
281
                    get: NO_OP
 
282
                  };
 
283
                }
 
284
                return null;
 
285
              },
 
286
              container: viewContainer,
 
287
              _addRelationCallback: function() {
 
288
                // Executing the "views.environment.prototype
 
289
                // .service_click_actions._addRelationCallback" function
 
290
                //instead.
 
291
                views.environment.prototype.service_click_actions
292
292
                   ._addRelationCallback.apply(this, arguments);
293
 
               },
294
 
               _destroyCallback: function() {
295
 
                 // Executing the "views.environment.prototype
296
 
                 // .service_click_actions._destroyCallback" function
297
 
                 //instead.
298
 
                 views.environment.prototype.service_click_actions
 
293
              },
 
294
              _destroyCallback: function() {
 
295
                // Executing the "views.environment.prototype
 
296
                // .service_click_actions._destroyCallback" function
 
297
                //instead.
 
298
                views.environment.prototype.service_click_actions
299
299
                   ._destroyCallback.apply(this, arguments);
300
 
               }
301
 
             };
 
300
              }
 
301
            };
302
302
 
303
303
        views.environment.prototype.service_click_actions.addRelationEnd
304
304
           .apply(view, [
305
 
         [
306
 
          ['s1', {name: 'n', role: 'client'}],
307
 
          ['s2', {name: 'n', role: 'server'}]],
308
 
         view]);
 
305
              [
 
306
               ['s1', {name: 'n', role: 'client'}],
 
307
               ['s2', {name: 'n', role: 'server'}]],
 
308
              view]);
309
309
 
310
310
        assertNotificationNumber('1');
311
311
 
312
312
        views.environment.prototype.service_click_actions.destroyService.apply(
313
 
       //destroyService function signature > (m, view, btn)
314
 
       view, [{}, view, {set: NO_OP}]);
 
313
            //destroyService function signature > (m, view, btn)
 
314
            view, [{}, view, {set: NO_OP}]);
315
315
 
316
316
        assertNotificationNumber('2');
317
317
      });