-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Molly Lloyd
committed
Jan 10, 2017
1 parent
1bb0f0b
commit 299fc3b
Showing
3 changed files
with
51 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
'use strict'; | ||
|
||
const test = require('mapbox-gl-js-test').test; | ||
const window = require('../../../../js/util/window'); | ||
const Map = require('../../../../js/ui/map'); | ||
const LogoControl = require('../../../../js/ui/control/logo_control'); | ||
|
||
function createMap() { | ||
const container = window.document.createElement('div'); | ||
return new Map({ | ||
container: container, | ||
attributionControl: false, | ||
style: { | ||
version: 8, | ||
sources: {}, | ||
layers: [] | ||
} | ||
}); | ||
} | ||
|
||
test('LogoControl appears in bottom-left by default', (t) => { | ||
const map = createMap(); | ||
|
||
t.equal(map.getContainer().querySelectorAll('.mapboxgl-ctrl-bottom-left .mapboxgl-ctrl-logo').length, 1); | ||
t.end(); | ||
}); | ||
|
||
test('LogoControl appears in the position specified by the position option', (t) => { | ||
const map = createMap(); | ||
map.addControl(new LogoControl(), 'top-left'); | ||
|
||
t.equal(map.getContainer().querySelectorAll('.mapboxgl-ctrl-top-left .mapboxgl-ctrl-logo').length, 1); | ||
t.end(); | ||
}); | ||
|
||
test('LogoControl is removed from map when map.removeControl is called', (t) => { | ||
const map = createMap(); | ||
const logoControl = new LogoControl(); | ||
map.addControl(logoControl, 'top-left'); | ||
t.equal(map.getContainer().querySelectorAll('.mapboxgl-ctrl-top-left .mapboxgl-ctrl-logo').length, 1); | ||
map.removeControl(logoControl); | ||
t.equal(map.getContainer().querySelectorAll('.mapboxgl-ctrl-top-left .mapboxgl-ctrl-logo').length, 0); | ||
t.end(); | ||
}) | ||
|
||
|