Skip to content

Commit

Permalink
UIU-1860 - Users App: Consume {{FormattedDate}} and {{FormattedTime}}… (
Browse files Browse the repository at this point in the history
#2559)

* UIU-1860 - Users App: Consume {{FormattedDate}} and {{FormattedTime}} via stripes-component

* update test

* UIU-1860 - fix test failures
  • Loading branch information
Terala-Priyanka authored Sep 20, 2023
1 parent b2d890a commit b7b3b6e
Show file tree
Hide file tree
Showing 17 changed files with 47 additions and 18 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@
* Generate "Create request" url for users without barcode. Refs UIU-2869.
* Add auto focus to textarea on staff and patron info modal. Fixes UIU-2932.
* ECS - Filter users by "User Type". Refs UIU-2943.
* Users App: Consume {{FormattedDate}} and {{FormattedTime}} via stripes-component. Refs UIU-1860.

## [9.0.0](https://github.com/folio-org/ui-users/tree/v9.0.0) (2023-02-20)
[Full Changelog](https://github.com/folio-org/ui-users/compare/v8.1.0...v9.0.0)
Expand Down
4 changes: 2 additions & 2 deletions src/components/Accounts/ViewFeesFines/ViewFeesFines.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ import React from 'react';
import PropTypes from 'prop-types';
import { Link } from 'react-router-dom';
import {
FormattedDate,
FormattedMessage,
FormattedTime,
} from 'react-intl';

import {
Expand All @@ -17,6 +15,8 @@ import {
Row,
Col,
Icon,
FormattedDate,
FormattedTime,
} from '@folio/stripes/components';

import { itemStatuses } from '../../../constants';
Expand Down
3 changes: 3 additions & 0 deletions src/components/Accounts/ViewFeesFines/ViewFeesFines.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ jest.mock('../../util', () => ({
jest.mock('react-intl', () => ({
...jest.requireActual('react-intl'),
FormattedMessage: jest.fn(({ id }) => id),
}));
jest.mock('@folio/stripes/components', () => ({
...jest.requireActual('@folio/stripes/components'),
FormattedTime: jest.fn(({ value }) => value),
FormattedDate: jest.fn(({ value }) => value),
}));
Expand Down
2 changes: 1 addition & 1 deletion src/components/BulkOverrideDialog/BulkOverrideLoansList.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { get } from 'lodash';
import {
FormattedTime,
FormattedMessage,
injectIntl,
} from 'react-intl';

import {
Icon,
MultiColumnList,
FormattedTime,
} from '@folio/stripes/components';
import { effectiveCallNumber } from '@folio/stripes/util';

Expand Down
2 changes: 1 addition & 1 deletion src/components/BulkRenewalDialog/BulkRenewedLoansList.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import get from 'lodash/get';

import {
FormattedMessage,
FormattedTime,
} from 'react-intl';

import {
Icon,
MultiColumnList,
FormattedTime,
} from '@folio/stripes/components';
import { effectiveCallNumber } from '@folio/stripes/util';

Expand Down
2 changes: 1 addition & 1 deletion src/components/Loans/ClosedLoans/ClosedLoans.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import _ from 'lodash';
import React from 'react';
import {
FormattedMessage,
FormattedTime,
injectIntl,
} from 'react-intl';
import PropTypes from 'prop-types';
Expand All @@ -16,6 +15,7 @@ import {
IconButton,
ExportCsv,
ConfirmationModal,
FormattedTime,
} from '@folio/stripes/components';
import {
IfPermission,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import PropTypes from 'prop-types';
import { FormattedMessage, FormattedDate, injectIntl } from 'react-intl';
import { FormattedMessage, injectIntl } from 'react-intl';
import { Link } from 'react-router-dom';
import { isEmpty } from 'lodash';
import moment from 'moment';
Expand All @@ -14,6 +14,7 @@ import {
MultiColumnList,
Spinner,
TextArea,
FormattedDate,
} from '@folio/stripes/components';

import { getOpenRequestsPath } from '../../../../util';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React from 'react';
import { get } from 'lodash';
import {
FormattedTime,
FormattedDate,
} from 'react-intl';
FormattedTime,
} from '@folio/stripes/components';

import { effectiveCallNumber } from '@folio/stripes/util';

Expand Down
2 changes: 1 addition & 1 deletion src/components/ProxyGroup/ProxyEditItem/ProxyEditItem.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React from 'react';
import {
FormattedMessage,
FormattedTime,
} from 'react-intl';
import {
defer,
Expand All @@ -18,6 +17,7 @@ import {
Datepicker,
LayoutHeader,
Select,
FormattedTime,
} from '@folio/stripes/components';

import { getFullName } from '../../util';
Expand Down
12 changes: 10 additions & 2 deletions src/components/ProxyGroup/ProxyItem/ProxyItem.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
import _ from 'lodash';
import React from 'react';
import PropTypes from 'prop-types';
import { FormattedMessage, FormattedTime, FormattedDate } from 'react-intl';
import { FormattedMessage } from 'react-intl';
import { Link } from 'react-router-dom';
import { Row, Col, KeyValue, LayoutHeader, NoValue } from '@folio/stripes/components';
import {
Row,
Col,
KeyValue,
LayoutHeader,
NoValue,
FormattedTime,
FormattedDate,
} from '@folio/stripes/components';

import { getFullName } from '../../util';
import css from './ProxyItem.css';
Expand Down
3 changes: 2 additions & 1 deletion src/components/UserDetailSections/UserInfo/UserInfo.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import { get } from 'lodash';
import React from 'react';
import PropTypes from 'prop-types';
import { FormattedMessage, FormattedDate } from 'react-intl';
import { FormattedMessage } from 'react-intl';
import {
Row,
Col,
KeyValue,
Accordion,
Headline,
NoValue,
FormattedDate,
} from '@folio/stripes/components';

import { ViewMetaData } from '@folio/stripes/smart-components';
Expand Down
2 changes: 1 addition & 1 deletion src/views/LoanDetails/LoanDetails.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React from 'react';
import {
FormattedMessage,
FormattedTime,
injectIntl,
} from 'react-intl';
import { compose } from 'redux';
Expand Down Expand Up @@ -29,6 +28,7 @@ import {
LoadingView,
Dropdown,
DropdownMenu,
FormattedTime,
} from '@folio/stripes/components';
import { IfPermission, stripesConnect } from '@folio/stripes/core';
import { effectiveCallNumber } from '@folio/stripes/util';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@ jest.mock('./util', () => ({
jest.mock('react-intl', () => ({
...jest.requireActual('react-intl'),
FormattedMessage: jest.fn(({ id }) => id),
FormattedTime: jest.fn(({ value }) => value),
FormattedDate: jest.fn(({ value }) => value),
}));

const initialProps = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
import {
FormattedDate,
FormattedTime,
} from 'react-intl';
} from '@folio/stripes/components';

const DateTimeFormatter = ({ value }) => {
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { render } from '@folio/jest-config-stripes/testing-library/react';
import {
FormattedDate,
FormattedTime,
} from 'react-intl';
} from '@folio/stripes/components';

import '../../../../../../../../test/jest/__mock__';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@ import {
} from '@folio/jest-config-stripes/testing-library/react';
import {
FormattedMessage,
} from 'react-intl';

import {
FormattedDate,
FormattedTime,
} from 'react-intl';
} from '@folio/stripes/components';

import RecordStatus, {
getBilledAmount,
Expand Down
14 changes: 14 additions & 0 deletions test/jest/__mock__/stripesComponents.mock.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,20 @@ jest.mock('@folio/stripes/components', () => ({
ExpandAllButton: jest.fn(({ children }) => (
<span>{children}</span>
)),
FormattedTime: jest.fn(({ value, children }) => {
if (children) {
return children([value]);
}

return value;
}),
FormattedDate: jest.fn(({ value, children }) => {
if (children) {
return children([value]);
}

return value;
}),
HasCommand: jest.fn(({ children }) => (
<span>{children}</span>
)),
Expand Down

0 comments on commit b7b3b6e

Please sign in to comment.