OLD | NEW |
1 'use strict'; | 1 'use strict'; |
2 | 2 |
3 describe('service module annotations', function() { | 3 describe('service module annotations', function() { |
4 var db, juju, models, viewContainer, views, Y, serviceModule; | 4 var db, juju, models, viewContainer, views, Y, serviceModule; |
5 var called, location; | 5 var called, location; |
6 before(function(done) { | 6 before(function(done) { |
7 Y = YUI(GlobalConfig).use(['node', | 7 Y = YUI(GlobalConfig).use(['node', |
8 'juju-models', | 8 'juju-models', |
9 'juju-views', | 9 'juju-views', |
10 'juju-gui', | 10 'juju-gui', |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 } | 49 } |
50 }); | 50 }); |
51 | 51 |
52 // Test the drag end handler. | 52 // Test the drag end handler. |
53 it('should set location annotations on service block drag end', | 53 it('should set location annotations on service block drag end', |
54 function() { | 54 function() { |
55 var d = | 55 var d = |
56 { id: 'wordpress', | 56 { id: 'wordpress', |
57 x: 100.1, | 57 x: 100.1, |
58 y: 200.2}; | 58 y: 200.2}; |
59 serviceModule._dragend(d, 0); | 59 serviceModule.dragend(d, serviceModule); |
60 assert.isTrue(called); | 60 assert.isTrue(called); |
61 location['gui.x'].should.equal(100.1); | 61 location['gui.x'].should.equal(100.1); |
62 location['gui.y'].should.equal(200.2); | 62 location['gui.y'].should.equal(200.2); |
63 }); | 63 }); |
64 | 64 |
65 it('should not set annotations on drag end if building a relation', | 65 it('should not set annotations on drag end if building a relation', |
66 function() { | 66 function() { |
67 var d = | 67 var d = |
68 { id: 'wordpress', | 68 { id: 'wordpress', |
69 x: 100.1, | 69 x: 100.1, |
70 y: 200.2}; | 70 y: 200.2}; |
71 var topo = serviceModule.get('component'); | 71 var topo = serviceModule.get('component'); |
72 topo.buildingRelation = true; | 72 topo.buildingRelation = true; |
73 serviceModule._dragend(d, 0); | 73 serviceModule.dragend(d, serviceModule); |
74 assert.isFalse(called); | 74 assert.isFalse(called); |
75 location['gui.x'].should.equal(0); | 75 location['gui.x'].should.equal(0); |
76 location['gui.y'].should.equal(0); | 76 location['gui.y'].should.equal(0); |
77 }); | 77 }); |
78 | 78 |
79 }); | 79 }); |
80 | 80 |
81 | 81 |
82 describe('service module events', function() { | 82 describe('service module events', function() { |
83 var db, juju, models, serviceModule, view, viewContainer, views, Y; | 83 var db, juju, models, serviceModule, view, viewContainer, views, Y; |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 var service = viewContainer.one('.service'); | 169 var service = viewContainer.one('.service'); |
170 var menu = viewContainer.one('#service-menu'); | 170 var menu = viewContainer.one('#service-menu'); |
171 service.simulate('click'); | 171 service.simulate('click'); |
172 // Ideally the browser would not send the click event right away... | 172 // Ideally the browser would not send the click event right away... |
173 assert(menu.hasClass('active')); | 173 assert(menu.hasClass('active')); |
174 service.simulate('dblclick'); | 174 service.simulate('dblclick'); |
175 assert.isFalse(menu.hasClass('active')); | 175 assert.isFalse(menu.hasClass('active')); |
176 }); | 176 }); |
177 | 177 |
178 }); | 178 }); |
OLD | NEW |