Left: | ||
Right: |
OLD | NEW |
---|---|
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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
76 'public-address': '192.168.122.222', | 76 'public-address': '192.168.122.222', |
77 'id': 'mysql/0' | 77 'id': 'mysql/0' |
78 }] | 78 }] |
79 ], | 79 ], |
80 'op': 'delta' | 80 'op': 'delta' |
81 }; | 81 }; |
82 | 82 |
83 before(function(done) { | 83 before(function(done) { |
84 Y = YUI(GlobalConfig).use([ | 84 Y = YUI(GlobalConfig).use([ |
85 'juju-views', 'juju-tests-utils', 'juju-env', | 85 'juju-views', 'juju-tests-utils', 'juju-env', |
86 'node-event-simulate', 'juju-gui', 'slider' | 86 'node-event-simulate', 'juju-gui', 'slider', |
87 'landscape' | |
87 ], function(Y) { | 88 ], function(Y) { |
88 testUtils = Y.namespace('juju-tests.utils'); | 89 testUtils = Y.namespace('juju-tests.utils'); |
89 views = Y.namespace('juju.views'); | 90 views = Y.namespace('juju.views'); |
90 models = Y.namespace('juju.models'); | 91 models = Y.namespace('juju.models'); |
91 conn = new testUtils.SocketStub(); | 92 conn = new testUtils.SocketStub(); |
92 juju = Y.namespace('juju'); | 93 juju = Y.namespace('juju'); |
93 env = juju.newEnvironment({conn: conn}); | 94 env = juju.newEnvironment({conn: conn}); |
94 env.connect(); | 95 env.connect(); |
95 conn.open(); | 96 conn.open(); |
96 done(); | 97 done(); |
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
494 | 495 |
495 db.on_delta({ data: tmp_data }); | 496 db.on_delta({ data: tmp_data }); |
496 view.update(); | 497 view.update(); |
497 | 498 |
498 //On annotation change position should be updated. | 499 //On annotation change position should be updated. |
499 match = node.getAttribute('transform').match(properTransform); | 500 match = node.getAttribute('transform').match(properTransform); |
500 match[1].should.eql('374.1'); | 501 match[1].should.eql('374.1'); |
501 match[2].should.eql('211.2'); | 502 match[2].should.eql('211.2'); |
502 }); | 503 }); |
503 | 504 |
505 it('must be able to use Landscape annotations', function() { | |
506 var landscape = new views.Landscape(); | |
507 landscape.set('db', db); | |
508 db.environment.set('annotations', { | |
509 'landscape-url': 'http://host', | |
510 'landscape-computers': '/foo', | |
511 'landscape-reboot-alert-url': '+reboot' | |
512 }); | |
513 db.environment['landscape-needs-reboot'] = true; | |
514 | |
515 var view = new views.environment({ | |
516 container: container, | |
517 db: db, | |
518 env: env, | |
519 landscape: landscape | |
520 }).render(); | |
521 | |
522 var rebootItem = container.one('.landscape-controls .restart-control'); | |
523 rebootItem.one('a').get('href').should.equal('http://host/foo+reboot'); | |
gary.poster
2013/02/28 02:16:57
Nice additions, but it would be good to test that
matthew.scott
2013/02/28 18:16:47
Done.
| |
524 }); | |
525 | |
526 | |
504 it('must be able to render subordinate relation indicators', | 527 it('must be able to render subordinate relation indicators', |
505 function() { | 528 function() { |
506 var view = new views.environment({ | 529 var view = new views.environment({ |
507 container: container, | 530 container: container, |
508 db: db, | 531 db: db, |
509 env: env | 532 env: env |
510 }).render(); | 533 }).render(); |
511 var rel_block = container.one('.sub-rel-count').getDOMNode(); | 534 var rel_block = container.one('.sub-rel-count').getDOMNode(); |
512 | 535 |
513 // Get the contents of the subordinate relation count; YUI cannot | 536 // Get the contents of the subordinate relation count; YUI cannot |
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
939 'memcache': 3, | 962 'memcache': 3, |
940 'wordpress': 4}; | 963 'wordpress': 4}; |
941 | 964 |
942 var boxes = views.toBoundingBoxes(module, services, existing); | 965 var boxes = views.toBoundingBoxes(module, services, existing); |
943 // The haproxy is removed from the results since it is no longer in | 966 // The haproxy is removed from the results since it is no longer in |
944 // the services list. | 967 // the services list. |
945 assert.equal(boxes.haproxy, undefined); | 968 assert.equal(boxes.haproxy, undefined); |
946 }); | 969 }); |
947 }); | 970 }); |
948 })(); | 971 })(); |
OLD | NEW |