This repository was archived by the owner on Feb 26, 2024. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ var registerElementPatch = require('./register-element');
88var webSocketPatch = require ( './websocket' ) ;
99var eventTargetPatch = require ( './event-target' ) ;
1010var propertyDescriptorPatch = require ( './property-descriptor' ) ;
11+ var geolocationPatch = require ( './geolocation' ) ;
1112
1213function apply ( ) {
1314 fnPatch . patchSetClearFunction ( global , [
@@ -39,6 +40,8 @@ function apply() {
3940 definePropertyPatch . apply ( ) ;
4041
4142 registerElementPatch . apply ( ) ;
43+
44+ geolocationPatch . apply ( ) ;
4245}
4346
4447module . exports = {
Original file line number Diff line number Diff line change 1+ 'use strict' ;
2+
3+ var utils = require ( '../utils' ) ;
4+
5+ function apply ( ) {
6+ if ( global . navigator && global . navigator . geolocation ) {
7+ utils . patchPrototype ( global . navigator . geolocation , [
8+ 'getCurrentPosition' ,
9+ 'watchPosition'
10+ ] ) ;
11+ }
12+ }
13+
14+ module . exports = {
15+ apply : apply
16+ }
Original file line number Diff line number Diff line change 1+ 'use strict' ;
2+
3+ function supportsGeolocation ( ) {
4+ return 'geolocation' in navigator ;
5+ }
6+ supportsGeolocation . message = 'Geolocation' ;
7+
8+ describe ( 'Geolocation' , ifEnvSupports ( supportsGeolocation , function ( ) {
9+ var testZone = zone . fork ( ) ;
10+
11+ it ( 'should work for getCurrentPosition' , function ( done ) {
12+ testZone . run ( function ( ) {
13+ navigator . geolocation . getCurrentPosition (
14+ function ( pos ) {
15+ expect ( window . zone ) . toBeDirectChildOf ( testZone ) ;
16+ done ( ) ;
17+ }
18+ ) ;
19+ } ) ;
20+ } ) ;
21+
22+ it ( 'should work for watchPosition' , function ( done ) {
23+ testZone . run ( function ( ) {
24+ var watchId ;
25+ watchId = navigator . geolocation . watchPosition (
26+ function ( pos ) {
27+ expect ( window . zone ) . toBeDirectChildOf ( testZone ) ;
28+ navigator . geolocation . clearWatch ( watchId ) ;
29+ done ( ) ;
30+ }
31+ ) ;
32+ } ) ;
33+ } ) ;
34+ } ) ) ;
You can’t perform that action at this time.
0 commit comments