Skip to content
This repository has been archived by the owner on May 19, 2020. It is now read-only.

Commit

Permalink
Fix link interpolation in invite fallback
Browse files Browse the repository at this point in the history
  • Loading branch information
el-mapache committed Jul 25, 2017
1 parent 1469376 commit a680afc
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 10 deletions.
11 changes: 5 additions & 6 deletions static_src/components/users.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const ORG_MANAGER = 'org_manager';
const SPACE_MANAGER = 'space_manager';
const ORG_ENTITY = 'organization';
const SPACE_ENTITY = 'space';
const cfAPILink = 'https://cloud.gov/docs/getting-started/setup/#set-up-the-command-line';

function stateSetter() {
const currentOrgGuid = OrgStore.currentOrgGuid;
Expand Down Expand Up @@ -163,15 +164,13 @@ export default class Users extends React.Component {

get userInvite() {
if (!this.currentUserIsOrgManager) {
const cfAPILink = 'https://cloud.gov/docs/getting-started/setup/#set-up-the-command-line';

return (
<PanelDocumentation>
{`Currently, only an org manager can invite users to this ${this.entityType}
Currently, only an org manager can invite users to this { this.entityType }
via the dashboard. If the user you want to add is already a cloud.gov member,
you can invite them using the <a href=${cfAPILink}>cloud foundry api. </a>
Speak to your org manager if you need to add a user to this ${this.entityType} who
is not a member of cloud.gov`}
you can invite them using the <a href={ cfAPILink }>cloud foundry api. </a>
Speak to your org manager if you need to add a user to this { this.entityType } who
is not a member of cloud.gov
</PanelDocumentation>
);
}
Expand Down
19 changes: 15 additions & 4 deletions static_src/test/unit/components/users.spec.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,17 +68,28 @@ describe('<Users />', () => {
});

describe('when a user is not an org manager', () => {
it('renders message telling user to ask an org manager to add users', () => {
const spaceUser = Object.assign({}, user, {
roles: buildRoles(spaceGuid, ['space_manager'])
});
const spaceUser = Object.assign({}, user, {
roles: buildRoles(spaceGuid, ['space_manager'])
});

beforeEach(() => {
UserStore._data = Immutable.fromJS([spaceUser]);
users = shallow(<Users />);
});

it('renders message telling user to ask an org manager to add users', () => {
expect(users.find(UsersInvite).length).toBe(0);
expect(users.find(PanelDocumentation).length).toBe(1);
});

it('renders a link for the user to follow to get more information', () => {
const panelDoc = users.find(PanelDocumentation);
const link = panelDoc.find('a');
const href = 'https://cloud.gov/docs/getting-started/setup/#set-up-the-command-line';

expect(link.length).toBe(1);
expect(link.prop('href')).toBe(href);
});
});
});
});

0 comments on commit a680afc

Please sign in to comment.