-
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.
do not display fullscreen control on unsupported devices (#4838)
* do not display fullscreen control on unsupported devices #4786 * move className into class property #4838 * check for fullscreen support with fullscreenEnabled #4838 * remove extra mozFullScreenEnabled check #4838 * check that Fullscreen control gets added then fullscreen is enabled #4838
- Loading branch information
1 parent
39d9175
commit 7b803b6
Showing
2 changed files
with
70 additions
and
12 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
'use strict'; | ||
|
||
const test = require('mapbox-gl-js-test').test; | ||
const window = require('../../../../src/util/window'); | ||
const Map = require('../../../../src/ui/map'); | ||
const FullscreenControl = require('../../../../src/ui/control/fullscreen_control'); | ||
|
||
function createMap() { | ||
const container = window.document.createElement('div'); | ||
return new Map({ | ||
container: container, | ||
style: { | ||
version: 8, | ||
sources: {}, | ||
layers: [] | ||
} | ||
}); | ||
} | ||
|
||
test('FullscreenControl appears then fullscreen enabled', (t) => { | ||
window.document.fullscreenEnabled = true; | ||
|
||
const map = createMap(); | ||
const fullscreen = new FullscreenControl(); | ||
map.addControl(fullscreen); | ||
|
||
t.equal(map.getContainer().querySelectorAll('.mapboxgl-ctrl-fullscreen').length, 1); | ||
t.end(); | ||
}); | ||
|
||
test('FullscreenControl does not appears then fullscreen is not enabled', (t) => { | ||
window.document.fullscreenEnabled = false; | ||
|
||
const map = createMap(); | ||
const fullscreen = new FullscreenControl(); | ||
map.addControl(fullscreen); | ||
|
||
t.equal(map.getContainer().querySelectorAll('.mapboxgl-ctrl-fullscreen').length, 0); | ||
t.end(); | ||
}); |