From 5b151296e229156dbb39076a194b9a33297a3053 Mon Sep 17 00:00:00 2001 From: Yohan Boniface Date: Mon, 26 Jun 2023 09:40:11 +0200 Subject: [PATCH] Move browser tests to Controls.js with others --- umap/static/umap/test/Controls.js | 27 +++++++++++++++++++++++++++ umap/static/umap/test/DataLayer.js | 29 ----------------------------- 2 files changed, 27 insertions(+), 29 deletions(-) diff --git a/umap/static/umap/test/Controls.js b/umap/static/umap/test/Controls.js index d6014232..5541376b 100644 --- a/umap/static/umap/test/Controls.js +++ b/umap/static/umap/test/Controls.js @@ -15,6 +15,19 @@ describe('L.U.Controls', function () { }) describe('#databrowser()', function () { + let poly, marker, line + before(function () { + this.datalayer.eachLayer(function (layer) { + if (!poly && layer instanceof L.Polygon) { + poly = layer + } else if (!line && layer instanceof L.Polyline) { + line = layer + } else if (!marker && layer instanceof L.Marker) { + marker = layer + } + }) + }) + it('should be opened at datalayer button click', function () { var button = qs('.umap-browse-actions .umap-browse-link') assert.ok(button) @@ -30,6 +43,19 @@ describe('L.U.Controls', function () { assert.equal(qsa('#browse_data_datalayer_62 ul li').length, 3) }) + it('should sort feature in natural order', function () { + poly.properties.name = '9. a poly' + marker.properties.name = '1. a marker' + line.properties.name = '100. a line' + this.datalayer.reindex() + this.map.openBrowser() + const els = qsa('.umap-browse-features li') + assert.equal(els.length, 3) + assert.equal(els[0].textContent, '1. a marker') + assert.equal(els[1].textContent, '9. a poly') + assert.equal(els[2].textContent, '100. a line') + }) + it("should redraw datalayer's features list at feature delete", function () { var oldConfirm = window.confirm window.confirm = function () { @@ -47,6 +73,7 @@ describe('L.U.Controls', function () { happen.click(qs('.umap-browse-actions .umap-browse-link')) assert.equal(qsa('#browse_data_datalayer_62 ul li').length, 3) }) + }) describe('#exportPanel()', function () { diff --git a/umap/static/umap/test/DataLayer.js b/umap/static/umap/test/DataLayer.js index e2b81770..75d32b16 100644 --- a/umap/static/umap/test/DataLayer.js +++ b/umap/static/umap/test/DataLayer.js @@ -432,33 +432,4 @@ describe('L.U.DataLayer', function () { }) }) - describe("#openBrower()", function() { - let poly, marker, line - before(function () { - this.datalayer.eachLayer(function (layer) { - if (!poly && layer instanceof L.Polygon) { - poly = layer - } else if (!line && layer instanceof L.Polyline) { - line = layer - } else if (!marker && layer instanceof L.Marker) { - marker = layer - } - }) - }) - - it('should sort feature in natural order', function () { - poly.properties.name = '9. a poly' - marker.properties.name = '1. a marker' - line.properties.name = '100. a line' - this.datalayer.reindex() - this.map.openBrowser() - const els = qsa('.umap-browse-features li') - assert.equal(els.length, 3) - assert.equal(els[0].textContent, '1. a marker') - assert.equal(els[1].textContent, '9. a poly') - assert.equal(els[2].textContent, '100. a line') - }) - - }) - })