diff --git a/umap/static/umap/test/Map.js b/umap/static/umap/test/Map.js index c6a9eb15..9bcc7cfb 100644 --- a/umap/static/umap/test/Map.js +++ b/umap/static/umap/test/Map.js @@ -105,7 +105,7 @@ describe('L.U.Map', function () { window.confirm = oldConfirm }) - it('should ask for confirmation on delete link click', function (done) { + it('should ask for confirmation on delete link click', function () { var button = qs('a.update-map-settings') assert.ok(button, 'update map info button exists') happen.click(button) @@ -117,7 +117,7 @@ describe('L.U.Map', function () { this.server.respond() assert(window.confirm.calledOnce) window.confirm.restore() - done() + }) }) diff --git a/umap/static/umap/test/Permissions.js b/umap/static/umap/test/Permissions.js index 5f4364ac..4fb2ae70 100644 --- a/umap/static/umap/test/Permissions.js +++ b/umap/static/umap/test/Permissions.js @@ -34,11 +34,11 @@ describe('L.Permissions', function () { describe('#anonymous with cookie', function () { var button - it('should only allow edit_status', function () { + it('should not allow share_status nor owner', function () { this.map.permissions.options.anonymous_edit_url = 'http://anonymous.url' + delete this.map.permissions.options.owner button = qs('a.update-map-permissions') happen.click(button) - expect(qs('select[name="edit_status"]')).to.be.ok expect(qs('select[name="share_status"]')).not.to.be.ok expect(qs('input.edit-owner')).not.to.be.ok }) @@ -49,9 +49,10 @@ describe('L.Permissions', function () { it('should only allow editors', function () { this.map.permissions.options.owner = { id: 1, url: '/url', name: 'jojo' } + delete this.map.permissions.options.anonymous_edit_url + delete this.map.options.user button = qs('a.update-map-permissions') happen.click(button) - expect(qs('select[name="edit_status"]')).not.to.be.ok expect(qs('select[name="share_status"]')).not.to.be.ok expect(qs('input.edit-owner')).not.to.be.ok expect(qs('input.edit-editors')).to.be.ok @@ -66,8 +67,6 @@ describe('L.Permissions', function () { this.map.options.user = { id: 1, url: '/url', name: 'jojo' } button = qs('a.update-map-permissions') happen.click(button) - expect(qs('select[name="edit_status"]')).to.be.ok - expect(qs('select[name="share_status"]')).to.be.ok expect(qs('input.edit-owner')).to.be.ok expect(qs('input.edit-editors')).to.be.ok }) diff --git a/umap/static/umap/test/_pre.js b/umap/static/umap/test/_pre.js index 25323c2c..dda0c79e 100644 --- a/umap/static/umap/test/_pre.js +++ b/umap/static/umap/test/_pre.js @@ -198,6 +198,20 @@ function initMap(options) { displayCaptionOnLoad: false, displayPopupFooter: false, displayDataBrowserOnLoad: false, + permissions: { + share_status: 1, + owner: { + id: 1, + name: 'ybon', + url: '/en/user/ybon/', + }, + editors: [], + }, + user: { + id: 1, + name: 'foofoo', + url: '/en/me', + }, }, } default_options.properties.datalayers.push(defaultDatalayerData()) @@ -319,7 +333,11 @@ var RESPONSES = { datalayer64_GET: { crs: null, type: 'FeatureCollection', - _umap_options: defaultDatalayerData({name: 'hidden', id: 64, displayOnLoad: false }), + _umap_options: defaultDatalayerData({ + name: 'hidden', + id: 64, + displayOnLoad: false, + }), features: [ { geometry: { diff --git a/umap/static/umap/test/index.html b/umap/static/umap/test/index.html index cf4928f2..67a8aa59 100644 --- a/umap/static/umap/test/index.html +++ b/umap/static/umap/test/index.html @@ -37,6 +37,7 @@ +