diff --git a/Gruntfile.js b/Gruntfile.js
index 3618bbc7..368951b2 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -28,10 +28,22 @@ module.exports = function(grunt) {
},
jasmine: {
- src: "src/client/js/*.js",
+ src: ['dist/Leaflet.BlurredLocationDisplay.js'],
options: {
specs: "spec/javascripts/*spec.js",
- vendor: ['node_modules/jquery/dist/jquery.js','dist/Leaflet.BlurredLocationDisplay.js','node_modules/jasmine-jquery/lib/jasmine-jquery.js'],
+ vendor: [
+ 'node_modules/jquery/dist/jquery.js',
+ 'node_modules/bootstrap/dist/js/bootstrap.min.js',
+ 'node_modules/jasmine-jquery/lib/jasmine-jquery.js' ,
+ 'node_modules/jasmine-ajax/lib/mock-ajax.js',
+ 'node_modules/leaflet-blurred-location/dist/Leaflet.BlurredLocation.js',
+ 'node_modules/leaflet-graticule/Leaflet.Graticule.js'
+ ],
+ summary: false,
+ keepRunner: true,
+ '--web-security' : false,
+ '--local-to-remote-url-access' : true,
+ '--ignore-ssl-errors' : true
}
},
@@ -50,9 +62,11 @@ module.exports = function(grunt) {
});
/* Default (development): Watch files and build on change. */
+ grunt.loadNpmTasks("grunt-contrib-jasmine");
+ grunt.registerTask("default", ["watch", "jasmine"]);
+ grunt.registerTask("test", ["jshint", "jasmine"]);
grunt.registerTask('build', [
'browserify:dist'
]);
- grunt.registerTask('test', ['jshint', 'jasmine']);
- grunt.registerTask('build', ['browserify']);
+
};
diff --git a/_SpecRunner.html b/_SpecRunner.html
new file mode 100644
index 00000000..250126e3
--- /dev/null
+++ b/_SpecRunner.html
@@ -0,0 +1,43 @@
+
+
+
+
+ Jasmine Spec Runner
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/examples/example.html b/examples/example.html
index d6dbe016..7dc6ae92 100644
--- a/examples/example.html
+++ b/examples/example.html
@@ -9,7 +9,7 @@
-
+
diff --git a/package.json b/package.json
index 89411085..1808a180 100644
--- a/package.json
+++ b/package.json
@@ -30,17 +30,14 @@
"jasmine-ajax": "^4.0.0",
"jasmine-jquery": "^2.1.1",
"leaflet": "^1.4.0",
- "leaflet-graticule": "git://github.com/jywarren/Leaflet.Graticule.git#patch-1",
- "map_module": "git://github.com/publiclab/leaflet-blurred-location#master",
"matchdep": "^2.0.0",
"require": "^2.4.20",
"resig-class": "^1.0.0",
"leaflet-graticule": "git://github.com/jywarren/Leaflet.Graticule.git#patch-1",
- "leaflet-blurred-location": "git://github.com/publiclab/leaflet-blurred-location#feature_API_modifications"
+ "leaflet-blurred-location": "git://github.com/publiclab/leaflet-blurred-location#main"
},
"dependencies": {
"jquery": "^3.3.1",
- "leaflet-blurred-location": "git://github.com/publiclab/leaflet-blurred-location#feature_API_modifications",
- "map_module": "git://github.com/publiclab/leaflet-blurred-location.git#master"
+ "leaflet-blurred-location": "git://github.com/publiclab/leaflet-blurred-location#main"
}
}
diff --git a/spec/javascripts/fixtures/example.html b/spec/javascripts/fixtures/example.html
new file mode 100644
index 00000000..18ac9d38
--- /dev/null
+++ b/spec/javascripts/fixtures/example.html
@@ -0,0 +1,632 @@
+
+
+
+
+ Leaflet.BlurredLocationDisplay
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Leaflet BlurredLocationDisplay | by Public Lab
+
+
This page shows how different markers are shown according to their precision at different zoom levels .
+
+
+
+
+
1.) At zoom level = 5 , all 7 markers are shown :
+
+ [23.1 , 77.1] ,
+ [20.1 , 76.1] ,
+ [21.111 , 76.111] ,
+ [22.111 , 78.111],
+ [23.1234 , 76.1234],
+ [24.123456 , 78.123456],
+ [25.123456 , 77.123456]
+
+
+
+
2.) At zoom level = 6 , 5 markers are shown :
+
+ [21.111 , 76.111],
+ [22.111 , 78.111],
+ [23.1234 , 76.1234],
+ [24.123456 , 78.123456],
+ [25.123456 , 77.123456]
+
+
+
+
3.) At zoom level = 8 , 3 markers are shown :
+
+ [23.1234 , 76.1234],
+ [24.123456 , 78.123456],
+ [25.123456 , 77.123456]
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/spec/javascripts/test_spec.js b/spec/javascripts/test_spec.js
index 269a9d28..20c0e6e6 100644
--- a/spec/javascripts/test_spec.js
+++ b/spec/javascripts/test_spec.js
@@ -1,5 +1,39 @@
+//jasmine.getFixtures().fixturesPath = 'spec/javascripts/fixtures' ;
+
describe("Basic testing", function() {
+
+ // var fixture = loadFixtures('example.html');
+
+ beforeEach(function () {
+ loadFixtures('example.html');
+ });
+
it("Basic Test", function () {
expect(true).toBe(true);
});
+
+ it("Checks if at zoom level 5 , all 7 markers are shown", function () {
+ // var fixture = loadFixtures('example.html');
+ expect($("#map1").children()[0].childNodes[3].childNodes.length).toBe(7) ;
+ });
+
+ it("Checks if at zoom level 6 , only 5 markers are shown", function () {
+ // BlurredLocation2.map.setZoom(6);
+ // var fixture = loadFixtures('example.html');
+ expect($("#map2").children()[0].childNodes[3].childNodes.length).toBe(5) ;
+ });
+
+ it("Checks if at zoom level 8 , only 3 markers are shown", function () {
+ //BlurredLocation3.map.setZoom(8);
+ // var fixture = loadFixtures('example.html');
+ expect($("#map3").children()[0].childNodes[3].childNodes.length).toBe(3) ;
+ });
+
+ it("maps are loaded", function () {
+ // var fixture = loadFixtures('example.html');
+ expect(document.getElementById('map1')).toBeInDOM() ;
+ expect($("#map2")).toBeInDOM() ;
+ expect($("#map3")).toBeInDOM() ;
+ });
+
});
diff --git a/spec/support/jasmine.json b/spec/support/jasmine.json
index 3ea31669..c9b53dbf 100644
--- a/spec/support/jasmine.json
+++ b/spec/support/jasmine.json
@@ -1,7 +1,7 @@
{
"spec_dir": "spec",
"spec_files": [
- "**/*[sS]pec.js"
+ "spec/**/*.js"
],
"helpers": [
"helpers/**/*.js"