Skip to content

Commit

Permalink
STSMACOM-797 <ControlledVocab> - last updated by column - show "Sys…
Browse files Browse the repository at this point in the history
…tem" when items are created by system user
  • Loading branch information
BogdanDenis committed Jan 9, 2024
1 parent 530b94e commit 0dd51d6
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 14 deletions.
1 change: 0 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
* `<EditCustomFieldsSettings>` now passes the `entityType` when making PUT requests to `/custom-fields`. Refs FCFIELDS-44.
* Added `tenant` prop to `<ControlledVocab>`. Refs STSMACOM-794.
* Use the default match and search option in Advanced search when they are not entered. Refs STSMACOM-793.
* Show successful toast notifications for Create and Edit actions in `<ControlledVocab>`. Refs STSMACOM-796.
* `<ControlledVocab>` - last updated by column - show "System" when items are created by system user. Refs STSMACOM-797.

## [9.0.0](https://github.com/folio-org/stripes-smart-components/tree/v9.0.0) (2023-10-11)
Expand Down
9 changes: 0 additions & 9 deletions lib/ControlledVocab/ControlledVocab.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,8 @@ import EditableList from '../EditableList';
import css from './ControlledVocab.css';
import makeRefdataActuatorsBoundTo from './actuators-refdata';

<<<<<<< Updated upstream
=======
const ACTIONS = {
CREATE: 'termCreated',
EDIT: 'termUpdated',
DELETE: 'termDeleted',
};

const SYSTEM_USER_ID = '00000000-0000-0000-0000-000000000000';

>>>>>>> Stashed changes
const getTenantFromRESTResource = (queryParams, pathComponents, resourceValues, logger, props) => {
const {
tenant,
Expand Down
10 changes: 7 additions & 3 deletions lib/ControlledVocab/tests/ControlledVocab-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ describe('ControlledVocab', () => {
// eslint-disable-next-line no-undef
beforeEach(() => mountComponent(true, server, { translations }));

it('should have row count 5', () => cv.has({ rowCount: 5 }));
it('should have row count 6', () => cv.has({ rowCount: 6 }));

describe('clicking Delete icon on first row', () => {
beforeEach(async () => {
Expand Down Expand Up @@ -76,7 +76,7 @@ describe('ControlledVocab', () => {
// eslint-disable-next-line no-undef
beforeEach(() => mountComponent(true, server, { labelSingular }));

it('should have row count 5', () => cv.has({ rowCount: 5 }));
it('should have row count 6', () => cv.has({ rowCount: 6 }));

describe('clicking Delete icon on first row', () => {
beforeEach(async () => {
Expand Down Expand Up @@ -232,10 +232,14 @@ describe('ControlledVocab', () => {
await mountComponent(false, server, { listSuppressor });
});

it('should have row count 5', () => cv.has({ rowCount: 5 }));
it('should have row count 6', () => cv.has({ rowCount: 6 }));

it('should render the row with last updated by user-1 without user firstname or lastname', async () => {
await mcl.find(MultiColumnListCell({ row: 4, columnIndex: 3, content: '4/18/2019 by ' })).exists();
});

it.only('should render the row with last updated by system with "System" text', async () => {

Check failure on line 241 in lib/ControlledVocab/tests/ControlledVocab-test.js

View workflow job for this annotation

GitHub Actions / build-npm

it.only not permitted

Check failure on line 241 in lib/ControlledVocab/tests/ControlledVocab-test.js

View workflow job for this annotation

GitHub Actions / build-npm

it.only not permitted
await mcl.find(MultiColumnListCell({ row: 6, columnIndex: 3, content: '1/9/2024 by System' })).exists();
});
});
});
12 changes: 11 additions & 1 deletion lib/ControlledVocab/tests/mountComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,18 @@ export default async function (editable, server, props) {
'updatedDate' : '2019-04-18T16:41:36.806+0000',
'updatedByUserId' : 'user-2'
}
}, {
'id' : '40ee00ca-a518-4b49-be01-0638d0a4ac57',
'name' : 'Københavns Universitet',
'code' : 'KU',
'metadata' : {
'createdDate' : '2024-01-09T01:49:57.008+00:00',
'createdByUserId' : '00000000-0000-0000-0000-000000000000',
'updatedDate' : '2024-01-09T01:49:57.008+00:00',
'updatedByUserId' : '00000000-0000-0000-0000-000000000000'
}
}],
'totalRecords' : 5
'totalRecords' : 6
});
});

Expand Down

0 comments on commit 0dd51d6

Please sign in to comment.