Left: | ||
Right: |
LEFT | RIGHT |
---|---|
1 /* | 1 /* |
2 This file is part of the Juju GUI, which lets users view and manage Juju | 2 This file is part of the Juju GUI, which lets users view and manage Juju |
3 environments within a graphical interface (https://launchpad.net/juju-gui). | 3 environments within a graphical interface (https://launchpad.net/juju-gui). |
4 Copyright (C) 2013 Canonical Ltd. | 4 Copyright (C) 2013 Canonical Ltd. |
5 | 5 |
6 This program is free software: you can redistribute it and/or modify it under | 6 This program is free software: you can redistribute it and/or modify it under |
7 the terms of the GNU Affero General Public License version 3, as published by | 7 the terms of the GNU Affero General Public License version 3, as published by |
8 the Free Software Foundation. | 8 the Free Software Foundation. |
9 | 9 |
10 This program is distributed in the hope that it will be useful, but WITHOUT | 10 This program is distributed in the hope that it will be useful, but WITHOUT |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
60 db = new models.Database(); | 60 db = new models.Database(); |
61 env = juju.newEnvironment({conn: conn}); | 61 env = juju.newEnvironment({conn: conn}); |
62 env.expose = function(service) { | 62 env.expose = function(service) { |
63 exposeCalled = true; | 63 exposeCalled = true; |
64 }; | 64 }; |
65 env.unexpose = function(service) { | 65 env.unexpose = function(service) { |
66 unexposeCalled = true; | 66 unexposeCalled = true; |
67 }; | 67 }; |
68 }); | 68 }); |
69 | 69 |
70 afterEach(function() { | 70 afterEach(function(done) { |
71 if (view) { | 71 if (view) { |
72 if (inspector) { | 72 if (inspector) { |
73 view.setInspector(inspector, true); | 73 view.setInspector(inspector, true); |
74 } | 74 } |
75 view.destroy(); | 75 view.destroy(); |
76 } | 76 } |
77 env.after('destroy', function() { done(); }); | |
77 env.destroy(); | 78 env.destroy(); |
jeff.pihach
2013/07/05 21:03:46
because destroy is async I would probably add a do
bac
2013/07/05 21:21:49
Done.
| |
78 container.remove(true); | 79 container.remove(true); |
79 }); | 80 }); |
80 | 81 |
81 after(function() { | 82 after(function() { |
82 delete window.flags; | 83 delete window.flags; |
jeff.pihach
2013/07/05 21:03:46
nice catch!
| |
83 }); | 84 }); |
84 | 85 |
85 var setUpInspector = function() { | 86 var setUpInspector = function() { |
86 var charmId = 'precise/mediawiki-4'; | 87 var charmId = 'precise/mediawiki-4'; |
87 var charm = new models.Charm({id: charmId}); | 88 var charm = new models.Charm({id: charmId}); |
88 charm.setAttrs(charmConfig); | 89 charm.setAttrs(charmConfig); |
89 db.charms.add(charm); | 90 db.charms.add(charm); |
90 service = new models.Service({ | 91 service = new models.Service({ |
91 id: 'mediawiki', | 92 id: 'mediawiki', |
92 charm: charmId, | 93 charm: charmId, |
(...skipping 21 matching lines...) Expand all Loading... | |
114 assert.isTrue(service.get('exposed')); | 115 assert.isTrue(service.get('exposed')); |
115 assert.isTrue(exposeCalled); | 116 assert.isTrue(exposeCalled); |
116 assert.isFalse(unexposeCalled); | 117 assert.isFalse(unexposeCalled); |
117 | 118 |
118 expose.simulate('click'); | 119 expose.simulate('click'); |
119 assert.isTrue(unexposeCalled); | 120 assert.isTrue(unexposeCalled); |
120 assert.isFalse(service.get('exposed')); | 121 assert.isFalse(service.get('exposed')); |
121 }); | 122 }); |
122 | 123 |
123 }); | 124 }); |
LEFT | RIGHT |