Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(386)

Unified Diff: test/test_landscape.js

Issue 7417043: Add Landscape bottom-bar controls
Patch Set: Add Landscape bottom-bar controls Created 11 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/test_environment_view.js ('k') | test/test_service_view.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/test_landscape.js
=== modified file 'test/test_landscape.js'
--- test/test_landscape.js 2013-02-26 17:37:58 +0000
+++ test/test_landscape.js 2013-02-28 18:11:45 +0000
@@ -2,12 +2,13 @@
describe('Landscape integration', function() {
- var views, models, db, landscape;
+ var views, models, db, landscape, Y;
before(function(done) {
- YUI(GlobalConfig).use(['juju-landscape',
- 'juju-models',
- 'juju-views'], function(Y) {
+ Y = YUI(GlobalConfig).use(['node',
+ 'juju-landscape',
+ 'juju-models',
+ 'juju-views'], function(Y) {
var envAnno;
views = Y.namespace('juju.views');
@@ -126,4 +127,58 @@
mysql['landscape-security-upgrades'].should.equal(false);
});
+ it('should build the bottom-bar properly', function() {
+ var env = db.environment;
+ var mysql = db.services.getById('mysql');
+ var unit = db.units.item(0);
+ var partial = Y.Handlebars.partials['landscape-controls'];
+ Y.one('body').append('<div id="test-node"></div>');
+ var node = Y.one('#test-node');
+ node.append(partial());
+
+ views.utils.updateLandscapeBottomBar(landscape, env, env, node,
+ 'environment');
+
+ // We should have the correct logo.
+ node.one('.logo-tab i').hasClass('landscape_environment')
+ .should.equal(true);
+ // We should have the correct URL for the machines.
+ node.one('.machine-control a').get('href').should
+ .equal('http://landscape.com/computers/criteria/environment:test/');
+ // We should have visible controls.
+ node.one('.updates-control').getStyle('display').should.equal('block');
+ node.one('.restart-control').getStyle('display').should.equal('block');
+
+ views.utils.updateLandscapeBottomBar(landscape, env, mysql, node,
+ 'service');
+
+ // We should have the correct logo.
+ node.one('.logo-tab i').hasClass('landscape_service')
+ .should.equal(true);
+ // We should have the correct URL for the machines.
+ node.one('.machine-control a').get('href').should.equal('http://' +
+ 'landscape.com/computers/criteria/environment:test+service:mysql/');
+ // We should have visible restart but not update controls.
+ node.one('.updates-control').getStyle('display').should.equal('none');
+ node.one('.restart-control').getStyle('display').should.equal('block');
+
+ unit.annotations = {'landscape-computer': '+unit:mysql-0'};
+ landscape.update();
+
+ views.utils.updateLandscapeBottomBar(landscape, env, unit, node,
+ 'unit');
+
+ // We should have the correct logo.
+ node.one('.logo-tab i').hasClass('landscape_unit')
+ .should.equal(true);
+ // We should have the correct URL for the machines.
+ node.one('.machine-control a').get('href').should.equal('http://' +
+ 'landscape.com/computers/criteria/environment:test+unit:mysql-0/');
+ // We should have no visible controls.
+ node.one('.updates-control').getStyle('display').should.equal('none');
+ node.one('.restart-control').getStyle('display').should.equal('none');
+
+ node.remove();
+ });
+
});
« no previous file with comments | « test/test_environment_view.js ('k') | test/test_service_view.js » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b