Left: | ||
Right: |
OLD | NEW |
---|---|
1 | |
2 'use strict'; | 1 'use strict'; |
3 | 2 |
4 describe('topology', function() { | 3 describe('topology', function() { |
5 var Y, NS, views, | 4 var Y, NS, views, |
6 TestModule, modA, state, | 5 TestModule, modA, state, |
7 container, topo, | 6 container, topo, |
8 models, | 7 models, |
9 db; | 8 db; |
10 | 9 |
11 before(function(done) { | 10 before(function(done) { |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
87 } | 86 } |
88 | 87 |
89 it('should be able to create a topology with standard env view modules', | 88 it('should be able to create a topology with standard env view modules', |
90 function() { | 89 function() { |
91 topo = createStandardTopo(); | 90 topo = createStandardTopo(); |
92 topo.render(); | 91 topo.render(); |
93 // Verify that we have built the default scene. | 92 // Verify that we have built the default scene. |
94 Y.Lang.isValue(topo.vis).should.equal(true); | 93 Y.Lang.isValue(topo.vis).should.equal(true); |
95 }); | 94 }); |
96 | 95 |
96 it('should prevent the Juju GUI service from being destroyed', function() { | |
97 var service = { | |
98 charm: 'cs:precise/juju-gui-7' | |
99 }; | |
100 var fauxTopo = { | |
101 get: function() { | |
102 return null; | |
103 }, | |
104 serviceForBox: function() { | |
105 return service; | |
106 } | |
107 }; | |
108 // The context is used to do the destroying, so if it does not have the | |
109 // destroy method, an exception will be raised if the service would be | |
110 // destroyed. | |
111 var context = { | |
112 get: function(name) { | |
113 if (name === 'component') { | |
114 return fauxTopo; | |
115 } | |
116 } | |
117 }; | |
118 topo.events.ServiceModule.scene['.destroy-service'].click.callback( | |
bcsaller
2013/01/17 22:26:58
a simulate('click') test might be better here if y
benji
2013/01/18 13:33:47
My intent here is a function call, not an interact
| |
119 undefined, context); | |
120 }); | |
97 }); | 121 }); |
98 | 122 |
123 describe('service menu', function() { | |
124 var Y, views; | |
99 | 125 |
126 before(function(done) { | |
127 Y = YUI(GlobalConfig).use(['juju-topology'], function(Y) { | |
128 views = Y.namespace('juju.views'); | |
129 done(); | |
130 }); | |
131 }); | |
132 | |
133 it('should disable the "Destroy" menu for the Juju GUI service', function() { | |
134 var service = { | |
135 charm: 'cs:precise/juju-gui-7' | |
136 }; | |
137 var addedClassName; | |
138 var menu = { | |
139 hasClass: function() { | |
140 return false; | |
141 }, | |
142 addClass: function() {}, | |
143 one: function() { | |
144 return { | |
145 addClass: function(className) { | |
146 addedClassName = className; | |
147 } | |
148 }; | |
149 } | |
150 }; | |
151 var fauxView = { | |
152 get: function(name) { | |
153 if (name === 'container') { | |
154 return {one: function() { return menu; }}; | |
155 } else if (name === 'component') { | |
156 return {set: function() {}}; | |
157 } | |
158 }, | |
159 updateServiceMenuLocation: function() {} | |
160 }; | |
161 var view = new views.ServiceModule(); | |
162 view.service_click_actions.toggleControlPanel( | |
163 service, fauxView, undefined); | |
164 assert.equal(addedClassName, 'disabled'); | |
165 }); | |
166 | |
167 }); | |
OLD | NEW |