OLD | NEW |
1 'use strict'; | 1 'use strict'; |
2 | 2 |
3 (function() { | 3 (function() { |
4 | 4 |
5 describe('browser_editorial', function() { | 5 describe('browser_editorial', function() { |
6 var EditorialView, fakeStore, models, node, sampleData, view, views, Y; | 6 var EditorialView, fakeStore, models, node, sampleData, view, views, Y; |
7 | 7 |
8 before(function(done) { | 8 before(function(done) { |
9 Y = YUI(GlobalConfig).use( | 9 Y = YUI(GlobalConfig).use( |
10 'node-event-simulate', | 10 'node-event-simulate', |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 | 133 |
134 view.on('viewNavigate', function(ev) { | 134 view.on('viewNavigate', function(ev) { |
135 ev.halt(); | 135 ev.halt(); |
136 assert(ev.change.charmID === 'precise/ceph-7'); | 136 assert(ev.change.charmID === 'precise/ceph-7'); |
137 done(); | 137 done(); |
138 }); | 138 }); |
139 | 139 |
140 node.one('.charm-token').simulate('click'); | 140 node.one('.charm-token').simulate('click'); |
141 }); | 141 }); |
142 | 142 |
| 143 it('setting the activeID marks the div active', function() { |
| 144 fakeStore = new Y.juju.Charmworld0({}); |
| 145 fakeStore.set('datasource', { |
| 146 sendRequest: function(params) { |
| 147 // Stubbing the server callback value |
| 148 params.callback.success({ |
| 149 response: { |
| 150 results: [sampleData] |
| 151 } |
| 152 }); |
| 153 } |
| 154 }); |
| 155 view = new EditorialView({ |
| 156 renderTo: Y.one('.bws-content'), |
| 157 store: fakeStore, |
| 158 activeID: 'precise/ceph-7' |
| 159 }); |
| 160 view.render(); |
| 161 node.all('.yui3-charmtoken.active').size().should.equal(1); |
| 162 }); |
| 163 |
| 164 it('unsetting the activeID will remove the active markings', function() { |
| 165 fakeStore = new Y.juju.Charmworld0({}); |
| 166 fakeStore.set('datasource', { |
| 167 sendRequest: function(params) { |
| 168 // Stubbing the server callback value |
| 169 params.callback.success({ |
| 170 response: { |
| 171 results: [sampleData] |
| 172 } |
| 173 }); |
| 174 } |
| 175 }); |
| 176 view = new EditorialView({ |
| 177 renderTo: Y.one('.bws-content'), |
| 178 store: fakeStore, |
| 179 activeID: 'precise/ceph-7' |
| 180 }); |
| 181 view.render(); |
| 182 |
| 183 view.set('activeID', null); |
| 184 node.all('.yui3-charmtoken.active').size().should.equal(0); |
| 185 }); |
| 186 |
143 }); | 187 }); |
144 | 188 |
145 })(); | 189 })(); |
OLD | NEW |