OLD | NEW |
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) 2012-2013 Canonical Ltd. | 4 Copyright (C) 2012-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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 } | 68 } |
69 node.remove(true); | 69 node.remove(true); |
70 delete window.juju_config; | 70 delete window.juju_config; |
71 container.remove(true); | 71 container.remove(true); |
72 }); | 72 }); |
73 | 73 |
74 after(function() { | 74 after(function() { |
75 cleanIconHelper(); | 75 cleanIconHelper(); |
76 }); | 76 }); |
77 | 77 |
| 78 it('renders for inspector mode correctly', function() { |
| 79 var data = utils.loadFixture('data/browsercharm.json', true); |
| 80 // We don't want any files so we don't have to mock/load them. |
| 81 data.charm.files = []; |
| 82 view = new CharmView({ |
| 83 charm: new models.BrowserCharm(data.charm), |
| 84 container: utils.makeContainer(), |
| 85 forInspector: true |
| 86 }); |
| 87 |
| 88 view.render(); |
| 89 assert.isNull(view.get('container').one('.heading')); |
| 90 }); |
| 91 |
78 it('has sharing links', function() { | 92 it('has sharing links', function() { |
79 var fakeStore = new Y.juju.Charmworld2({}); | 93 var fakeStore = new Y.juju.Charmworld2({}); |
80 fakeStore.set('datasource', { | 94 fakeStore.set('datasource', { |
81 sendRequest: function(params) { | 95 sendRequest: function(params) { |
82 // Stubbing the server callback value | 96 // Stubbing the server callback value |
83 params.callback.success({ | 97 params.callback.success({ |
84 response: { | 98 response: { |
85 results: [{ | 99 results: [{ |
86 responseText: 'README content.' | 100 responseText: 'README content.' |
87 }] | 101 }] |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 response: { | 212 response: { |
199 results: [{ | 213 results: [{ |
200 responseText: 'README content.' | 214 responseText: 'README content.' |
201 }] | 215 }] |
202 } | 216 } |
203 }); | 217 }); |
204 } | 218 } |
205 }); | 219 }); |
206 | 220 |
207 view = new CharmView({ | 221 view = new CharmView({ |
| 222 activeTab: '#bws-readme', |
208 charm: new models.BrowserCharm({ | 223 charm: new models.BrowserCharm({ |
209 files: [ | 224 files: [ |
210 'hooks/install', | 225 'hooks/install', |
211 'readme.rst' | 226 'readme.rst' |
212 ], | 227 ], |
213 id: 'precise/ceph-9', | 228 id: 'precise/ceph-9', |
214 code_source: { location: 'lp:~foo'} | 229 code_source: { location: 'lp:~foo'} |
215 }), | 230 }), |
216 container: utils.makeContainer(), | 231 container: utils.makeContainer(), |
217 store: fakeStore | 232 store: fakeStore |
218 }); | 233 }); |
219 | 234 |
220 view.render(); | 235 view.render(); |
| 236 |
221 Y.one('#bws-readme').get('text').should.eql('README content.'); | 237 Y.one('#bws-readme').get('text').should.eql('README content.'); |
222 }); | 238 }); |
223 | 239 |
224 // EVENTS | 240 // EVENTS |
225 it('should catch when the add control is clicked', function(done) { | 241 it('should catch when the add control is clicked', function(done) { |
226 view = new CharmView({ | 242 view = new CharmView({ |
| 243 activeTab: '#bws-readme', |
227 charm: new models.BrowserCharm({ | 244 charm: new models.BrowserCharm({ |
228 files: [ | 245 files: [ |
229 'hooks/install' | 246 'hooks/install' |
230 ], | 247 ], |
231 id: 'precise/ceph-9', | 248 id: 'precise/ceph-9', |
232 code_source: { location: 'lp:~foo' } | 249 code_source: { location: 'lp:~foo' } |
233 }), | 250 }), |
234 container: utils.makeContainer() | 251 container: utils.makeContainer() |
235 }); | 252 }); |
236 | 253 |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 'README Header', | 347 'README Header', |
331 '=============' | 348 '=============' |
332 ].join('\n') | 349 ].join('\n') |
333 }] | 350 }] |
334 } | 351 } |
335 }); | 352 }); |
336 } | 353 } |
337 }); | 354 }); |
338 | 355 |
339 view = new CharmView({ | 356 view = new CharmView({ |
| 357 activeTab: '#bws-readme', |
340 charm: new models.BrowserCharm({ | 358 charm: new models.BrowserCharm({ |
341 files: [ | 359 files: [ |
342 'readme.md' | 360 'readme.md' |
343 ], | 361 ], |
344 id: 'precise/ceph-9', | 362 id: 'precise/ceph-9', |
345 code_source: { location: 'lp:~foo' } | 363 code_source: { location: 'lp:~foo' } |
346 }), | 364 }), |
347 container: utils.makeContainer(), | 365 container: utils.makeContainer(), |
348 store: fakeStore | 366 store: fakeStore |
349 }); | 367 }); |
(...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
896 view.render(); | 914 view.render(); |
897 | 915 |
898 assert.equal(state.loadCount, 1); | 916 assert.equal(state.loadCount, 1); |
899 assert(state.hitTabRender); | 917 assert(state.hitTabRender); |
900 assert(state.hitRelatedRender); | 918 assert(state.hitRelatedRender); |
901 }); | 919 }); |
902 | 920 |
903 }); | 921 }); |
904 | 922 |
905 })(); | 923 })(); |
OLD | NEW |