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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 var charm = new CharmToken({ | 76 var charm = new CharmToken({ |
77 size: 'large' | 77 size: 'large' |
78 }); | 78 }); |
79 charm.get('size').should.eql('large'); | 79 charm.get('size').should.eql('large'); |
80 | 80 |
81 // and the css class should be on the token once rendered. | 81 // and the css class should be on the token once rendered. |
82 charm.render(charm_container); | 82 charm.render(charm_container); |
83 charm_container.one('.charm-token').hasClass('large').should.equal(true); | 83 charm_container.one('.charm-token').hasClass('large').should.equal(true); |
84 }); | 84 }); |
85 | 85 |
| 86 it('allows setting a tiny size', function() { |
| 87 var charm = new CharmToken({ |
| 88 size: 'tiny', |
| 89 description: 'some description', |
| 90 mainCategory: 'app-servers', |
| 91 recent_commit_count: 1, |
| 92 recent_download_count: 3 |
| 93 }); |
| 94 assert.equal('tiny', charm.get('size')); |
| 95 |
| 96 // and the css class should be on the token once rendered. |
| 97 charm.render(charm_container); |
| 98 assert(charm_container.one('.charm-token').hasClass('tiny')); |
| 99 |
| 100 var iconNode = charm_container.one('.category-icon'); |
| 101 assert.equal(iconNode.hasClass('charm-app-servers-48'), true); |
| 102 }); |
| 103 |
86 it('sets an icon per the category if available', function() { | 104 it('sets an icon per the category if available', function() { |
87 var cfg = { | 105 var cfg = { |
88 id: 'test', | 106 id: 'test', |
89 name: 'some-charm', | 107 name: 'some-charm', |
90 description: 'some description', | 108 description: 'some description', |
91 mainCategory: 'app-servers', | 109 mainCategory: 'app-servers', |
92 recent_commit_count: 1, | 110 recent_commit_count: 1, |
93 recent_download_count: 3, | 111 recent_download_count: 3, |
94 tested_providers: ['ec2'] | 112 tested_providers: ['ec2'] |
95 }; | 113 }; |
(...skipping 16 matching lines...) Expand all Loading... |
112 tested_providers: ['ec2'] | 130 tested_providers: ['ec2'] |
113 }; | 131 }; |
114 | 132 |
115 var charm = new CharmToken(cfg); | 133 var charm = new CharmToken(cfg); |
116 charm.render(charm_container); | 134 charm.render(charm_container); |
117 var iconNode = charm_container.one('.category-icon'); | 135 var iconNode = charm_container.one('.category-icon'); |
118 assert.equal(iconNode.hasClass('charm-app-servers-96'), true); | 136 assert.equal(iconNode.hasClass('charm-app-servers-96'), true); |
119 }); | 137 }); |
120 | 138 |
121 }); | 139 }); |
OLD | NEW |