ControlSpec.js
1.23 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
describe('Creating custom map controls', function () {
var map;
beforeEach(function() {
map = map || new GMaps({
el : '#basic-map',
lat: -12.0433,
lng: -77.0283,
zoom: 12
});
});
it('should add default styles for the control', function () {
map.addControl({
position: 'top_right',
content: 'Geolocate'
});
expect(map.controls[0].position).toEqual(google.maps.ControlPosition.TOP_RIGHT);
expect(map.controls[0].style.fontFamily).not.toEqual('');
});
it('should leave off default styles if requested', function () {
map.addControl({
position: 'top_right',
disableDefaultStyles: true,
content: '<i class="icon"></i>'
});
expect(map.controls[1].position).toEqual(google.maps.ControlPosition.TOP_RIGHT);
expect(map.map.controls[google.maps.ControlPosition.TOP_RIGHT].length).toEqual(2);
expect(map.controls[1].style.fontFamily).toEqual('');
});
it('should remove control', function () {
var control = map.controls[0];
map.removeControl(control);
expect(map.controls.length).toEqual(1);
expect(map.map.controls[google.maps.ControlPosition.TOP_RIGHT].length).toEqual(1);
expect(map.controls[0]).not.toEqual(control);
});
});