提交 | 用户 | 时间
|
58d006
|
1 |
describe("Create a Street View Panorama", function() { |
A |
2 |
var map_with_streetview, attached_panorama, standalone_panorama, panorama_with_events; |
|
3 |
|
|
4 |
beforeEach(function() { |
|
5 |
map_with_streetview = map_with_streetview || new GMaps({ |
|
6 |
el : '#map-with-streetview', |
|
7 |
lat : 42.3455, |
|
8 |
lng : -71.0983, |
|
9 |
zoom : 12 |
|
10 |
}); |
|
11 |
}); |
|
12 |
|
|
13 |
describe("Standalone", function() { |
|
14 |
beforeEach(function() { |
|
15 |
standalone_panorama = standalone_panorama || GMaps.createPanorama({ |
|
16 |
el : '#streetview-standalone-panorama', |
|
17 |
lat : 42.3455, |
|
18 |
lng : -71.0983, |
|
19 |
pov : { |
|
20 |
heading : 60, |
|
21 |
pitch : -10, |
|
22 |
zoom : 1 |
|
23 |
} |
|
24 |
}); |
|
25 |
}); |
|
26 |
|
|
27 |
it("should create a Street View panorama", function() { |
|
28 |
expect(standalone_panorama).toBeDefined(); |
|
29 |
}); |
|
30 |
}); |
|
31 |
|
|
32 |
describe("Attached to the current map", function() { |
|
33 |
beforeEach(function() { |
|
34 |
attached_panorama = attached_panorama || map_with_streetview.createPanorama({ |
|
35 |
el : '#streetview-panorama', |
|
36 |
pov : { |
|
37 |
heading : 60, |
|
38 |
pitch : -10, |
|
39 |
zoom : 1 |
|
40 |
} |
|
41 |
}); |
|
42 |
}); |
|
43 |
|
|
44 |
it("should be equal to the current map Street View panorama", function() { |
|
45 |
expect(map_with_streetview.getStreetView()).toEqual(attached_panorama); |
|
46 |
}); |
|
47 |
}); |
|
48 |
|
|
49 |
describe("With events", function() { |
|
50 |
var callbacks; |
|
51 |
|
|
52 |
beforeEach(function() { |
|
53 |
callbacks = { |
|
54 |
onpovchanged : function() { |
|
55 |
console.log(this); |
|
56 |
} |
|
57 |
}; |
|
58 |
|
|
59 |
spyOn(callbacks, 'onpovchanged').andCallThrough(); |
|
60 |
|
|
61 |
panorama_with_events = panorama_with_events || GMaps.createPanorama({ |
|
62 |
el : '#streetview-with-events', |
|
63 |
lat : 42.3455, |
|
64 |
lng : -71.0983, |
|
65 |
pov : { |
|
66 |
heading : 60, |
|
67 |
pitch : -10, |
|
68 |
zoom : 1 |
|
69 |
}, |
|
70 |
pov_changed : callbacks.onpovchanged |
|
71 |
}); |
|
72 |
}); |
|
73 |
|
|
74 |
it("should respond to pov_changed event", function() { |
|
75 |
panorama_with_events.setPov({ |
|
76 |
heading : 80, |
|
77 |
pitch : -10, |
|
78 |
zoom : 1 |
|
79 |
}); |
|
80 |
|
|
81 |
expect(callbacks.onpovchanged).toHaveBeenCalled(); |
|
82 |
}); |
|
83 |
}); |
|
84 |
}); |