Index: test/test_service_module.js |
=== modified file 'test/test_service_module.js' |
--- test/test_service_module.js 2013-02-01 15:17:37 +0000 |
+++ test/test_service_module.js 2013-02-27 02:45:06 +0000 |
@@ -81,6 +81,7 @@ |
view, viewContainer, views, Y; |
before(function(done) { |
Y = YUI(GlobalConfig).use(['node', |
+ 'juju-landscape', |
'juju-models', |
'juju-views', |
'juju-gui', |
@@ -143,6 +144,41 @@ |
assert(menu.hasClass('active')); |
}); |
+ it('should show the service menu with conditional landscape items', |
+ function() { |
+ var box = topo.service_boxes.haproxy; |
+ var service = db.services.getById('haproxy'); |
+ var menu = viewContainer.one('#service-menu'); |
+ var landscape = new views.Landscape(); |
+ landscape.set('db', db); |
+ |
+ topo.set('landscape', landscape); |
+ db.environment.set('annotations', { |
+ 'landscape-url': 'http://host', |
+ 'landscape-computers': '/foo', |
+ 'landscape-reboot-alert-url': '+reboot' |
+ }); |
+ service['landscape-needs-reboot'] = true; |
+ service.set('annotations', { |
+ 'landscape-computers': '/bar' |
+ }); |
+ |
+ assert.isFalse(menu.hasClass('active')); |
+ serviceModule.service_click_actions.showServiceMenu( |
+ box, serviceModule, serviceModule); |
+ assert(menu.hasClass('active')); |
+ // Check no-op. |
+ serviceModule.service_click_actions.showServiceMenu( |
+ box, serviceModule, serviceModule); |
+ assert(menu.hasClass('active')); |
+ |
+ // Verify that we have a reboot URL. |
+ var rebootItem = menu.one('.landscape-reboot'); |
+ rebootItem.one('a').get('href').should.equal( |
+ 'http://host/foo/bar/+reboot'); |
+ }); |
+ |
+ |
it('should hide the service menu', |
function() { |
var box = topo.service_boxes.haproxy; |