Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
mridulnagpal committed May 21, 2017
1 parent 3fc70ae commit 9ee304b
Show file tree
Hide file tree
Showing 8 changed files with 43 additions and 23 deletions.
3 changes: 2 additions & 1 deletion .jshintrc
Original file line number Diff line number Diff line change
Expand Up @@ -87,5 +87,6 @@
"yui" : false, // Yahoo User Interface

// Custom Globals
"globals" : {} // additional predefined global variables
"globals" : {"L" : true,
"exports" : true} // additional predefined global variables
}
8 changes: 4 additions & 4 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,16 @@ module.exports = function(grunt) {
browserify: {
dist: {
src: [
'src/PublicLab.Map.js'
'src/Leaflet.BlurredLocation.js'
],
dest: 'dist/PublicLab.Map.js'
dest: 'dist/Leaflet.BlurredLocation.js'
}
},

uglify: {
my_target: {
files: {
'dist/dist/Leaflet.BlurredLocation.js': ['src/location_tags.js', 'src/locationForm.js', 'main.js']
'dist/Leaflet.BlurredLocation.js': ['src/location_tags.js', 'src/locationForm.js', 'main.js']
}
}
},
Expand All @@ -41,7 +41,7 @@ module.exports = function(grunt) {
src: "src/client/js/*.js",
options: {
specs: "spec/javascripts/*spec.js",
vendor: ['node_modules/jquery/dist/jquery.js','node_modules/leaflet/dist/leaflet-src.js','src/*.js',],
vendor: ['node_modules/jquery/dist/jquery.js','node_modules/leaflet/dist/leaflet-src.js','src/*.js','node_modules/jasmine-jquery/lib/jasmine-jquery.js'],
}
},

Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"Public Lab"
],
"description": "Test for PublicLab maps",
"main": "dist/dist/Leaflet.BlurredLocation.js",
"main": "dist/Leaflet.BlurredLocation.js",
"keywords": [
"publiclab"
],
Expand Down
1 change: 0 additions & 1 deletion dist/PublicLab.Map.css

This file was deleted.

1 change: 0 additions & 1 deletion dist/PublicLab.Map.js

This file was deleted.

8 changes: 4 additions & 4 deletions examples/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
<html lang="en">
<head>

<title>PublicLab.Map</title>
<title>Leaflet.BlurredLocation</title>

<script src="https://maps.googleapis.com/maps/api/js?libraries=places&language=en&key=AIzaSyDWgc7p4WWFsO3y0MTe50vF4l4NUPcPuwE"></script>
<link href="../node_modules/leaflet/dist/leaflet.css" rel="stylesheet">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link href="../dist/PublicLab.Map.css" rel="stylesheet">
<!-- <script src="../dist/PublicLab.Map.js"></script> -->
<!-- <link href="../dist/Leaflet.BlurredLocation.css" rel="stylesheet"> -->
<!-- <script src="../dist/Leaflet.BlurredLocation.js"></script> -->
</head>
<body>
<style>
Expand Down Expand Up @@ -55,7 +55,7 @@ <h4 class="font-size-small">Option 3 : By giving co-ordinates</h4></br>
<div class="col-md-4">
<h3 class="font-size-small">On a map : </h3>
<br />
<div id="map" class="leaflet-map"></div>
<div id="map" class="leaflet-map" style="width: 400px; height: 400px;"></div>
<br/>
<h3 class="font-size-small">In Text:</h3><br/>
<input id="location" type="text" class="form-control"><br/>
Expand Down
20 changes: 15 additions & 5 deletions spec/javascripts/test_spec.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,24 @@
/*global BlurredLocation */
describe("Basic suite", function() {
var map;

describe("Testing changing view", function() {
"use strict";

var fixture = loadFixtures('index.html');
map = L.map('map');

var blurredLocatoion = new BlurredLocation({
lat: 41.01,
lon: -85.66
});

console.log(blurredLocatoion.getLat() == 41.01);

map.setView([51.50, -0.09], 13);

it("lat spec", function() {
expect(blurredLocatoion.getLat()).toBe(41.01);
});
expect(blurredLocatoion.getLat()).toBe(51.50);
});
it("lon spec", function() {
expect(blurredLocatoion.getLon()).toBe(-85.66);
expect(blurredLocatoion.getLon()).toBe(-0.09);
});
});
23 changes: 17 additions & 6 deletions src/object.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,21 @@
function BlurredLocation(location) {
this.getLat = function () {
return location.lat;
}
this.getLon = function() {
return location.lon;
}
if(map) {
map.setView([location.lat, location.lon], 10);
this.getLat = function () {
return map.getCenter().lat;
}
this.getLon = function() {
return map.getCenter().lng;
}
}
else {
this.getLat = function () {
return location['lat'];
}
this.getLon = function() {
return location['lon'];
}
}
}

exports.BlurredLocation = BlurredLocation;

0 comments on commit 9ee304b

Please sign in to comment.