LEFT | RIGHT |
1 'use strict'; | 1 'use strict'; |
2 | 2 |
3 (function() { | 3 (function() { |
4 | 4 |
5 describe('juju environment view', function() { | 5 describe('juju environment view', function() { |
6 var views, models, Y, container, service, db, conn, | 6 var views, models, Y, container, service, db, conn, |
7 juju, env, testUtils; | 7 juju, env, testUtils; |
8 | 8 |
9 var environment_delta = { | 9 var environment_delta = { |
10 'result': [ | 10 'result': [ |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 var svg = container.one('svg'), | 263 var svg = container.one('svg'), |
264 canvas = container.one('#canvas'); | 264 canvas = container.one('#canvas'); |
265 // We have to hide the canvas so it does not affect our calculations. | 265 // We have to hide the canvas so it does not affect our calculations. |
266 canvas.setStyle('display', 'none'); | 266 canvas.setStyle('display', 'none'); |
267 // Ensure that calculations are being done correctly on the viewport. | 267 // Ensure that calculations are being done correctly on the viewport. |
268 // Unfortunately, this essentially duplicates the logic in the | 268 // Unfortunately, this essentially duplicates the logic in the |
269 // pertinent function, rather than truly testing it. | 269 // pertinent function, rather than truly testing it. |
270 parseInt(svg.getAttribute('height'), 10) | 270 parseInt(svg.getAttribute('height'), 10) |
271 .should.equal( | 271 .should.equal( |
272 Math.max(600, | 272 Math.max(600, |
273 container.get('docHeight') - | 273 container.get('winHeight') - |
274 Y.one('.bottom-navbar').get('offsetHeight') - | 274 Y.one('.bottom-navbar').get('offsetHeight') - |
275 Y.one('.navbar').get('offsetHeight') - 1)); | 275 Y.one('.navbar').get('offsetHeight') - 1)); |
276 // Destroy the navbar | 276 // Destroy the navbar |
277 navbar.remove(true); | 277 navbar.remove(true); |
278 viewport.remove(true); | 278 viewport.remove(true); |
279 } | 279 } |
280 ); | 280 ); |
281 | 281 |
282 // Tests for control panel. | 282 // Tests for control panel. |
283 it('must be able to toggle a control panel', function(done) { | 283 it('must be able to toggle a control panel', function(done) { |
(...skipping 11 matching lines...) Expand all Loading... |
295 .should.equal(1); | 295 .should.equal(1); |
296 }); | 296 }); |
297 }); | 297 }); |
298 done(); | 298 done(); |
299 }); | 299 }); |
300 | 300 |
301 it('must be able to add a relation from the control panel', | 301 it('must be able to add a relation from the control panel', |
302 function() { | 302 function() { |
303 var view = new views.environment({ | 303 var view = new views.environment({ |
304 container: container, | 304 container: container, |
305 app: {serviceEndpoints: {}}, | 305 getServiceEndpoints: function() {return {};}, |
306 db: db, | 306 db: db, |
307 env: env | 307 env: env |
308 }).render(); | 308 }).render(); |
309 var service = container.one('.service'), | 309 var service = container.one('.service'), |
310 add_rel = container.one('#service-menu .add-relation'), | 310 add_rel = container.one('#service-menu .add-relation'), |
311 after_evt; | 311 after_evt; |
312 | 312 |
313 // Mock endpoints | 313 // Mock endpoints |
314 var existing = models.getEndpoints; | 314 var existing = models.getEndpoints; |
315 models.getEndpoints = function() { | 315 models.getEndpoints = function() { |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
553 .target(b2) | 553 .target(b2) |
554 .model(relation); | 554 .model(relation); |
555 pair.modelIds().should.not.contain(','); | 555 pair.modelIds().should.not.contain(','); |
556 pair.modelIds().should.equal( | 556 pair.modelIds().should.equal( |
557 'service-mediawiki:app-service-haproxy:proxy'); | 557 'service-mediawiki:app-service-haproxy:proxy'); |
558 }); | 558 }); |
559 | 559 |
560 }); | 560 }); |
561 | 561 |
562 })(); | 562 })(); |
LEFT | RIGHT |