From 5a28b5bbe6f70c996684aa2e6bd31ab51492df98 Mon Sep 17 00:00:00 2001 From: Eric Leung Date: Sun, 17 Apr 2016 19:46:54 -0700 Subject: [PATCH] Add tests Get Geo-location Data challenge --- .../json-apis-and-ajax.json | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/seed/challenges/01-front-end-development-certification/json-apis-and-ajax.json b/seed/challenges/01-front-end-development-certification/json-apis-and-ajax.json index d9198a6935..f7116fe364 100644 --- a/seed/challenges/01-front-end-development-certification/json-apis-and-ajax.json +++ b/seed/challenges/01-front-end-development-certification/json-apis-and-ajax.json @@ -447,7 +447,7 @@ "You will see a prompt to allow or block this site from knowing your current location. The challenge can be completed either way, as long as the code is correct.", "By selecting allow you will see the text on the output phone change to your latitude and longitude", "Here's some code that does this:", - "
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function(position) {
$(\"#data\").html(\"latitude: \" + position.coords.latitude + \"<br>longitude: \" + position.coords.longitude);
});
}
" + "
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function(position) {
$(\"#data\").html(\"latitude: \" + position.coords.latitude + \"<br>longitude: \" + position.coords.longitude);
});
}
" ], "challengeSeed": [ "fccss", @@ -463,7 +463,10 @@ "" ], "tests": [ - "assert(code.match(/navigator\\.geolocation\\.getCurrentPosition/gi), 'message: You should make use of the navigator.geolocation to access the users current location.');" + "assert(code.match(/navigator\\.geolocation\\.getCurrentPosition/gi), 'message: You should make use of navigator.geolocation to access the users current location.');", + "assert(code.match(/position\\.coords\\.latitude/gi), 'message: You should make use of position.coords.latitude to display the users' latitudinal location.');", + "assert(code.match(/position\\.coords\\.longitude/gi), 'message: You should make use of position.coords.longitude to display the users' longitudinal location.');", + "assert(code.match(/\\$\\(\\s*\"#data\"\\s*\\)\\s*\\.html\\([.\\w\\W]*?\\);/gi), 'message: You should display the users' position within the data div element');" ], "type": "waypoint", "challengeType": 0,