Skip to content
This repository has been archived by the owner on Nov 28, 2022. It is now read-only.

Commit

Permalink
Make /reference-edit use the baseUrl prop
Browse files Browse the repository at this point in the history
  • Loading branch information
mjcuva committed Feb 25, 2019
1 parent 65d8e7b commit 7c5b144
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
9 changes: 9 additions & 0 deletions packages/api-explorer/__tests__/Doc.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,15 @@ describe('suggest edits', () => {
const doc = shallow(<Doc {...props} suggestedEdits />);
expect(doc.find('a.hub-reference-edit.pull-right').length).toBe(1);
});

test('should have child project if baseUrl is set', () => {
const doc = shallow(
<Doc {...Object.assign({}, { baseUrl: '/child' }, props)} suggestedEdits />,
);
expect(doc.find('a.hub-reference-edit.pull-right').prop('href')).toBe(
`/child/reference-edit/${props.doc.slug}`,
);
});
});

describe('Response Schema', () => {
Expand Down
5 changes: 4 additions & 1 deletion packages/api-explorer/src/Doc.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,10 @@ class Doc extends React.Component {
<header>
{this.props.suggestedEdits && (
// eslint-disable-next-line jsx-a11y/href-no-hash
<a className="hub-reference-edit pull-right" href={`reference-edit/${doc.slug}`}>
<a
className="hub-reference-edit pull-right"
href={`${this.props.baseUrl}/reference-edit/${doc.slug}`}
>
<i className="icon icon-register" />
Suggest Edits
</a>
Expand Down

0 comments on commit 7c5b144

Please sign in to comment.