map_spec.js 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /* global google, waitsFor */
  2. /* mock Attr2Options, knowns as parser */
  3. describe('map', function() {
  4. var elm, scope;
  5. // load the tabs code
  6. beforeEach(function() {
  7. module('ngMap');
  8. inject(function($rootScope, $compile) {
  9. elm = angular.element(
  10. '<map zoom="11"'+
  11. ' center="[40.74, -74.18]"'+
  12. ' disable-default-u-i="true"' +
  13. ' disable-double-click-zoom="true" '+
  14. ' draggable="false" '+
  15. ' draggable-cursor="help" '+
  16. ' dragging-cursor="move" '+
  17. ' keyboard-shortcuts="false" '+
  18. ' max-zoom="12" '+
  19. ' min-zoom="8" '+
  20. ' tilt="45" '+
  21. ' map-type-id="TERRAIN" '+
  22. ' zoom-control="true" '+
  23. " zoom-control-options='{style:\"small\",position:\"bottom_left\"}' "+
  24. ' map-type-control="true" '+
  25. " map-type-control-options='{position:\"top_right\", style:\"dropdown_menu\"}', "+
  26. ' overview-map-control="true" '+
  27. ' overview-map-control-options="{opened:true}" '+
  28. ' pan-control="true" '+
  29. " pan-control-options='{position:\"left_center\"}' "+
  30. ' rotate-control="true" '+
  31. " rotate-control-options='{position:\"right_center\"}' "+
  32. ' scale-control="true" '+
  33. " scale-control-options='{position:\"bottom_right\", style:\"default\"}' "+
  34. ' street-view-control="true" '+
  35. " street-view-control-options='{position:\"right_center\"}' "+
  36. '></map>');
  37. scope = $rootScope;
  38. $compile(elm)(scope);
  39. scope.$digest();
  40. waitsFor(function() {
  41. return scope.map;
  42. });
  43. });
  44. });
  45. it('should prepend a div tag', function() {
  46. var divTag = elm.find('div');
  47. expect(scope.map.getDiv()).toBe(divTag[0]);
  48. });
  49. it('should set map options', function() {
  50. expect(scope.map.getZoom()).toEqual(11);
  51. expect(scope.map.mapTypeId).toBe(google.maps.MapTypeId.TERRAIN);
  52. });
  53. it('should set map controls', function() {
  54. expect(scope.map.zoomControl).toBe(true);
  55. expect(scope.map.zoomControlOptions.style).toBe(google.maps.ZoomControlStyle.SMALL);
  56. expect(scope.map.zoomControlOptions.position).toBe(google.maps.ControlPosition.BOTTOM_LEFT);
  57. });
  58. it('should set events', function() {
  59. //TODO: need to test events, but don't know how to detect event in a map
  60. });
  61. it('should set observers', function() {
  62. //TODO: need to test observers
  63. });
  64. });