Fix permissions related frontend tests
This commit is contained in:
parent
84e3aa7121
commit
36befefbc6
4 changed files with 26 additions and 8 deletions
|
@ -105,7 +105,7 @@ describe('L.U.Map', function () {
|
||||||
window.confirm = oldConfirm
|
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')
|
var button = qs('a.update-map-settings')
|
||||||
assert.ok(button, 'update map info button exists')
|
assert.ok(button, 'update map info button exists')
|
||||||
happen.click(button)
|
happen.click(button)
|
||||||
|
@ -117,7 +117,7 @@ describe('L.U.Map', function () {
|
||||||
this.server.respond()
|
this.server.respond()
|
||||||
assert(window.confirm.calledOnce)
|
assert(window.confirm.calledOnce)
|
||||||
window.confirm.restore()
|
window.confirm.restore()
|
||||||
done()
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -34,11 +34,11 @@ describe('L.Permissions', function () {
|
||||||
describe('#anonymous with cookie', function () {
|
describe('#anonymous with cookie', function () {
|
||||||
var button
|
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'
|
this.map.permissions.options.anonymous_edit_url = 'http://anonymous.url'
|
||||||
|
delete this.map.permissions.options.owner
|
||||||
button = qs('a.update-map-permissions')
|
button = qs('a.update-map-permissions')
|
||||||
happen.click(button)
|
happen.click(button)
|
||||||
expect(qs('select[name="edit_status"]')).to.be.ok
|
|
||||||
expect(qs('select[name="share_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-owner')).not.to.be.ok
|
||||||
})
|
})
|
||||||
|
@ -49,9 +49,10 @@ describe('L.Permissions', function () {
|
||||||
|
|
||||||
it('should only allow editors', function () {
|
it('should only allow editors', function () {
|
||||||
this.map.permissions.options.owner = { id: 1, url: '/url', name: 'jojo' }
|
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')
|
button = qs('a.update-map-permissions')
|
||||||
happen.click(button)
|
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('select[name="share_status"]')).not.to.be.ok
|
||||||
expect(qs('input.edit-owner')).not.to.be.ok
|
expect(qs('input.edit-owner')).not.to.be.ok
|
||||||
expect(qs('input.edit-editors')).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' }
|
this.map.options.user = { id: 1, url: '/url', name: 'jojo' }
|
||||||
button = qs('a.update-map-permissions')
|
button = qs('a.update-map-permissions')
|
||||||
happen.click(button)
|
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-owner')).to.be.ok
|
||||||
expect(qs('input.edit-editors')).to.be.ok
|
expect(qs('input.edit-editors')).to.be.ok
|
||||||
})
|
})
|
||||||
|
|
|
@ -198,6 +198,20 @@ function initMap(options) {
|
||||||
displayCaptionOnLoad: false,
|
displayCaptionOnLoad: false,
|
||||||
displayPopupFooter: false,
|
displayPopupFooter: false,
|
||||||
displayDataBrowserOnLoad: 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())
|
default_options.properties.datalayers.push(defaultDatalayerData())
|
||||||
|
@ -319,7 +333,11 @@ var RESPONSES = {
|
||||||
datalayer64_GET: {
|
datalayer64_GET: {
|
||||||
crs: null,
|
crs: null,
|
||||||
type: 'FeatureCollection',
|
type: 'FeatureCollection',
|
||||||
_umap_options: defaultDatalayerData({name: 'hidden', id: 64, displayOnLoad: false }),
|
_umap_options: defaultDatalayerData({
|
||||||
|
name: 'hidden',
|
||||||
|
id: 64,
|
||||||
|
displayOnLoad: false,
|
||||||
|
}),
|
||||||
features: [
|
features: [
|
||||||
{
|
{
|
||||||
geometry: {
|
geometry: {
|
||||||
|
|
|
@ -37,6 +37,7 @@
|
||||||
<script src="../js/umap.slideshow.js"></script>
|
<script src="../js/umap.slideshow.js"></script>
|
||||||
<script src="../js/umap.tableeditor.js"></script>
|
<script src="../js/umap.tableeditor.js"></script>
|
||||||
<script src="../js/umap.permissions.js"></script>
|
<script src="../js/umap.permissions.js"></script>
|
||||||
|
<script src="../js/umap.datalayer.permissions.js"></script>
|
||||||
<script src="../js/umap.js"></script>
|
<script src="../js/umap.js"></script>
|
||||||
<script src="../js/umap.ui.js"></script>
|
<script src="../js/umap.ui.js"></script>
|
||||||
<link rel="stylesheet" href="../vendors/leaflet/leaflet.css" />
|
<link rel="stylesheet" href="../vendors/leaflet/leaflet.css" />
|
||||||
|
|
Loading…
Reference in a new issue