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