Skip to content

Commit

Permalink
provide correct prop of correct type (#361)
Browse files Browse the repository at this point in the history
provide correct prop (`contentLabel`) of correct type (`PropTypes.string`)
  • Loading branch information
zburke authored Jun 13, 2019
1 parent d2082e4 commit d24ee5d
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 19 deletions.
46 changes: 27 additions & 19 deletions src/ViewRequest.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ import {
FormattedTime,
} from 'react-intl';

import { TitleManager } from '@folio/stripes/core';
import {
IntlConsumer,
TitleManager
} from '@folio/stripes/core';
import {
Button,
Accordion,
Expand Down Expand Up @@ -226,24 +229,29 @@ class ViewRequest extends React.Component {

if (query.layer === 'edit') {
return (
<Layer
isOpen
label={<FormattedMessage id="ui-requests.actions.editRequestLink" />}
>
<RequestForm
stripes={stripes}
initialValues={{ requestExpirationDate: null, ...request }}
request={request}
metadataDisplay={this.cViewMetaData}
onSubmit={(record) => { this.update(record); }}
onCancel={onCloseEdit}
onCancelRequest={this.cancelRequest}
optionLists={optionLists}
patronGroups={patronGroups}
query={this.props.query}
findResource={findResource}
/>
</Layer>
<IntlConsumer>
{intl => (
<Layer
isOpen
contentLabel={intl.formatMessage({ id: 'ui-requests.actions.editRequestLink' })}
>
<RequestForm
stripes={stripes}
initialValues={{ requestExpirationDate: null, ...request }}
request={request}
metadataDisplay={this.cViewMetaData}
onSubmit={(record) => { this.update(record); }}
onCancel={onCloseEdit}
onCancelRequest={this.cancelRequest}
optionLists={optionLists}
patronGroups={patronGroups}
query={this.props.query}
findResource={findResource}
/>
</Layer>
)
}
</IntlConsumer>
);
}

Expand Down
2 changes: 2 additions & 0 deletions test/bigtest/interactors/edit-request.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
clickable,
fillable,
selectable,
isPresent,
} from '@bigtest/interactor';

import CancelRequestDialog from './cancel-request-dialog';
Expand All @@ -23,6 +24,7 @@ import CancelRequestDialog from './cancel-request-dialog';
chooseServicePoint = selectable('[name="pickupServicePointId"]');
clickUpdate = clickable('#clickable-update-request');
cancelRequestDialog = new CancelRequestDialog('[data-test-cancel-request-modal]');
isLayerPresent = isPresent('[class*=LayerRoot][role=dialog]');
}

export default new EditRequestsInteractor();
7 changes: 7 additions & 0 deletions test/bigtest/tests/edit-request-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ describe('Edit Request page', () => {
this.visit('/requests/view/requestId0?layer=edit');
});

describe('Request edit layer', function () {
it('layer exists', function () {
expect(EditRequestInteractor.isLayerPresent).to.be.true;
});
});


describe('clicking cancel editing button', function () {
beforeEach(async () => {
await EditRequestInteractor.headerDropdown.click();
Expand Down

0 comments on commit d24ee5d

Please sign in to comment.