| 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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 env: env | 159 env: env |
| 160 }); | 160 }); |
| 161 view.render(); | 161 view.render(); |
| 162 container.all('.service').size().should.equal(4); | 162 container.all('.service').size().should.equal(4); |
| 163 container.all('.subordinate.service').size().should.equal(1); | 163 container.all('.subordinate.service').size().should.equal(1); |
| 164 | 164 |
| 165 done(); | 165 done(); |
| 166 } | 166 } |
| 167 ); | 167 ); |
| 168 | 168 |
| 169 it('must be able to place new services properly', function() { |
| 170 var view = new views.environment({ |
| 171 container: container, |
| 172 db: db, |
| 173 env: env |
| 174 }), |
| 175 tmp_data = { |
| 176 result: [ |
| 177 ['service', 'add', { |
| 178 'subordinate': true, |
| 179 'charm': 'cs:precise/puppet-2', |
| 180 'id': 'puppet2' |
| 181 }], |
| 182 ['service', 'add', { |
| 183 'charm': 'cs:precise/mysql-6', |
| 184 'id': 'mysql2' |
| 185 }], |
| 186 ['unit', 'add', { |
| 187 'machine': 0, |
| 188 'agent-state': 'started', |
| 189 'public-address': '192.168.122.222', |
| 190 'id': 'mysql2/0' |
| 191 }] |
| 192 ], |
| 193 op: 'delta' |
| 194 }, |
| 195 properTransform = /translate\(\d+\.?\d*,\d+\.?\d*\)/; |
| 196 view.render(); |
| 197 |
| 198 container.all('.service').each(function(serviceNode) { |
| 199 // Ensure that all initial service nodes' transform attributes are |
| 200 // properly formated (i.e.: no NaN values). |
| 201 properTransform.test(serviceNode.getAttribute('transform')) |
| 202 .should.equal(true); |
| 203 }); |
| 204 |
| 205 db.on_delta({ data: tmp_data }); |
| 206 view.render(); |
| 207 |
| 208 container.all('.service').each(function(serviceNode) { |
| 209 // Ensure that all new service nodes' transform attributes are properly |
| 210 // formated as well (i.e.: no NaN values). |
| 211 properTransform.test(serviceNode.getAttribute('transform')) |
| 212 .should.equal(true); |
| 213 }); |
| 214 }); |
| 215 |
| 169 it('must be able to render subordinate relation indicators', | 216 it('must be able to render subordinate relation indicators', |
| 170 function() { | 217 function() { |
| 171 var view = new views.environment({ | 218 var view = new views.environment({ |
| 172 container: container, | 219 container: container, |
| 173 db: db, | 220 db: db, |
| 174 env: env | 221 env: env |
| 175 }).render(); | 222 }).render(); |
| 176 var rel_block = container.one('.sub-rel-count').getDOMNode(); | 223 var rel_block = container.one('.sub-rel-count').getDOMNode(); |
| 177 | 224 |
| 178 // Get the contents of the subordinate relation count; YUI cannot | 225 // Get the contents of the subordinate relation count; YUI cannot |
| (...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 617 .target(b2) | 664 .target(b2) |
| 618 .model(relation); | 665 .model(relation); |
| 619 pair.modelIds().should.not.contain(','); | 666 pair.modelIds().should.not.contain(','); |
| 620 pair.modelIds().should.equal( | 667 pair.modelIds().should.equal( |
| 621 'service-mediawiki:app-service-haproxy:proxy'); | 668 'service-mediawiki:app-service-haproxy:proxy'); |
| 622 }); | 669 }); |
| 623 | 670 |
| 624 }); | 671 }); |
| 625 | 672 |
| 626 })(); | 673 })(); |
| OLD | NEW |