Sha256: 47be454362a4e0d54b594a32606b3cb0017954ff41aeb07b39e357b866fc41f1

Contents?: true

Size: 1.91 KB

Versions: 10

Compression:

Stored size: 1.91 KB

Contents

var gmap;

beforeEach(function() {
  gmap = new Gmaps4RailsGoogle();
});

describe("initialization", function() {
  
  beforeEach(function() {
    this.default_config = {
      maxZoom:                gmap.map_options.maxZoom,
      minZoom:                gmap.map_options.minZoom,
      zoom:                   gmap.map_options.zoom,
      center:                 gmap.createLatLng(gmap.map_options.center_latitude, gmap.map_options.center_longitude),
      mapTypeId:              google.maps.MapTypeId[gmap.map_options.type],
      mapTypeControl:         gmap.map_options.mapTypeControl,
      disableDefaultUI:       gmap.map_options.disableDefaultUI,
      disableDoubleClickZoom: gmap.map_options.disableDoubleClickZoom,
      draggable:              gmap.map_options.draggable
    }
    
    spyOn(document, "getElementById").andReturn("map");
    spyOn(google.maps, "Map"); 
  });
  
  it("should send default config when no raw provided", function() {
    gmap.createMap();
    expect(google.maps.Map).toHaveBeenCalledWith("map", this.default_config);
  });
  
  it("should take default config passed", function() {
    gmap.map_options.raw = { disableDefaultUI: true, heading: 20 };
    gmap.createMap();
    var correct_options = {
      maxZoom:                gmap.map_options.maxZoom,
      minZoom:                gmap.map_options.minZoom,
      zoom:                   gmap.map_options.zoom,
      center:                 gmap.createLatLng(gmap.map_options.center_latitude, gmap.map_options.center_longitude),
      mapTypeId:              google.maps.MapTypeId[gmap.map_options.type],
      mapTypeControl:         gmap.map_options.mapTypeControl,
      disableDefaultUI:       true,
      disableDoubleClickZoom: gmap.map_options.disableDoubleClickZoom,
      draggable:              gmap.map_options.draggable,
      heading:                20
    };
    expect(google.maps.Map).toHaveBeenCalledWith("map", correct_options);

  });
});

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
gmaps4rails-1.5.7 spec/javascripts/map_spec.js
gmaps4rails-1.5.6 spec/javascripts/map_spec.js
gmaps4rails-1.5.5 spec/javascripts/map_spec.js
gmaps4rails-1.5.4 spec/javascripts/map_spec.js
gmaps4rails-1.5.3 spec/javascripts/map_spec.js
gmaps4rails-1.5.2 spec/javascripts/map_spec.js
gmaps4rails-1.5.1 spec/javascripts/map_spec.js
gmaps4rails-1.5.0 spec/javascripts/map_spec.js
gmaps4rails-1.5.0.pre2 spec/javascripts/map_spec.js
gmaps4rails-1.5.0.pre spec/javascripts/map_spec.js