JS tests pass
This commit is contained in:
parent
a0bff73401
commit
1eadf4b7ed
10 changed files with 124 additions and 121 deletions
12
Makefile
12
Makefile
|
@ -29,6 +29,18 @@ ui:
|
||||||
mkdir -p umap/static/umap/vendors/georsstogeojson/ && cp -r node_modules/georsstogeojson/GeoRSSToGeoJSON.js umap/static/umap/vendors/georsstogeojson/
|
mkdir -p umap/static/umap/vendors/georsstogeojson/ && cp -r node_modules/georsstogeojson/GeoRSSToGeoJSON.js umap/static/umap/vendors/georsstogeojson/
|
||||||
mkdir -p umap/static/umap/vendors/togpx/ && cp -r node_modules/togpx/togpx.js umap/static/umap/vendors/togpx/
|
mkdir -p umap/static/umap/vendors/togpx/ && cp -r node_modules/togpx/togpx.js umap/static/umap/vendors/togpx/
|
||||||
mkdir -p umap/static/umap/vendors/tokml && cp -r node_modules/tokml/tokml.js umap/static/umap/vendors/tokml
|
mkdir -p umap/static/umap/vendors/tokml && cp -r node_modules/tokml/tokml.js umap/static/umap/vendors/tokml
|
||||||
|
installjs:
|
||||||
|
npm install
|
||||||
|
testjsfx:
|
||||||
|
firefox umap/static/umap/test/index.html
|
||||||
|
testjs: node_modules
|
||||||
|
@./node_modules/mocha-phantomjs/bin/mocha-phantomjs --view 1024x768 umap/static/umap/test/index.html
|
||||||
|
i18n:
|
||||||
|
node node_modules/leaflet-i18n/bin/i18n.js --dir_path=umap/static/umap/js/ --dir_path=umap/static/umap/vendors/measurable/ --locale_dir_path=umap/static/umap/locale/ --locale_codes=en --mode=json --clean --default_values
|
||||||
|
# tx_push:
|
||||||
|
# tx push -s
|
||||||
|
# tx_pull:
|
||||||
|
# tx pull
|
||||||
|
|
||||||
|
|
||||||
.PHONY: ui
|
.PHONY: ui
|
||||||
|
|
4
package-lock.json
generated
4
package-lock.json
generated
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "leaflet-storage",
|
"name": "umap",
|
||||||
"version": "0.8.2",
|
"version": "1.0.0-alpha.1",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
describe('L.Storage.Controls', function(){
|
describe('L.Utorage.Controls', function(){
|
||||||
|
|
||||||
before(function () {
|
before(function () {
|
||||||
this.server = sinon.fakeServer.create();
|
this.server = sinon.fakeServer.create();
|
||||||
|
|
|
@ -83,20 +83,14 @@ describe('L.DataLayer', function () {
|
||||||
cleanAlert();
|
cleanAlert();
|
||||||
this.server.flush();
|
this.server.flush();
|
||||||
this.server.respondWith('POST', '/map/99/update/settings/', JSON.stringify({id: 99}));
|
this.server.respondWith('POST', '/map/99/update/settings/', JSON.stringify({id: 99}));
|
||||||
// this.server.respondWith('POST', '/map/99/datalayer/update/62/', [412, {}, '']);
|
this.server.respondWith('POST', '/map/99/datalayer/update/62/', [412, {}, '']);
|
||||||
this.server.respondWith('POST', '/map/99/datalayer/update/62/', function (request) {
|
|
||||||
console.log('YESYESYEYESYEYEYEYSES')
|
|
||||||
request.respond()
|
|
||||||
});
|
|
||||||
happen.click(editButton);
|
happen.click(editButton);
|
||||||
input = qs('form.storage-form input[name="name"]');
|
input = qs('form.storage-form input[name="name"]');
|
||||||
input.value = 'a new name';
|
input.value = 'a new name';
|
||||||
happen.once(input, {type: 'input'});
|
happen.once(input, {type: 'input'});
|
||||||
clickSave();
|
clickSave();
|
||||||
this.server.respond();
|
this.server.respond();
|
||||||
console.log('between responses')
|
|
||||||
this.server.respond();
|
this.server.respond();
|
||||||
console.log(this.map._container.classList)
|
|
||||||
assert(L.DomUtil.hasClass(this.map._container, 'storage-alert'));
|
assert(L.DomUtil.hasClass(this.map._container, 'storage-alert'));
|
||||||
assert.notEqual(this.map.dirty_datalayers.indexOf(this.datalayer), -1);
|
assert.notEqual(this.map.dirty_datalayers.indexOf(this.datalayer), -1);
|
||||||
forceButton = qs('#storage-alert-container .storage-action');
|
forceButton = qs('#storage-alert-container .storage-action');
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
describe('L.Storage.FeatureMixin', function () {
|
describe('L.Utorage.FeatureMixin', function () {
|
||||||
|
|
||||||
before(function () {
|
before(function () {
|
||||||
this.server = sinon.fakeServer.create();
|
this.server = sinon.fakeServer.create();
|
||||||
|
@ -69,7 +69,6 @@ describe('L.Storage.FeatureMixin', function () {
|
||||||
var input = qs('#storage-feature-shape-properties input[name="stroke"]');
|
var input = qs('#storage-feature-shape-properties input[name="stroke"]');
|
||||||
assert.ok(input);
|
assert.ok(input);
|
||||||
input.checked = false;
|
input.checked = false;
|
||||||
console.log(input, input.checked)
|
|
||||||
happen.once(input, {type: 'change'});
|
happen.once(input, {type: 'change'});
|
||||||
assert.ok(qs('path[stroke="none"]'));
|
assert.ok(qs('path[stroke="none"]'));
|
||||||
assert.ok(qs('path[fill="none"]')); // Polyline fill is unchanged
|
assert.ok(qs('path[fill="none"]')); // Polyline fill is unchanged
|
||||||
|
@ -132,7 +131,6 @@ describe('L.Storage.FeatureMixin', function () {
|
||||||
it('should generate a valid geojson', function () {
|
it('should generate a valid geojson', function () {
|
||||||
setFeatures(this.datalayer);
|
setFeatures(this.datalayer);
|
||||||
assert.ok(poly);
|
assert.ok(poly);
|
||||||
console.log(poly.toGeoJSON().geometry);
|
|
||||||
assert.deepEqual(poly.toGeoJSON().geometry, {'type': 'Polygon', 'coordinates': [[[11.25, 53.585984], [10.151367, 52.975108], [12.689209, 52.167194], [14.084473, 53.199452], [12.634277, 53.618579], [11.25, 53.585984], [11.25, 53.585984]]]});
|
assert.deepEqual(poly.toGeoJSON().geometry, {'type': 'Polygon', 'coordinates': [[[11.25, 53.585984], [10.151367, 52.975108], [12.689209, 52.167194], [14.084473, 53.199452], [12.634277, 53.618579], [11.25, 53.585984], [11.25, 53.585984]]]});
|
||||||
// Ensure original latlngs has not been modified
|
// Ensure original latlngs has not been modified
|
||||||
assert.equal(poly.getLatLngs()[0].length, 6);
|
assert.equal(poly.getLatLngs()[0].length, 6);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
describe('L.Storage.Map', function(){
|
describe('L.Utorage.Map', function(){
|
||||||
|
|
||||||
before(function () {
|
before(function () {
|
||||||
this.server = sinon.fakeServer.create();
|
this.server = sinon.fakeServer.create();
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
describe('L.Storage.Polygon', function () {
|
describe('L.Utorage.Polygon', function () {
|
||||||
var p2ll, map;
|
var p2ll, map;
|
||||||
|
|
||||||
before(function () {
|
before(function () {
|
||||||
|
@ -23,7 +23,7 @@ describe('L.Storage.Polygon', function () {
|
||||||
describe('#isMulti()', function () {
|
describe('#isMulti()', function () {
|
||||||
|
|
||||||
it('should return false for basic Polygon', function () {
|
it('should return false for basic Polygon', function () {
|
||||||
var layer = new L.S.Polygon(this.map, [[1, 2], [3, 4], [5, 6]], {datalayer: this.datalayer});
|
var layer = new L.U.Polygon(this.map, [[1, 2], [3, 4], [5, 6]], {datalayer: this.datalayer});
|
||||||
assert.notOk(layer.isMulti())
|
assert.notOk(layer.isMulti())
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -31,12 +31,12 @@ describe('L.Storage.Polygon', function () {
|
||||||
var latlngs = [
|
var latlngs = [
|
||||||
[[p2ll(100, 150), p2ll(150, 200), p2ll(200, 100)]]
|
[[p2ll(100, 150), p2ll(150, 200), p2ll(200, 100)]]
|
||||||
],
|
],
|
||||||
layer = new L.S.Polygon(this.map, latlngs, {datalayer: this.datalayer});
|
layer = new L.U.Polygon(this.map, latlngs, {datalayer: this.datalayer});
|
||||||
assert.notOk(layer.isMulti())
|
assert.notOk(layer.isMulti())
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return false for simple Polygon with hole', function () {
|
it('should return false for simple Polygon with hole', function () {
|
||||||
var layer = new L.S.Polygon(this.map, [[[1, 2], [3, 4], [5, 6]], [[7, 8], [9, 10], [11, 12]]], {datalayer: this.datalayer});
|
var layer = new L.U.Polygon(this.map, [[[1, 2], [3, 4], [5, 6]], [[7, 8], [9, 10], [11, 12]]], {datalayer: this.datalayer});
|
||||||
assert.notOk(layer.isMulti())
|
assert.notOk(layer.isMulti())
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ describe('L.Storage.Polygon', function () {
|
||||||
[[7, 8], [9, 10], [11, 12]]
|
[[7, 8], [9, 10], [11, 12]]
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
var layer = new L.S.Polygon(this.map, latLngs, {datalayer: this.datalayer});
|
var layer = new L.U.Polygon(this.map, latLngs, {datalayer: this.datalayer});
|
||||||
assert.ok(layer.isMulti())
|
assert.ok(layer.isMulti())
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ describe('L.Storage.Polygon', function () {
|
||||||
[[[10, 20], [30, 40], [50, 60]]],
|
[[[10, 20], [30, 40], [50, 60]]],
|
||||||
[[[0, 10], [10, 10], [10, 0]], [[2, 3], [2, 4], [3, 4]]]
|
[[[0, 10], [10, 10], [10, 0]], [[2, 3], [2, 4], [3, 4]]]
|
||||||
];
|
];
|
||||||
var layer = new L.S.Polygon(this.map, latLngs, {datalayer: this.datalayer});
|
var layer = new L.U.Polygon(this.map, latLngs, {datalayer: this.datalayer});
|
||||||
assert.ok(layer.isMulti())
|
assert.ok(layer.isMulti())
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@ describe('L.Storage.Polygon', function () {
|
||||||
[[p2ll(100, 150), p2ll(150, 200), p2ll(200, 100)]],
|
[[p2ll(100, 150), p2ll(150, 200), p2ll(200, 100)]],
|
||||||
[[p2ll(300, 350), p2ll(350, 400), p2ll(400, 300)]]
|
[[p2ll(300, 350), p2ll(350, 400), p2ll(400, 300)]]
|
||||||
],
|
],
|
||||||
layer = new L.S.Polygon(this.map, latlngs, {datalayer: this.datalayer}).addTo(this.datalayer);
|
layer = new L.U.Polygon(this.map, latlngs, {datalayer: this.datalayer}).addTo(this.datalayer);
|
||||||
happen.once(layer._path, {type: 'contextmenu'});
|
happen.once(layer._path, {type: 'contextmenu'});
|
||||||
assert.equal(qst('Remove shape from the multi'), 1);
|
assert.equal(qst('Remove shape from the multi'), 1);
|
||||||
});
|
});
|
||||||
|
@ -87,7 +87,7 @@ describe('L.Storage.Polygon', function () {
|
||||||
var latlngs = [
|
var latlngs = [
|
||||||
[[p2ll(100, 150), p2ll(150, 200), p2ll(200, 100)]]
|
[[p2ll(100, 150), p2ll(150, 200), p2ll(200, 100)]]
|
||||||
],
|
],
|
||||||
layer = new L.S.Polygon(this.map, latlngs, {datalayer: this.datalayer}).addTo(this.datalayer);
|
layer = new L.U.Polygon(this.map, latlngs, {datalayer: this.datalayer}).addTo(this.datalayer);
|
||||||
happen.once(layer._path, {type: 'contextmenu'});
|
happen.once(layer._path, {type: 'contextmenu'});
|
||||||
assert.notOk(qst('Remove shape from the multi'));
|
assert.notOk(qst('Remove shape from the multi'));
|
||||||
});
|
});
|
||||||
|
@ -96,7 +96,7 @@ describe('L.Storage.Polygon', function () {
|
||||||
var latlngs = [
|
var latlngs = [
|
||||||
[[p2ll(100, 150), p2ll(150, 200), p2ll(200, 100)]]
|
[[p2ll(100, 150), p2ll(150, 200), p2ll(200, 100)]]
|
||||||
],
|
],
|
||||||
layer = new L.S.Polygon(this.map, latlngs, {datalayer: this.datalayer}).addTo(this.datalayer);
|
layer = new L.U.Polygon(this.map, latlngs, {datalayer: this.datalayer}).addTo(this.datalayer);
|
||||||
happen.once(layer._path, {type: 'contextmenu'});
|
happen.once(layer._path, {type: 'contextmenu'});
|
||||||
assert.notOk(qst('Extract shape to separate feature'));
|
assert.notOk(qst('Extract shape to separate feature'));
|
||||||
});
|
});
|
||||||
|
@ -106,7 +106,7 @@ describe('L.Storage.Polygon', function () {
|
||||||
[[p2ll(100, 150), p2ll(150, 200), p2ll(200, 100)]],
|
[[p2ll(100, 150), p2ll(150, 200), p2ll(200, 100)]],
|
||||||
[[p2ll(300, 350), p2ll(350, 400), p2ll(400, 300)]]
|
[[p2ll(300, 350), p2ll(350, 400), p2ll(400, 300)]]
|
||||||
],
|
],
|
||||||
layer = new L.S.Polygon(this.map, latlngs, {datalayer: this.datalayer}).addTo(this.datalayer);
|
layer = new L.U.Polygon(this.map, latlngs, {datalayer: this.datalayer}).addTo(this.datalayer);
|
||||||
happen.once(layer._path, {type: 'contextmenu'});
|
happen.once(layer._path, {type: 'contextmenu'});
|
||||||
assert.ok(qst('Extract shape to separate feature'));
|
assert.ok(qst('Extract shape to separate feature'));
|
||||||
});
|
});
|
||||||
|
@ -116,7 +116,7 @@ describe('L.Storage.Polygon', function () {
|
||||||
[[p2ll(100, 150), p2ll(150, 200), p2ll(200, 100)]],
|
[[p2ll(100, 150), p2ll(150, 200), p2ll(200, 100)]],
|
||||||
[[p2ll(300, 350), p2ll(350, 400), p2ll(400, 300)]]
|
[[p2ll(300, 350), p2ll(350, 400), p2ll(400, 300)]]
|
||||||
],
|
],
|
||||||
layer = new L.S.Polygon(this.map, latlngs, {datalayer: this.datalayer}).addTo(this.datalayer);
|
layer = new L.U.Polygon(this.map, latlngs, {datalayer: this.datalayer}).addTo(this.datalayer);
|
||||||
happen.once(layer._path, {type: 'contextmenu'});
|
happen.once(layer._path, {type: 'contextmenu'});
|
||||||
assert.notOk(qst('Transform to lines'));
|
assert.notOk(qst('Transform to lines'));
|
||||||
});
|
});
|
||||||
|
@ -128,7 +128,7 @@ describe('L.Storage.Polygon', function () {
|
||||||
[p2ll(120, 150), p2ll(150, 180), p2ll(180, 120)]
|
[p2ll(120, 150), p2ll(150, 180), p2ll(180, 120)]
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
layer = new L.S.Polygon(this.map, latlngs, {datalayer: this.datalayer}).addTo(this.datalayer);
|
layer = new L.U.Polygon(this.map, latlngs, {datalayer: this.datalayer}).addTo(this.datalayer);
|
||||||
happen.once(layer._path, {type: 'contextmenu'});
|
happen.once(layer._path, {type: 'contextmenu'});
|
||||||
assert.notOk(qst('Transform to lines'));
|
assert.notOk(qst('Transform to lines'));
|
||||||
});
|
});
|
||||||
|
@ -137,21 +137,21 @@ describe('L.Storage.Polygon', function () {
|
||||||
var latlngs = [
|
var latlngs = [
|
||||||
[[p2ll(100, 150), p2ll(150, 200), p2ll(200, 100)]]
|
[[p2ll(100, 150), p2ll(150, 200), p2ll(200, 100)]]
|
||||||
];
|
];
|
||||||
new L.S.Polygon(this.map, latlngs, {datalayer: this.datalayer}).addTo(this.datalayer);
|
new L.U.Polygon(this.map, latlngs, {datalayer: this.datalayer}).addTo(this.datalayer);
|
||||||
happen.at('contextmenu', 150, 150);
|
happen.at('contextmenu', 150, 150);
|
||||||
assert.equal(qst('Transform to lines'), 1);
|
assert.equal(qst('Transform to lines'), 1);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should not allow to transfer shape when not editedFeature', function () {
|
it('should not allow to transfer shape when not editedFeature', function () {
|
||||||
new L.S.Polygon(this.map, [p2ll(100, 150), p2ll(100, 200), p2ll(200, 150)], {datalayer: this.datalayer}).addTo(this.datalayer);
|
new L.U.Polygon(this.map, [p2ll(100, 150), p2ll(100, 200), p2ll(200, 150)], {datalayer: this.datalayer}).addTo(this.datalayer);
|
||||||
happen.at('contextmenu', 110, 160);
|
happen.at('contextmenu', 110, 160);
|
||||||
assert.equal(qst('Delete this feature'), 1); // Make sure we have right clicked on the polygon.
|
assert.equal(qst('Delete this feature'), 1); // Make sure we have right clicked on the polygon.
|
||||||
assert.notOk(qst('Transfer shape to edited feature'));
|
assert.notOk(qst('Transfer shape to edited feature'));
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should not allow to transfer shape when editedFeature is not a polygon', function () {
|
it('should not allow to transfer shape when editedFeature is not a polygon', function () {
|
||||||
var layer = new L.S.Polygon(this.map, [p2ll(100, 150), p2ll(100, 200), p2ll(200, 150)], {datalayer: this.datalayer}).addTo(this.datalayer),
|
var layer = new L.U.Polygon(this.map, [p2ll(100, 150), p2ll(100, 200), p2ll(200, 150)], {datalayer: this.datalayer}).addTo(this.datalayer),
|
||||||
other = new L.S.Polyline(this.map, [p2ll(200, 250), p2ll(200, 300)], {datalayer: this.datalayer}).addTo(this.datalayer);
|
other = new L.U.Polyline(this.map, [p2ll(200, 250), p2ll(200, 300)], {datalayer: this.datalayer}).addTo(this.datalayer);
|
||||||
other.edit();
|
other.edit();
|
||||||
happen.once(layer._path, {type: 'contextmenu'});
|
happen.once(layer._path, {type: 'contextmenu'});
|
||||||
assert.equal(qst('Delete this feature'), 1); // Make sure we have right clicked on the polygon.
|
assert.equal(qst('Delete this feature'), 1); // Make sure we have right clicked on the polygon.
|
||||||
|
@ -160,9 +160,9 @@ describe('L.Storage.Polygon', function () {
|
||||||
|
|
||||||
it('should allow to transfer shape when another polygon is edited', function (done) {
|
it('should allow to transfer shape when another polygon is edited', function (done) {
|
||||||
this.datalayer.empty();
|
this.datalayer.empty();
|
||||||
var layer = new L.S.Polygon(this.map, [p2ll(200, 300), p2ll(300, 200), p2ll(200, 100)], {datalayer: this.datalayer}).addTo(this.datalayer);
|
var layer = new L.U.Polygon(this.map, [p2ll(200, 300), p2ll(300, 200), p2ll(200, 100)], {datalayer: this.datalayer}).addTo(this.datalayer);
|
||||||
layer.edit(); // This moves the map to put "other" at the center.
|
layer.edit(); // This moves the map to put "other" at the center.
|
||||||
var other = new L.S.Polygon(this.map, [p2ll(100, 150), p2ll(100, 200), p2ll(200, 150)], {datalayer: this.datalayer}).addTo(this.datalayer);
|
var other = new L.U.Polygon(this.map, [p2ll(100, 150), p2ll(100, 200), p2ll(200, 150)], {datalayer: this.datalayer}).addTo(this.datalayer);
|
||||||
happen.once(other._path, {type: 'contextmenu'});
|
happen.once(other._path, {type: 'contextmenu'});
|
||||||
assert.equal(qst('Transfer shape to edited feature'), 1);
|
assert.equal(qst('Transfer shape to edited feature'), 1);
|
||||||
done();
|
done();
|
||||||
|
@ -179,13 +179,13 @@ describe('L.Storage.Polygon', function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('"add shape" control should be visible when editing a Polygon', function () {
|
it('"add shape" control should be visible when editing a Polygon', function () {
|
||||||
var layer = new L.S.Polygon(this.map, [p2ll(100, 100), p2ll(100, 200)], {datalayer: this.datalayer}).addTo(this.datalayer);
|
var layer = new L.U.Polygon(this.map, [p2ll(100, 100), p2ll(100, 200)], {datalayer: this.datalayer}).addTo(this.datalayer);
|
||||||
layer.edit();
|
layer.edit();
|
||||||
assert.ok(qs('.storage-draw-polygon-multi'));
|
assert.ok(qs('.storage-draw-polygon-multi'));
|
||||||
});
|
});
|
||||||
|
|
||||||
it('"add shape" control should extend the same multi', function () {
|
it('"add shape" control should extend the same multi', function () {
|
||||||
var layer = new L.S.Polygon(this.map, [p2ll(100, 150), p2ll(150, 200), p2ll(200, 100)], {datalayer: this.datalayer}).addTo(this.datalayer);
|
var layer = new L.U.Polygon(this.map, [p2ll(100, 150), p2ll(150, 200), p2ll(200, 100)], {datalayer: this.datalayer}).addTo(this.datalayer);
|
||||||
layer.edit();
|
layer.edit();
|
||||||
assert.notOk(layer.isMulti());
|
assert.notOk(layer.isMulti());
|
||||||
happen.click(qs('.storage-draw-polygon-multi'));
|
happen.click(qs('.storage-draw-polygon-multi'));
|
||||||
|
@ -204,8 +204,8 @@ describe('L.Storage.Polygon', function () {
|
||||||
|
|
||||||
it('should transfer simple polygon shape to another polygon', function () {
|
it('should transfer simple polygon shape to another polygon', function () {
|
||||||
var latlngs = [p2ll(100, 150), p2ll(100, 200), p2ll(200, 100)],
|
var latlngs = [p2ll(100, 150), p2ll(100, 200), p2ll(200, 100)],
|
||||||
layer = new L.S.Polygon(this.map, latlngs, {datalayer: this.datalayer}).addTo(this.datalayer),
|
layer = new L.U.Polygon(this.map, latlngs, {datalayer: this.datalayer}).addTo(this.datalayer),
|
||||||
other = new L.S.Polygon(this.map, [p2ll(200, 350), p2ll(200, 300), p2ll(300, 200)], {datalayer: this.datalayer}).addTo(this.datalayer);
|
other = new L.U.Polygon(this.map, [p2ll(200, 350), p2ll(200, 300), p2ll(300, 200)], {datalayer: this.datalayer}).addTo(this.datalayer);
|
||||||
assert.ok(this.map.hasLayer(layer));
|
assert.ok(this.map.hasLayer(layer));
|
||||||
layer.transferShape(p2ll(150, 150), other);
|
layer.transferShape(p2ll(150, 150), other);
|
||||||
assert.equal(other._latlngs.length, 2);
|
assert.equal(other._latlngs.length, 2);
|
||||||
|
@ -221,8 +221,8 @@ describe('L.Storage.Polygon', function () {
|
||||||
],
|
],
|
||||||
[[p2ll(200, 300), p2ll(300, 200)]]
|
[[p2ll(200, 300), p2ll(300, 200)]]
|
||||||
],
|
],
|
||||||
layer = new L.S.Polygon(this.map, latlngs, {datalayer: this.datalayer}).addTo(this.datalayer),
|
layer = new L.U.Polygon(this.map, latlngs, {datalayer: this.datalayer}).addTo(this.datalayer),
|
||||||
other = new L.S.Polygon(this.map, [p2ll(200, 350), p2ll(200, 300), p2ll(300, 200)], {datalayer: this.datalayer}).addTo(this.datalayer);
|
other = new L.U.Polygon(this.map, [p2ll(200, 350), p2ll(200, 300), p2ll(300, 200)], {datalayer: this.datalayer}).addTo(this.datalayer);
|
||||||
assert.ok(this.map.hasLayer(layer));
|
assert.ok(this.map.hasLayer(layer));
|
||||||
layer.transferShape(p2ll(150, 150), other);
|
layer.transferShape(p2ll(150, 150), other);
|
||||||
assert.equal(other._latlngs.length, 2);
|
assert.equal(other._latlngs.length, 2);
|
||||||
|
@ -237,7 +237,7 @@ describe('L.Storage.Polygon', function () {
|
||||||
|
|
||||||
it('should not allow to isolate simple polygon', function () {
|
it('should not allow to isolate simple polygon', function () {
|
||||||
var latlngs = [p2ll(100, 150), p2ll(100, 200), p2ll(200, 100)],
|
var latlngs = [p2ll(100, 150), p2ll(100, 200), p2ll(200, 100)],
|
||||||
layer = new L.S.Polygon(this.map, latlngs, {datalayer: this.datalayer}).addTo(this.datalayer);
|
layer = new L.U.Polygon(this.map, latlngs, {datalayer: this.datalayer}).addTo(this.datalayer);
|
||||||
assert.equal(this.datalayer._index.length, 1);
|
assert.equal(this.datalayer._index.length, 1);
|
||||||
assert.ok(this.map.hasLayer(layer));
|
assert.ok(this.map.hasLayer(layer));
|
||||||
layer.isolateShape(p2ll(150, 150));
|
layer.isolateShape(p2ll(150, 150));
|
||||||
|
@ -253,7 +253,7 @@ describe('L.Storage.Polygon', function () {
|
||||||
],
|
],
|
||||||
[[p2ll(200, 300), p2ll(300, 200)]]
|
[[p2ll(200, 300), p2ll(300, 200)]]
|
||||||
],
|
],
|
||||||
layer = new L.S.Polygon(this.map, latlngs, {datalayer: this.datalayer}).addTo(this.datalayer);
|
layer = new L.U.Polygon(this.map, latlngs, {datalayer: this.datalayer}).addTo(this.datalayer);
|
||||||
assert.equal(this.datalayer._index.length, 1);
|
assert.equal(this.datalayer._index.length, 1);
|
||||||
assert.ok(this.map.hasLayer(layer));
|
assert.ok(this.map.hasLayer(layer));
|
||||||
var other = layer.isolateShape(p2ll(150, 150));
|
var other = layer.isolateShape(p2ll(150, 150));
|
||||||
|
@ -272,7 +272,7 @@ describe('L.Storage.Polygon', function () {
|
||||||
|
|
||||||
it('should clone polygon', function () {
|
it('should clone polygon', function () {
|
||||||
var latlngs = [p2ll(100, 150), p2ll(100, 200), p2ll(200, 100)],
|
var latlngs = [p2ll(100, 150), p2ll(100, 200), p2ll(200, 100)],
|
||||||
layer = new L.S.Polygon(this.map, latlngs, {datalayer: this.datalayer}).addTo(this.datalayer);
|
layer = new L.U.Polygon(this.map, latlngs, {datalayer: this.datalayer}).addTo(this.datalayer);
|
||||||
assert.equal(this.datalayer._index.length, 1);
|
assert.equal(this.datalayer._index.length, 1);
|
||||||
other = layer.clone();
|
other = layer.clone();
|
||||||
assert.ok(this.map.hasLayer(other));
|
assert.ok(this.map.hasLayer(other));
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
describe('L.Storage.Polyline', function () {
|
describe('L.Utorage.Polyline', function () {
|
||||||
var p2ll, map;
|
var p2ll, map;
|
||||||
|
|
||||||
before(function () {
|
before(function () {
|
||||||
|
@ -23,12 +23,12 @@ describe('L.Storage.Polyline', function () {
|
||||||
describe('#isMulti()', function () {
|
describe('#isMulti()', function () {
|
||||||
|
|
||||||
it('should return false for basic Polyline', function () {
|
it('should return false for basic Polyline', function () {
|
||||||
var layer = new L.S.Polyline(this.map, [[1, 2], [3, 4], [5, 6]], {datalayer: this.datalayer});
|
var layer = new L.U.Polyline(this.map, [[1, 2], [3, 4], [5, 6]], {datalayer: this.datalayer});
|
||||||
assert.notOk(layer.isMulti())
|
assert.notOk(layer.isMulti())
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return false for nested basic Polyline', function () {
|
it('should return false for nested basic Polyline', function () {
|
||||||
var layer = new L.S.Polyline(this.map, [[[1, 2], [3, 4], [5, 6]]], {datalayer: this.datalayer});
|
var layer = new L.U.Polyline(this.map, [[[1, 2], [3, 4], [5, 6]]], {datalayer: this.datalayer});
|
||||||
assert.notOk(layer.isMulti())
|
assert.notOk(layer.isMulti())
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ describe('L.Storage.Polyline', function () {
|
||||||
[[7, 8], [9, 10], [11, 12]]
|
[[7, 8], [9, 10], [11, 12]]
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
var layer = new L.S.Polyline(this.map, latLngs, {datalayer: this.datalayer});
|
var layer = new L.U.Polyline(this.map, latLngs, {datalayer: this.datalayer});
|
||||||
assert.ok(layer.isMulti())
|
assert.ok(layer.isMulti())
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ describe('L.Storage.Polyline', function () {
|
||||||
[p2ll(100, 100), p2ll(100, 200)],
|
[p2ll(100, 100), p2ll(100, 200)],
|
||||||
[p2ll(300, 350), p2ll(350, 400), p2ll(400, 300)]
|
[p2ll(300, 350), p2ll(350, 400), p2ll(400, 300)]
|
||||||
],
|
],
|
||||||
layer = new L.S.Polyline(this.map, latlngs, {datalayer: this.datalayer}).addTo(this.datalayer);
|
layer = new L.U.Polyline(this.map, latlngs, {datalayer: this.datalayer}).addTo(this.datalayer);
|
||||||
happen.once(layer._path, {type: 'contextmenu'})
|
happen.once(layer._path, {type: 'contextmenu'})
|
||||||
assert.equal(qst('Remove shape from the multi'), 1);
|
assert.equal(qst('Remove shape from the multi'), 1);
|
||||||
});
|
});
|
||||||
|
@ -70,7 +70,7 @@ describe('L.Storage.Polyline', function () {
|
||||||
var latlngs = [
|
var latlngs = [
|
||||||
[p2ll(100, 100), p2ll(100, 200)]
|
[p2ll(100, 100), p2ll(100, 200)]
|
||||||
],
|
],
|
||||||
layer = new L.S.Polyline(this.map, latlngs, {datalayer: this.datalayer}).addTo(this.datalayer);
|
layer = new L.U.Polyline(this.map, latlngs, {datalayer: this.datalayer}).addTo(this.datalayer);
|
||||||
happen.once(layer._path, {type: 'contextmenu'})
|
happen.once(layer._path, {type: 'contextmenu'})
|
||||||
assert.notOk(qst('Remove shape from the multi'));
|
assert.notOk(qst('Remove shape from the multi'));
|
||||||
});
|
});
|
||||||
|
@ -79,7 +79,7 @@ describe('L.Storage.Polyline', function () {
|
||||||
var latlngs = [
|
var latlngs = [
|
||||||
[p2ll(100, 100), p2ll(100, 200)]
|
[p2ll(100, 100), p2ll(100, 200)]
|
||||||
],
|
],
|
||||||
layer = new L.S.Polyline(this.map, latlngs, {datalayer: this.datalayer}).addTo(this.datalayer);
|
layer = new L.U.Polyline(this.map, latlngs, {datalayer: this.datalayer}).addTo(this.datalayer);
|
||||||
happen.once(layer._path, {type: 'contextmenu'})
|
happen.once(layer._path, {type: 'contextmenu'})
|
||||||
assert.notOk(qst('Extract shape to separate feature'));
|
assert.notOk(qst('Extract shape to separate feature'));
|
||||||
});
|
});
|
||||||
|
@ -89,7 +89,7 @@ describe('L.Storage.Polyline', function () {
|
||||||
[p2ll(100, 150), p2ll(100, 200)],
|
[p2ll(100, 150), p2ll(100, 200)],
|
||||||
[p2ll(300, 350), p2ll(350, 400), p2ll(400, 300)]
|
[p2ll(300, 350), p2ll(350, 400), p2ll(400, 300)]
|
||||||
],
|
],
|
||||||
layer = new L.S.Polyline(this.map, latlngs, {datalayer: this.datalayer}).addTo(this.datalayer);
|
layer = new L.U.Polyline(this.map, latlngs, {datalayer: this.datalayer}).addTo(this.datalayer);
|
||||||
happen.once(layer._path, {type: 'contextmenu'});
|
happen.once(layer._path, {type: 'contextmenu'});
|
||||||
assert.ok(qst('Extract shape to separate feature'));
|
assert.ok(qst('Extract shape to separate feature'));
|
||||||
});
|
});
|
||||||
|
@ -99,35 +99,35 @@ describe('L.Storage.Polyline', function () {
|
||||||
[p2ll(100, 150), p2ll(100, 200)],
|
[p2ll(100, 150), p2ll(100, 200)],
|
||||||
[p2ll(300, 350), p2ll(350, 400), p2ll(400, 300)]
|
[p2ll(300, 350), p2ll(350, 400), p2ll(400, 300)]
|
||||||
],
|
],
|
||||||
layer = new L.S.Polyline(this.map, latlngs, {datalayer: this.datalayer}).addTo(this.datalayer);
|
layer = new L.U.Polyline(this.map, latlngs, {datalayer: this.datalayer}).addTo(this.datalayer);
|
||||||
happen.once(layer._path, {type: 'contextmenu'});
|
happen.once(layer._path, {type: 'contextmenu'});
|
||||||
assert.notOk(qst('Transform to polygon'));
|
assert.notOk(qst('Transform to polygon'));
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should allow to transform to polygon when not multi', function () {
|
it('should allow to transform to polygon when not multi', function () {
|
||||||
var latlngs = [p2ll(100, 150), p2ll(100, 200), p2ll(200, 100)],
|
var latlngs = [p2ll(100, 150), p2ll(100, 200), p2ll(200, 100)],
|
||||||
layer = new L.S.Polyline(this.map, latlngs, {datalayer: this.datalayer}).addTo(this.datalayer);
|
layer = new L.U.Polyline(this.map, latlngs, {datalayer: this.datalayer}).addTo(this.datalayer);
|
||||||
happen.once(layer._path, {type: 'contextmenu'});
|
happen.once(layer._path, {type: 'contextmenu'});
|
||||||
assert.equal(qst('Transform to polygon'), 1);
|
assert.equal(qst('Transform to polygon'), 1);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should not allow to transfer shape when not editedFeature', function () {
|
it('should not allow to transfer shape when not editedFeature', function () {
|
||||||
var layer = new L.S.Polyline(this.map, [p2ll(100, 150), p2ll(100, 200)], {datalayer: this.datalayer}).addTo(this.datalayer);
|
var layer = new L.U.Polyline(this.map, [p2ll(100, 150), p2ll(100, 200)], {datalayer: this.datalayer}).addTo(this.datalayer);
|
||||||
happen.once(layer._path, {type: 'contextmenu'});
|
happen.once(layer._path, {type: 'contextmenu'});
|
||||||
assert.notOk(qst('Transfer shape to edited feature'));
|
assert.notOk(qst('Transfer shape to edited feature'));
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should not allow to transfer shape when editedFeature is not a line', function () {
|
it('should not allow to transfer shape when editedFeature is not a line', function () {
|
||||||
var layer = new L.S.Polyline(this.map, [p2ll(100, 150), p2ll(100, 200)], {datalayer: this.datalayer}).addTo(this.datalayer),
|
var layer = new L.U.Polyline(this.map, [p2ll(100, 150), p2ll(100, 200)], {datalayer: this.datalayer}).addTo(this.datalayer),
|
||||||
other = new L.S.Polygon(this.map, [p2ll(200, 300), p2ll(300, 200), p2ll(200, 100)], {datalayer: this.datalayer}).addTo(this.datalayer);
|
other = new L.U.Polygon(this.map, [p2ll(200, 300), p2ll(300, 200), p2ll(200, 100)], {datalayer: this.datalayer}).addTo(this.datalayer);
|
||||||
other.edit();
|
other.edit();
|
||||||
happen.once(layer._path, {type: 'contextmenu'});
|
happen.once(layer._path, {type: 'contextmenu'});
|
||||||
assert.notOk(qst('Transfer shape to edited feature'));
|
assert.notOk(qst('Transfer shape to edited feature'));
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should allow to transfer shape when another line is edited', function () {
|
it('should allow to transfer shape when another line is edited', function () {
|
||||||
var layer = new L.S.Polyline(this.map, [p2ll(100, 150), p2ll(100, 200), p2ll(200, 100)], {datalayer: this.datalayer}).addTo(this.datalayer),
|
var layer = new L.U.Polyline(this.map, [p2ll(100, 150), p2ll(100, 200), p2ll(200, 100)], {datalayer: this.datalayer}).addTo(this.datalayer),
|
||||||
other = new L.S.Polyline(this.map, [p2ll(200, 300), p2ll(300, 200)], {datalayer: this.datalayer}).addTo(this.datalayer);
|
other = new L.U.Polyline(this.map, [p2ll(200, 300), p2ll(300, 200)], {datalayer: this.datalayer}).addTo(this.datalayer);
|
||||||
other.edit();
|
other.edit();
|
||||||
happen.once(layer._path, {type: 'contextmenu'});
|
happen.once(layer._path, {type: 'contextmenu'});
|
||||||
assert.equal(qst('Transfer shape to edited feature'), 1);
|
assert.equal(qst('Transfer shape to edited feature'), 1);
|
||||||
|
@ -138,7 +138,7 @@ describe('L.Storage.Polyline', function () {
|
||||||
[p2ll(100, 100), p2ll(100, 200)],
|
[p2ll(100, 100), p2ll(100, 200)],
|
||||||
[p2ll(300, 350), p2ll(350, 400), p2ll(400, 300)]
|
[p2ll(300, 350), p2ll(350, 400), p2ll(400, 300)]
|
||||||
],
|
],
|
||||||
layer = new L.S.Polyline(this.map, latlngs, {datalayer: this.datalayer}).addTo(this.datalayer);
|
layer = new L.U.Polyline(this.map, latlngs, {datalayer: this.datalayer}).addTo(this.datalayer);
|
||||||
happen.once(layer._path, {type: 'contextmenu'})
|
happen.once(layer._path, {type: 'contextmenu'})
|
||||||
assert.equal(qst('Merge lines'), 1);
|
assert.equal(qst('Merge lines'), 1);
|
||||||
});
|
});
|
||||||
|
@ -147,7 +147,7 @@ describe('L.Storage.Polyline', function () {
|
||||||
var latlngs = [
|
var latlngs = [
|
||||||
[p2ll(100, 100), p2ll(100, 200)]
|
[p2ll(100, 100), p2ll(100, 200)]
|
||||||
],
|
],
|
||||||
layer = new L.S.Polyline(this.map, latlngs, {datalayer: this.datalayer}).addTo(this.datalayer);
|
layer = new L.U.Polyline(this.map, latlngs, {datalayer: this.datalayer}).addTo(this.datalayer);
|
||||||
happen.once(layer._path, {type: 'contextmenu'})
|
happen.once(layer._path, {type: 'contextmenu'})
|
||||||
assert.notOk(qst('Merge lines'));
|
assert.notOk(qst('Merge lines'));
|
||||||
});
|
});
|
||||||
|
@ -156,7 +156,7 @@ describe('L.Storage.Polyline', function () {
|
||||||
var latlngs = [
|
var latlngs = [
|
||||||
[p2ll(300, 350), p2ll(350, 400), p2ll(400, 300)]
|
[p2ll(300, 350), p2ll(350, 400), p2ll(400, 300)]
|
||||||
],
|
],
|
||||||
layer = new L.S.Polyline(this.map, latlngs, {datalayer: this.datalayer}).addTo(this.datalayer);
|
layer = new L.U.Polyline(this.map, latlngs, {datalayer: this.datalayer}).addTo(this.datalayer);
|
||||||
layer.enableEdit();
|
layer.enableEdit();
|
||||||
happen.at('contextmenu', 350, 400);
|
happen.at('contextmenu', 350, 400);
|
||||||
assert.equal(qst('Split line'), 1);
|
assert.equal(qst('Split line'), 1);
|
||||||
|
@ -166,7 +166,7 @@ describe('L.Storage.Polyline', function () {
|
||||||
var latlngs = [
|
var latlngs = [
|
||||||
[p2ll(300, 350), p2ll(350, 400), p2ll(400, 300)]
|
[p2ll(300, 350), p2ll(350, 400), p2ll(400, 300)]
|
||||||
],
|
],
|
||||||
layer = new L.S.Polyline(this.map, latlngs, {datalayer: this.datalayer}).addTo(this.datalayer);
|
layer = new L.U.Polyline(this.map, latlngs, {datalayer: this.datalayer}).addTo(this.datalayer);
|
||||||
layer.enableEdit();
|
layer.enableEdit();
|
||||||
happen.at('contextmenu', 300, 350);
|
happen.at('contextmenu', 300, 350);
|
||||||
assert.equal(qst('Delete this feature'), 1); // Make sure we have clicked on the vertex.
|
assert.equal(qst('Delete this feature'), 1); // Make sure we have clicked on the vertex.
|
||||||
|
@ -177,7 +177,7 @@ describe('L.Storage.Polyline', function () {
|
||||||
var latlngs = [
|
var latlngs = [
|
||||||
[p2ll(300, 350), p2ll(350, 400), p2ll(400, 300)]
|
[p2ll(300, 350), p2ll(350, 400), p2ll(400, 300)]
|
||||||
],
|
],
|
||||||
layer = new L.S.Polyline(this.map, latlngs, {datalayer: this.datalayer}).addTo(this.datalayer);
|
layer = new L.U.Polyline(this.map, latlngs, {datalayer: this.datalayer}).addTo(this.datalayer);
|
||||||
layer.enableEdit();
|
layer.enableEdit();
|
||||||
happen.at('contextmenu', 400, 300);
|
happen.at('contextmenu', 400, 300);
|
||||||
assert.equal(qst('Delete this feature'), 1); // Make sure we have clicked on the vertex.
|
assert.equal(qst('Delete this feature'), 1); // Make sure we have clicked on the vertex.
|
||||||
|
@ -195,13 +195,13 @@ describe('L.Storage.Polyline', function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('"add shape" control should be visible when editing a Polyline', function () {
|
it('"add shape" control should be visible when editing a Polyline', function () {
|
||||||
var layer = new L.S.Polyline(this.map, [p2ll(100, 100), p2ll(100, 200)], {datalayer: this.datalayer}).addTo(this.datalayer);
|
var layer = new L.U.Polyline(this.map, [p2ll(100, 100), p2ll(100, 200)], {datalayer: this.datalayer}).addTo(this.datalayer);
|
||||||
layer.edit();
|
layer.edit();
|
||||||
assert.ok(qs('.storage-draw-polyline-multi'));
|
assert.ok(qs('.storage-draw-polyline-multi'));
|
||||||
});
|
});
|
||||||
|
|
||||||
it('"add shape" control should extend the same multi', function () {
|
it('"add shape" control should extend the same multi', function () {
|
||||||
var layer = new L.S.Polyline(this.map, [p2ll(100, 100), p2ll(100, 200)], {datalayer: this.datalayer}).addTo(this.datalayer);
|
var layer = new L.U.Polyline(this.map, [p2ll(100, 100), p2ll(100, 200)], {datalayer: this.datalayer}).addTo(this.datalayer);
|
||||||
layer.edit();
|
layer.edit();
|
||||||
assert.notOk(layer.isMulti());
|
assert.notOk(layer.isMulti());
|
||||||
happen.click(qs('.storage-draw-polyline-multi'));
|
happen.click(qs('.storage-draw-polyline-multi'));
|
||||||
|
@ -220,8 +220,8 @@ describe('L.Storage.Polyline', function () {
|
||||||
|
|
||||||
it('should transfer simple line shape to another line', function () {
|
it('should transfer simple line shape to another line', function () {
|
||||||
var latlngs = [p2ll(100, 150), p2ll(100, 200), p2ll(200, 100)],
|
var latlngs = [p2ll(100, 150), p2ll(100, 200), p2ll(200, 100)],
|
||||||
layer = new L.S.Polyline(this.map, latlngs, {datalayer: this.datalayer}).addTo(this.datalayer),
|
layer = new L.U.Polyline(this.map, latlngs, {datalayer: this.datalayer}).addTo(this.datalayer),
|
||||||
other = new L.S.Polyline(this.map, [p2ll(200, 300), p2ll(300, 200)], {datalayer: this.datalayer}).addTo(this.datalayer);
|
other = new L.U.Polyline(this.map, [p2ll(200, 300), p2ll(300, 200)], {datalayer: this.datalayer}).addTo(this.datalayer);
|
||||||
assert.ok(this.map.hasLayer(layer));
|
assert.ok(this.map.hasLayer(layer));
|
||||||
layer.transferShape(p2ll(150, 150), other);
|
layer.transferShape(p2ll(150, 150), other);
|
||||||
assert.equal(other._latlngs.length, 2);
|
assert.equal(other._latlngs.length, 2);
|
||||||
|
@ -234,8 +234,8 @@ describe('L.Storage.Polyline', function () {
|
||||||
[p2ll(100, 150), p2ll(100, 200), p2ll(200, 100)],
|
[p2ll(100, 150), p2ll(100, 200), p2ll(200, 100)],
|
||||||
[p2ll(200, 300), p2ll(300, 200)]
|
[p2ll(200, 300), p2ll(300, 200)]
|
||||||
],
|
],
|
||||||
layer = new L.S.Polyline(this.map, latlngs, {datalayer: this.datalayer}).addTo(this.datalayer),
|
layer = new L.U.Polyline(this.map, latlngs, {datalayer: this.datalayer}).addTo(this.datalayer),
|
||||||
other = new L.S.Polyline(this.map, [p2ll(250, 300), p2ll(350, 200)], {datalayer: this.datalayer}).addTo(this.datalayer);
|
other = new L.U.Polyline(this.map, [p2ll(250, 300), p2ll(350, 200)], {datalayer: this.datalayer}).addTo(this.datalayer);
|
||||||
assert.ok(this.map.hasLayer(layer));
|
assert.ok(this.map.hasLayer(layer));
|
||||||
layer.transferShape(p2ll(150, 150), other);
|
layer.transferShape(p2ll(150, 150), other);
|
||||||
assert.equal(other._latlngs.length, 2);
|
assert.equal(other._latlngs.length, 2);
|
||||||
|
@ -253,7 +253,7 @@ describe('L.Storage.Polyline', function () {
|
||||||
[[0, 0], [0, 1]],
|
[[0, 0], [0, 1]],
|
||||||
[[0, 1], [0, 2]],
|
[[0, 1], [0, 2]],
|
||||||
],
|
],
|
||||||
layer = new L.S.Polyline(this.map, latlngs, {datalayer: this.datalayer}).addTo(this.datalayer);
|
layer = new L.U.Polyline(this.map, latlngs, {datalayer: this.datalayer}).addTo(this.datalayer);
|
||||||
layer.mergeShapes();
|
layer.mergeShapes();
|
||||||
layer.disableEdit(); // Remove vertex from latlngs to compare them.
|
layer.disableEdit(); // Remove vertex from latlngs to compare them.
|
||||||
assert.deepEqual(layer.getLatLngs(), [L.latLng([0, 0]), L.latLng([0, 1]), L.latLng([0, 2])]);
|
assert.deepEqual(layer.getLatLngs(), [L.latLng([0, 0]), L.latLng([0, 1]), L.latLng([0, 2])]);
|
||||||
|
@ -265,7 +265,7 @@ describe('L.Storage.Polyline', function () {
|
||||||
[[0, 0], [0, 1]],
|
[[0, 0], [0, 1]],
|
||||||
[[0, 2], [0, 1]],
|
[[0, 2], [0, 1]],
|
||||||
],
|
],
|
||||||
layer = new L.S.Polyline(this.map, latlngs, {datalayer: this.datalayer}).addTo(this.datalayer);
|
layer = new L.U.Polyline(this.map, latlngs, {datalayer: this.datalayer}).addTo(this.datalayer);
|
||||||
layer.mergeShapes();
|
layer.mergeShapes();
|
||||||
layer.disableEdit();
|
layer.disableEdit();
|
||||||
assert.deepEqual(layer.getLatLngs(), [L.latLng([0, 0]), L.latLng([0, 1]), L.latLng([0, 2])]);
|
assert.deepEqual(layer.getLatLngs(), [L.latLng([0, 0]), L.latLng([0, 1]), L.latLng([0, 2])]);
|
||||||
|
@ -278,7 +278,7 @@ describe('L.Storage.Polyline', function () {
|
||||||
|
|
||||||
it('should not allow to isolate simple line', function () {
|
it('should not allow to isolate simple line', function () {
|
||||||
var latlngs = [p2ll(100, 150), p2ll(100, 200), p2ll(200, 100)],
|
var latlngs = [p2ll(100, 150), p2ll(100, 200), p2ll(200, 100)],
|
||||||
layer = new L.S.Polyline(this.map, latlngs, {datalayer: this.datalayer}).addTo(this.datalayer);
|
layer = new L.U.Polyline(this.map, latlngs, {datalayer: this.datalayer}).addTo(this.datalayer);
|
||||||
assert.equal(this.datalayer._index.length, 1);
|
assert.equal(this.datalayer._index.length, 1);
|
||||||
assert.ok(this.map.hasLayer(layer));
|
assert.ok(this.map.hasLayer(layer));
|
||||||
layer.isolateShape(p2ll(150, 150));
|
layer.isolateShape(p2ll(150, 150));
|
||||||
|
@ -291,7 +291,7 @@ describe('L.Storage.Polyline', function () {
|
||||||
[p2ll(100, 150), p2ll(100, 200), p2ll(200, 100)],
|
[p2ll(100, 150), p2ll(100, 200), p2ll(200, 100)],
|
||||||
[[p2ll(200, 300), p2ll(300, 200)]]
|
[[p2ll(200, 300), p2ll(300, 200)]]
|
||||||
],
|
],
|
||||||
layer = new L.S.Polyline(this.map, latlngs, {datalayer: this.datalayer}).addTo(this.datalayer);
|
layer = new L.U.Polyline(this.map, latlngs, {datalayer: this.datalayer}).addTo(this.datalayer);
|
||||||
assert.equal(this.datalayer._index.length, 1);
|
assert.equal(this.datalayer._index.length, 1);
|
||||||
assert.ok(this.map.hasLayer(layer));
|
assert.ok(this.map.hasLayer(layer));
|
||||||
var other = layer.isolateShape(p2ll(150, 150));
|
var other = layer.isolateShape(p2ll(150, 150));
|
||||||
|
@ -310,7 +310,7 @@ describe('L.Storage.Polyline', function () {
|
||||||
|
|
||||||
it('should clone polyline', function () {
|
it('should clone polyline', function () {
|
||||||
var latlngs = [p2ll(100, 150), p2ll(100, 200), p2ll(200, 100)],
|
var latlngs = [p2ll(100, 150), p2ll(100, 200), p2ll(200, 100)],
|
||||||
layer = new L.S.Polyline(this.map, latlngs, {datalayer: this.datalayer}).addTo(this.datalayer);
|
layer = new L.U.Polyline(this.map, latlngs, {datalayer: this.datalayer}).addTo(this.datalayer);
|
||||||
assert.equal(this.datalayer._index.length, 1);
|
assert.equal(this.datalayer._index.length, 1);
|
||||||
other = layer.clone();
|
other = layer.clone();
|
||||||
assert.ok(this.map.hasLayer(other));
|
assert.ok(this.map.hasLayer(other));
|
||||||
|
|
|
@ -30,7 +30,6 @@ var disableEdit = function () {
|
||||||
happen.click(qs('a.leaflet-control-edit-disable'));
|
happen.click(qs('a.leaflet-control-edit-disable'));
|
||||||
};
|
};
|
||||||
var clickSave = function () {
|
var clickSave = function () {
|
||||||
console.log(qs('a.leaflet-control-edit-save').classList)
|
|
||||||
happen.click(qs('a.leaflet-control-edit-save'));
|
happen.click(qs('a.leaflet-control-edit-save'));
|
||||||
};
|
};
|
||||||
var clickCancel = function () {
|
var clickCancel = function () {
|
||||||
|
@ -178,7 +177,7 @@ function initMap (options) {
|
||||||
};
|
};
|
||||||
default_options.properties.datalayers.push(defaultDatalayerData());
|
default_options.properties.datalayers.push(defaultDatalayerData());
|
||||||
options.properties = L.extend({}, default_options.properties, options);
|
options.properties = L.extend({}, default_options.properties, options);
|
||||||
return new L.Storage.Map("map", options);
|
return new L.U.Map("map", options);
|
||||||
}
|
}
|
||||||
|
|
||||||
var RESPONSES = {
|
var RESPONSES = {
|
||||||
|
|
|
@ -1,54 +1,54 @@
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>Leaflet.Storage Tests</title>
|
<title>Umap front Tests</title>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<script src="../reqs/leaflet/leaflet-src.js"></script>
|
<script src="../vendors/leaflet/leaflet-src.js"></script>
|
||||||
<script src="../reqs/editable/Path.Drag.js"></script>
|
<script src="../vendors/editable/Path.Drag.js"></script>
|
||||||
<script src="../reqs/editable/Leaflet.Editable.js"></script>
|
<script src="../vendors/editable/Leaflet.Editable.js"></script>
|
||||||
<script src="../reqs/hash/leaflet-hash.js"></script>
|
<script src="../vendors/hash/leaflet-hash.js"></script>
|
||||||
<script src="../reqs/i18n/Leaflet.i18n.js"></script>
|
<script src="../vendors/i18n/Leaflet.i18n.js"></script>
|
||||||
<script src="../reqs/editinosm/Leaflet.EditInOSM.js"></script>
|
<script src="../vendors/editinosm/Leaflet.EditInOSM.js"></script>
|
||||||
<script src="../reqs/minimap/Control.MiniMap.js"></script>
|
<script src="../vendors/minimap/Control.MiniMap.js"></script>
|
||||||
<script src="../reqs/csv2geojson/csv2geojson.js"></script>
|
<script src="../vendors/csv2geojson/csv2geojson.js"></script>
|
||||||
<script src="../reqs/togeojson/togeojson.js"></script>
|
<script src="../vendors/togeojson/togeojson.js"></script>
|
||||||
<script src="../reqs/osmtogeojson/osmtogeojson.js"></script>
|
<script src="../vendors/osmtogeojson/osmtogeojson.js"></script>
|
||||||
<script src="../reqs/contextmenu/leaflet.contextmenu.js"></script>
|
<script src="../vendors/contextmenu/leaflet.contextmenu.js"></script>
|
||||||
<script src="../reqs/loading/Control.Loading.js"></script>
|
<script src="../vendors/loading/Control.Loading.js"></script>
|
||||||
<script src="../reqs/markercluster/leaflet.markercluster-src.js"></script>
|
<script src="../vendors/markercluster/leaflet.markercluster-src.js"></script>
|
||||||
<script src="../reqs/photon/leaflet.photon.js"></script>
|
<script src="../vendors/photon/leaflet.photon.js"></script>
|
||||||
<script src="../reqs/heat/leaflet-heat.js"></script>
|
<script src="../vendors/heat/leaflet-heat.js"></script>
|
||||||
<script src="../reqs/fullscreen/Leaflet.fullscreen.js"></script>
|
<script src="../vendors/fullscreen/Leaflet.fullscreen.js"></script>
|
||||||
<script src="../reqs/toolbar/leaflet.toolbar-src.js"></script>
|
<script src="../vendors/toolbar/leaflet.toolbar-src.js"></script>
|
||||||
<script src="../reqs/formbuilder/Leaflet.FormBuilder.js"></script>
|
<script src="../vendors/formbuilder/Leaflet.FormBuilder.js"></script>
|
||||||
<script src="../reqs/measurable/Leaflet.Measurable.js"></script>
|
<script src="../vendors/measurable/Leaflet.Measurable.js"></script>
|
||||||
<script src="../src/js/leaflet.storage.core.js"></script>
|
<script src="../js/umap.core.js"></script>
|
||||||
<script src="../src/js/leaflet.storage.popup.js"></script>
|
<script src="../js/umap.popup.js"></script>
|
||||||
<script src="../src/js/leaflet.storage.xhr.js"></script>
|
<script src="../js/umap.xhr.js"></script>
|
||||||
<script src="../src/js/leaflet.storage.forms.js"></script>
|
<script src="../js/umap.forms.js"></script>
|
||||||
<script src="../src/js/leaflet.storage.icon.js"></script>
|
<script src="../js/umap.icon.js"></script>
|
||||||
<script src="../src/js/leaflet.storage.features.js"></script>
|
<script src="../js/umap.features.js"></script>
|
||||||
<script src="../src/js/leaflet.storage.layer.js"></script>
|
<script src="../js/umap.layer.js"></script>
|
||||||
<script src="../src/js/leaflet.storage.controls.js"></script>
|
<script src="../js/umap.controls.js"></script>
|
||||||
<script src="../src/js/leaflet.storage.slideshow.js"></script>
|
<script src="../js/umap.slideshow.js"></script>
|
||||||
<script src="../src/js/leaflet.storage.tableeditor.js"></script>
|
<script src="../js/umap.tableeditor.js"></script>
|
||||||
<script src="../src/js/leaflet.storage.js"></script>
|
<script src="../js/umap.js"></script>
|
||||||
<script src="../contrib/js/storage.ui.default.js"></script>
|
<script src="../js/umap.ui.js"></script>
|
||||||
<link rel="stylesheet" href="../reqs/leaflet/leaflet.css" />
|
<link rel="stylesheet" href="../vendors/leaflet/leaflet.css" />
|
||||||
<link rel="stylesheet" href="../reqs/minimap/Control.MiniMap.css" />
|
<link rel="stylesheet" href="../vendors/minimap/Control.MiniMap.css" />
|
||||||
<link rel="stylesheet" href="../reqs/editinosm/Leaflet.EditInOSM.css" />
|
<link rel="stylesheet" href="../vendors/editinosm/Leaflet.EditInOSM.css" />
|
||||||
<link rel="stylesheet" href="../reqs/markercluster/MarkerCluster.css" />
|
<link rel="stylesheet" href="../vendors/markercluster/MarkerCluster.css" />
|
||||||
<link rel="stylesheet" href="../reqs/markercluster/MarkerCluster.Default.css" />
|
<link rel="stylesheet" href="../vendors/markercluster/MarkerCluster.Default.css" />
|
||||||
<link rel="stylesheet" href="../reqs/contextmenu/leaflet.contextmenu.css" />
|
<link rel="stylesheet" href="../vendors/contextmenu/leaflet.contextmenu.css" />
|
||||||
<link rel="stylesheet" href="../reqs/toolbar/leaflet.toolbar.css" />
|
<link rel="stylesheet" href="../vendors/toolbar/leaflet.toolbar.css" />
|
||||||
<link rel="stylesheet" href="../reqs/measurable/Leaflet.Measurable.css" />
|
<link rel="stylesheet" href="../vendors/measurable/Leaflet.Measurable.css" />
|
||||||
<link rel="stylesheet" href="../src/css/storage.css" />
|
<link rel="stylesheet" href="../storage.css" />
|
||||||
<link rel="stylesheet" href="../contrib/css/storage.ui.default.css" />
|
<link rel="stylesheet" href="../default.css" />
|
||||||
|
|
||||||
<script src="../node_modules/sinon/pkg/sinon.js"></script>
|
<script src="../../../../node_modules/sinon/pkg/sinon.js"></script>
|
||||||
<script src="../node_modules/mocha/mocha.js"></script>
|
<script src="../../../../node_modules/mocha/mocha.js"></script>
|
||||||
<script src="../node_modules/chai/chai.js"></script>
|
<script src="../../../../node_modules/chai/chai.js"></script>
|
||||||
<script src="../node_modules/happen/happen.js"></script>
|
<script src="../../../../node_modules/happen/happen.js"></script>
|
||||||
<link rel="stylesheet" href="../node_modules/mocha/mocha.css" />
|
<link rel="stylesheet" href="../../../../node_modules/mocha/mocha.css" />
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
mocha.setup({
|
mocha.setup({
|
||||||
ui: 'bdd',
|
ui: 'bdd',
|
||||||
|
|
Loading…
Reference in a new issue