Skip to content

Commit

Permalink
Merge pull request #3127 from huridocs/2815-inherited-properties
Browse files Browse the repository at this point in the history
Inherited properties not showing in the Entity view
  • Loading branch information
konzz authored Aug 31, 2020
2 parents e66f963 + 25dc1e3 commit bb13e40
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/react/Entities/components/EntityViewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ const mapStateToProps = state => ({
entity: state.entityView.entity,
relationTypes: selectRelationTypes(state),
templates: state.templates,
relationships: state.entityView.entity.get('relationships'),
relationships: state.entityView.entity.get('relations'),
connectionsGroups: state.relationships.list.connectionsGroups,
entityBeingEdited: !!state.entityView.entityForm._id,
tab: state.entityView.uiState.get('tab'),
Expand Down
19 changes: 18 additions & 1 deletion app/react/Entities/components/specs/EntityViewer.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import Immutable from 'immutable';
import React from 'react';

import { ConnectionsGroups, ConnectionsList } from 'app/ConnectionsList';
import { ShowMetadata } from 'app/Metadata';
import { shallow } from 'enzyme';
import { FileList } from 'app/Attachments/components/FileList';
import { EntityViewer } from '../EntityViewer';
Expand All @@ -15,7 +16,11 @@ describe('EntityViewer', () => {
beforeEach(() => {
context = { confirm: jasmine.createSpy('confirm') };
props = {
entity: Immutable.fromJS({ title: 'Title', documents: [{ _id: '123', title: 'Test doc' }] }),
entity: Immutable.fromJS({
title: 'Title',
documents: [{ _id: '123', title: 'Test doc' }],
relations: [{ template: null, entity: '123', hub: 'abc' }],
}),
templates: Immutable.fromJS([
{
_id: 'template1',
Expand All @@ -28,6 +33,7 @@ describe('EntityViewer', () => {
name: 'template2Name',
},
]),
relationships: Immutable.fromJS([{ template: null, entity: '123', hub: 'abc' }]),
relationTypes: [{ _id: 'abc', name: 'relationTypeName' }],
connectionsGroups: Immutable.fromJS([
{ key: 'g1', templates: [{ _id: 't1', count: 1 }] },
Expand Down Expand Up @@ -73,6 +79,17 @@ describe('EntityViewer', () => {
expect(component.find(FileList).props().entity).toEqual(props.entity.toJS());
});

it('should render the inherited properties of an entity', () => {
render();
expect(component.find(ShowMetadata).props().relationships.size).toBe(1);
expect(
component
.find(ShowMetadata)
.props()
.relationships.toJS()
).toEqual(props.entity.toJS().relations);
});

describe('deleteConnection', () => {
beforeEach(() => {
render();
Expand Down

0 comments on commit bb13e40

Please sign in to comment.