mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-13 14:39:52 +03:00
ba80e6ebaa
closes #5434 - remove transition away from team page to user page of authors - hide invite button from authors - hide invited users from authors - adjusted gh-user-can and renamed to gh-user-can-admin - hide password reset on owners profile from administrators - hide input field for owner email from administrators pending api fix - fix up tests
58 lines
1.6 KiB
JavaScript
58 lines
1.6 KiB
JavaScript
import {
|
|
describeModule,
|
|
it
|
|
} from 'ember-mocha';
|
|
import {
|
|
ghUserCanAdmin
|
|
} from 'ghost/helpers/gh-user-can-admin';
|
|
|
|
describe ('GhUserCanAdminHelper', function () {
|
|
// Mock up roles and test for truthy
|
|
describe ('Owner role', function () {
|
|
var user = {get: function (role) {
|
|
if (role === 'isOwner') {
|
|
return true;
|
|
} else if (role === 'isAdmin') {
|
|
return false;
|
|
}
|
|
}
|
|
};
|
|
it(' - can be Admin', function () {
|
|
var result = ghUserCanAdmin([user]);
|
|
expect(result).to.equal(true);
|
|
});
|
|
});
|
|
|
|
describe ('Administrator role', function () {
|
|
var user = {
|
|
get: function (role) {
|
|
if (role === 'isOwner') {
|
|
return false;
|
|
} else if (role === 'isAdmin') {
|
|
return true;
|
|
}
|
|
}
|
|
};
|
|
it(' - can be Admin', function () {
|
|
var result = ghUserCanAdmin([user]);
|
|
expect(result).to.equal(true);
|
|
});
|
|
});
|
|
|
|
describe ('Editor and Author roles', function () {
|
|
var user = {
|
|
get: function (role) {
|
|
if (role === 'isOwner') {
|
|
return false;
|
|
} else if (role === 'isAdmin') {
|
|
return false;
|
|
}
|
|
}
|
|
};
|
|
it(' - cannot be Admin', function () {
|
|
var result = ghUserCanAdmin([user]);
|
|
expect(result).to.equal(false);
|
|
});
|
|
});
|
|
});
|