From a3e9c9ecebcf5ab4dc83ee06126b5e6883b637e6 Mon Sep 17 00:00:00 2001 From: svishnev Date: Mon, 15 Jan 2018 15:55:53 +0200 Subject: Contributor can also submit fix Issue-ID: SDC-931 Change-Id: Ic2f67552614e8236b3e19a6a205b699e36947968 Signed-off-by: svishnev --- .../versionController/components/ActionButtons.jsx | 4 +-- .../VersionController/versionController.test.js | 32 +++++++++++++++------- 2 files changed, 24 insertions(+), 12 deletions(-) (limited to 'openecomp-ui') diff --git a/openecomp-ui/src/nfvo-components/panel/versionController/components/ActionButtons.jsx b/openecomp-ui/src/nfvo-components/panel/versionController/components/ActionButtons.jsx index 4346a0e5dc..88ea9c6e3a 100644 --- a/openecomp-ui/src/nfvo-components/panel/versionController/components/ActionButtons.jsx +++ b/openecomp-ui/src/nfvo-components/panel/versionController/components/ActionButtons.jsx @@ -1,5 +1,5 @@ /*! - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright © 2016-2017 European Support Limited * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -83,7 +83,7 @@ const ActionButtons = ({isReadOnlyMode, onSubmit, onRevert, onSave, isFormDataVa } - {onSubmit && (permissions.owner && permissions.owner.userId === userInfo.userId) && + {onSubmit &&
{ expect(elem.length).toBe(1); }); - it('Doesn\'t show the submit button when user is not owner', () => { - const permissions = {owner: {userId: '111'}}, - userInfo = {userId: '222'}; + it('Shows the submit button when callVCAction available and user is contributor', () => { + const permissions = {owner: {userId: '111'}, contributors: ['232']}, + userInfo = {userId: '232'}; let callVCActionProps = { ...props, callVCAction: function(){}, permissions, userInfo}; let versionController = TestUtils.renderIntoDocument(); let elem = scryRenderedDOMComponentsWithTestId(versionController,'vc-submit-btn'); expect(elem).toBeTruthy(); + expect(elem.length).toBe(1); + }); + + it('Doesn\'t show the submit button when user is not owner or contributor', () => { + const permissions = {owner: {userId: '111'}, contributors: ['232']}, + userInfo = {userId: '222'}; + const propsViewer = {...props, + itemPermission: {isCertified: false, isCollaborator: false, isDirty: false}}; + let callVCActionProps = { ...propsViewer, callVCAction: function(){}, permissions, userInfo}; + let versionController = TestUtils.renderIntoDocument(); + let elem = scryRenderedDOMComponentsWithTestId(versionController,'vc-submit-btn'); + expect(elem).toBeTruthy(); expect(elem.length).toBe(0); }); -- cgit 1.2.3-korg