|
|
|
@ -24,6 +24,9 @@ const TWITTER_USERNAME = 'twitter_username';
|
|
|
|
|
const DISQUS_SHORTNAME = 'disqus_shortname';
|
|
|
|
|
const AVAILABLE_FOR_HIRE = true;
|
|
|
|
|
const LOCATION = 'location';
|
|
|
|
|
const BUILDER_ROLE_DISPLAY = 'builder';
|
|
|
|
|
const VIEWER_ROLE_DISPLAY = 'viewer';
|
|
|
|
|
const CUSTOM_ROLE_DISPLAY = 'custom';
|
|
|
|
|
const PASSWORD = 'password';
|
|
|
|
|
const MALICIOUS_TEXT = '/><script>alert("wadus");</script>';
|
|
|
|
|
const ESCAPED_TEXT = '/><script>alert("wadus");</script>';
|
|
|
|
@ -55,6 +58,7 @@ describe('dashboard/views/profile/profile-form/profile-form-view', function () {
|
|
|
|
|
available_for_hire: AVAILABLE_FOR_HIRE,
|
|
|
|
|
location: LOCATION,
|
|
|
|
|
viewer: false,
|
|
|
|
|
role_display: BUILDER_ROLE_DISPLAY,
|
|
|
|
|
needs_password_confirmation: true
|
|
|
|
|
}, options)
|
|
|
|
|
);
|
|
|
|
@ -211,7 +215,7 @@ describe('dashboard/views/profile/profile-form/profile-form-view', function () {
|
|
|
|
|
|
|
|
|
|
describe('is viewer', function () {
|
|
|
|
|
beforeEach(function () {
|
|
|
|
|
userModel.set('viewer', true);
|
|
|
|
|
spyOn(userModel, 'role').and.returnValue(VIEWER_ROLE_DISPLAY);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
describe('.render', function () {
|
|
|
|
@ -224,14 +228,27 @@ describe('dashboard/views/profile/profile-form/profile-form-view', function () {
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
describe('is inside org', function () {
|
|
|
|
|
describe('has custom role', function () {
|
|
|
|
|
beforeEach(function () {
|
|
|
|
|
spyOn(userModel, 'role').and.returnValue(CUSTOM_ROLE_DISPLAY);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
describe('.render', function () {
|
|
|
|
|
it('should render properly', function () {
|
|
|
|
|
view.render();
|
|
|
|
|
expect(view.$el.html()).toContain(CUSTOM_ROLE_DISPLAY);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
describe('is viewer inside org', function () {
|
|
|
|
|
beforeEach(function () {
|
|
|
|
|
spyOn(userModel, 'role').and.returnValue(VIEWER_ROLE_DISPLAY);
|
|
|
|
|
spyOn(userModel, 'isInsideOrg').and.returnValue(true);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
describe('.render', function () {
|
|
|
|
|
it('should render properly', function () {
|
|
|
|
|
spyOn(userModel, 'isViewer').and.returnValue(true);
|
|
|
|
|
spyOn(view, '_getOrgAdminEmail').and.returnValue(DISPLAY_EMAIL);
|
|
|
|
|
|
|
|
|
|
view.render();
|
|
|
|
|