This repository was archived by the owner on Apr 19, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 253
Expand file tree
/
Copy pathgoogle-map-basic.html
More file actions
100 lines (85 loc) · 2.88 KB
/
google-map-basic.html
File metadata and controls
100 lines (85 loc) · 2.88 KB
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
<!doctype html>
<!-- Copyright (c) 2014 Google Inc. All rights reserved. -->
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes">
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
<script src="../../web-component-tester/browser.js"></script>
<link rel="import" href="../google-map.html">
</head>
<body>
<google-map id="map1"></google-map>
<google-map id="map2" latitude="37.555" longitude="-122.555"></google-map>
<google-map id="map3" disable-zoom zoom="11" min-zoom="10" max-zoom="11"
no-auto-tilt fit-to-markers single-info-window></google-map>
<div id="newmap"></div>
<script>
var map = document.querySelector('#map1');
var map2 = document.querySelector('#map2');
var map3 = document.querySelector('#map3');
var whenReady = function(m, cb) {
if (m.map) {
cb();
} else {
m.addEventListener('google-map-ready', cb);
}
};
suite('google-map', function() {
// TODO: test setting an invalid latitude/longitude value. See if throws.
test('invalid lat/lng', function() {
});
test.skip('invalid lat/lng');
test('noAutoTilt', function() {
whenReady(map, function(e) {
// When noAutoTilt is set, tilt is left at default (45).
assert.equal(map.map.getTilt(), 45);
});
whenReady(map3, function(e) {
// When noAutoTilt is set, tilt is set to 0.
assert.equal(map3.map.getTilt(), 0);
});
});
// TODO: check toggling showCenterMarker to see if marker is added/removed from map.
// TODO: test draggable attribute.
test('draggable', function() {
});
test.skip('draggable');
// TODO: test fitToMarkers actually contains all markers
test('fitToMarkers', function() {
});
test.skip('fitToMarkers');
// TODO: test panning map and changing it's zoom updates .latitude/longitude/.zoom properties.
test('panning', function() {
});
test.skip('panning');
test('defaults', function() {
assert.equal(map.markers.length, 0);
assert.isFalse(map.fitToMarkers);
assert.isFalse(map.disableDefaultUi);
assert.equal(map.zoom, 10);
assert.equal(map.noAutoTilt, false);
assert.isUndefined(map.maxZoom);
assert.isUndefined(map.minZoom);
assert.isFalse(map.disableZoom);
assert.isFalse(map.singleInfoWindow);
assert.equal(map.latitude, 37.77493);
assert.equal(map.longitude, -122.41942);
assert.equal(map.mapType, 'roadmap');
});
test('change properties', function(done) {
whenReady(map3, function(e) {
assert.isTrue(map3.fitToMarkers);
assert.equal(map3.markers.length, 0);
assert.equal(map3.zoom, map3.map.getZoom());
assert.equal(map3.maxZoom, map3.map.maxZoom);
assert.equal(map3.minZoom, map3.map.minZoom);
assert.isTrue(map3.disableZoom);
assert.isTrue(map3.singleInfoWindow);
done();
});
});
});
</script>
</body>
</html>