Skip to content

Commit

Permalink
FIX Render Content component even if no summary is available
Browse files Browse the repository at this point in the history
  • Loading branch information
raissanorth committed Oct 15, 2018
1 parent 5cbc6c7 commit 6e69ef9
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
2 changes: 1 addition & 1 deletion client/dist/js/bundle.js

Large diffs are not rendered by default.

6 changes: 1 addition & 5 deletions client/src/components/ElementEditor/Content.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,9 @@ class Content extends PureComponent {
onFormInit
} = this.props;

if (!content && !fileUrl) {
return null;
}

return (
<div className="element-editor-content">
{!previewExpanded &&
{!previewExpanded && (content || fileUrl) &&
// Show summary
<SummaryComponent
content={content}
Expand Down
5 changes: 3 additions & 2 deletions client/src/components/ElementEditor/tests/Content-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ describe('Content', () => {
expect(wrapper.find(InlineEditFormComponent)).toHaveLength(1);
});

it('returns null when no content or image is provided', () => {
it('returns a div when no content or image is provided', () => {
const wrapper = shallow(
<Content
fileUrl=""
Expand All @@ -57,7 +57,8 @@ describe('Content', () => {
/>
);

expect(wrapper.type()).toBeNull();
expect(wrapper.type()).toEqual('div');
expect(wrapper.find(SummaryComponent)).toHaveLength(0);
});
});
});

0 comments on commit 6e69ef9

Please sign in to comment.