3
3
describe('Landscape integration', function() {
5
var views, models, db, landscape;
5
var views, models, db, landscape, Y;
7
7
before(function(done) {
8
YUI(GlobalConfig).use(['juju-landscape',
10
'juju-views'], function(Y) {
8
Y = YUI(GlobalConfig).use(['node',
11
'juju-views'], function(Y) {
13
14
views = Y.namespace('juju.views');
126
127
mysql['landscape-security-upgrades'].should.equal(false);
130
it('should build the bottom-bar properly', function() {
131
var env = db.environment;
132
var mysql = db.services.getById('mysql');
133
var unit = db.units.item(0);
134
var partial = Y.Handlebars.partials['landscape-controls'];
135
Y.one('body').append('<div id="test-node"></div>');
136
var node = Y.one('#test-node');
137
node.append(partial());
139
views.utils.updateLandscapeBottomBar(landscape, env, env, node,
142
// We should have the correct logo.
143
node.one('.logo-tab i').hasClass('landscape_environment')
145
// We should have the correct URL for the machines.
146
node.one('.machine-control a').get('href').should
147
.equal('http://landscape.com/computers/criteria/environment:test/');
148
// We should have visible controls.
149
node.one('.updates-control').getStyle('display').should.equal('block');
150
node.one('.restart-control').getStyle('display').should.equal('block');
152
views.utils.updateLandscapeBottomBar(landscape, env, mysql, node,
155
// We should have the correct logo.
156
node.one('.logo-tab i').hasClass('landscape_service')
158
// We should have the correct URL for the machines.
159
node.one('.machine-control a').get('href').should.equal('http://' +
160
'landscape.com/computers/criteria/environment:test+service:mysql/');
161
// We should have visible restart but not update controls.
162
node.one('.updates-control').getStyle('display').should.equal('none');
163
node.one('.restart-control').getStyle('display').should.equal('block');
165
unit.annotations = {'landscape-computer': '+unit:mysql-0'};
168
views.utils.updateLandscapeBottomBar(landscape, env, unit, node,
171
// We should have the correct logo.
172
node.one('.logo-tab i').hasClass('landscape_unit')
174
// We should have the correct URL for the machines.
175
node.one('.machine-control a').get('href').should.equal('http://' +
176
'landscape.com/computers/criteria/environment:test+unit:mysql-0/');
177
// We should have no visible controls.
178
node.one('.updates-control').getStyle('display').should.equal('none');
179
node.one('.restart-control').getStyle('display').should.equal('none');