diff --git a/packages/terra-clinical-item-view/CHANGELOG.md b/packages/terra-clinical-item-view/CHANGELOG.md
index e1fcba72b..bf887b506 100644
--- a/packages/terra-clinical-item-view/CHANGELOG.md
+++ b/packages/terra-clinical-item-view/CHANGELOG.md
@@ -2,6 +2,9 @@
## Unreleased
+* Fixed
+ * Fixed error for null `displays` prop.
+
## 4.13.0 - (October 3, 2023)
* Added
diff --git a/packages/terra-clinical-item-view/src/ItemView.jsx b/packages/terra-clinical-item-view/src/ItemView.jsx
index 42a1c6b7b..7398fd047 100644
--- a/packages/terra-clinical-item-view/src/ItemView.jsx
+++ b/packages/terra-clinical-item-view/src/ItemView.jsx
@@ -314,11 +314,13 @@ const renderView = (displays, layout, emphasis, overrideDefaultStyling, trueColu
};
const isDisplaysTruncated = (displays) => {
- const displaysSlice = displays.slice(0, 8);
+ if (displays) {
+ const displaysSlice = displays.slice(0, 8);
- for (let i = 0; i < displaysSlice.length; i += 1) {
- if (displaysSlice[i].props.isTruncated === true) {
- return true;
+ for (let i = 0; i < displaysSlice.length; i += 1) {
+ if (displaysSlice[i]?.props.isTruncated === true) {
+ return true;
+ }
}
}
diff --git a/packages/terra-clinical-item-view/src/terra-dev-site/test/clinical-item-view/NullItemView.test.jsx b/packages/terra-clinical-item-view/src/terra-dev-site/test/clinical-item-view/NullItemView.test.jsx
new file mode 100644
index 000000000..034c80ae9
--- /dev/null
+++ b/packages/terra-clinical-item-view/src/terra-dev-site/test/clinical-item-view/NullItemView.test.jsx
@@ -0,0 +1,21 @@
+import React from 'react';
+import classNames from 'classnames/bind';
+import ItemView from '../../../ItemView';
+import styles from './ItemViewCommon.test.module.scss';
+
+const cx = classNames.bind(styles);
+
+const DefaultItemView = () => (
+
+
Given null displays prop, the div is created, but there is no content to show. The ItemView is outlined below.
+
+
+
+
Given null display item, the div is created, but there is no content to show. The ItemView is outlined below.
+
+
+
+
+);
+
+export default DefaultItemView;
diff --git a/packages/terra-clinical-item-view/tests/jest/ItemView.test.jsx b/packages/terra-clinical-item-view/tests/jest/ItemView.test.jsx
index ad09b80b9..dd99dcb27 100644
--- a/packages/terra-clinical-item-view/tests/jest/ItemView.test.jsx
+++ b/packages/terra-clinical-item-view/tests/jest/ItemView.test.jsx
@@ -9,6 +9,21 @@ it('should render a default component', () => {
expect(itemView).toMatchSnapshot();
});
+it('should render with null displays prop', () => {
+ const itemView = shallow();
+
+ expect(itemView.find('ItemDisplay')).toHaveLength(0);
+ expect(itemView.find('.body').props().children).toEqual([undefined, undefined]);
+ expect(itemView).toMatchSnapshot();
+});
+
+it('should render with null display item', () => {
+ const itemView = shallow();
+
+ expect(itemView.find('ItemDisplay')).toHaveLength(0);
+ expect(itemView).toMatchSnapshot();
+});
+
it('should render with 1 display', () => {
const display1 = shallowWithIntl();
const displays = [display1];
diff --git a/packages/terra-clinical-item-view/tests/jest/__snapshots__/ItemView.test.jsx.snap b/packages/terra-clinical-item-view/tests/jest/__snapshots__/ItemView.test.jsx.snap
index a7a6727fc..db27f7231 100644
--- a/packages/terra-clinical-item-view/tests/jest/__snapshots__/ItemView.test.jsx.snap
+++ b/packages/terra-clinical-item-view/tests/jest/__snapshots__/ItemView.test.jsx.snap
@@ -2420,3 +2420,31 @@ exports[`should render with a display and graphic 1`] = `
`;
+
+exports[`should render with null display item 1`] = `
+
+`;
+
+exports[`should render with null displays prop 1`] = `
+
+`;
diff --git a/packages/terra-clinical-item-view/tests/wdio/__snapshots__/reference/clinical-lowlight-theme/en/chrome_enormous/item-view-spec/with_a_null_display.png b/packages/terra-clinical-item-view/tests/wdio/__snapshots__/reference/clinical-lowlight-theme/en/chrome_enormous/item-view-spec/with_a_null_display.png
new file mode 100644
index 000000000..5de44f35b
Binary files /dev/null and b/packages/terra-clinical-item-view/tests/wdio/__snapshots__/reference/clinical-lowlight-theme/en/chrome_enormous/item-view-spec/with_a_null_display.png differ
diff --git a/packages/terra-clinical-item-view/tests/wdio/__snapshots__/reference/clinical-lowlight-theme/en/chrome_huge/item-view-spec/with_a_null_display.png b/packages/terra-clinical-item-view/tests/wdio/__snapshots__/reference/clinical-lowlight-theme/en/chrome_huge/item-view-spec/with_a_null_display.png
new file mode 100644
index 000000000..a728d6cdd
Binary files /dev/null and b/packages/terra-clinical-item-view/tests/wdio/__snapshots__/reference/clinical-lowlight-theme/en/chrome_huge/item-view-spec/with_a_null_display.png differ
diff --git a/packages/terra-clinical-item-view/tests/wdio/__snapshots__/reference/clinical-lowlight-theme/en/chrome_large/item-view-spec/with_a_null_display.png b/packages/terra-clinical-item-view/tests/wdio/__snapshots__/reference/clinical-lowlight-theme/en/chrome_large/item-view-spec/with_a_null_display.png
new file mode 100644
index 000000000..960404f46
Binary files /dev/null and b/packages/terra-clinical-item-view/tests/wdio/__snapshots__/reference/clinical-lowlight-theme/en/chrome_large/item-view-spec/with_a_null_display.png differ
diff --git a/packages/terra-clinical-item-view/tests/wdio/__snapshots__/reference/clinical-lowlight-theme/en/chrome_medium/item-view-spec/with_a_null_display.png b/packages/terra-clinical-item-view/tests/wdio/__snapshots__/reference/clinical-lowlight-theme/en/chrome_medium/item-view-spec/with_a_null_display.png
new file mode 100644
index 000000000..e63406a53
Binary files /dev/null and b/packages/terra-clinical-item-view/tests/wdio/__snapshots__/reference/clinical-lowlight-theme/en/chrome_medium/item-view-spec/with_a_null_display.png differ
diff --git a/packages/terra-clinical-item-view/tests/wdio/__snapshots__/reference/clinical-lowlight-theme/en/chrome_small/item-view-spec/with_a_null_display.png b/packages/terra-clinical-item-view/tests/wdio/__snapshots__/reference/clinical-lowlight-theme/en/chrome_small/item-view-spec/with_a_null_display.png
new file mode 100644
index 000000000..e83c5866c
Binary files /dev/null and b/packages/terra-clinical-item-view/tests/wdio/__snapshots__/reference/clinical-lowlight-theme/en/chrome_small/item-view-spec/with_a_null_display.png differ
diff --git a/packages/terra-clinical-item-view/tests/wdio/__snapshots__/reference/clinical-lowlight-theme/en/chrome_tiny/item-view-spec/with_a_null_display.png b/packages/terra-clinical-item-view/tests/wdio/__snapshots__/reference/clinical-lowlight-theme/en/chrome_tiny/item-view-spec/with_a_null_display.png
new file mode 100644
index 000000000..fd76f5d31
Binary files /dev/null and b/packages/terra-clinical-item-view/tests/wdio/__snapshots__/reference/clinical-lowlight-theme/en/chrome_tiny/item-view-spec/with_a_null_display.png differ
diff --git a/packages/terra-clinical-item-view/tests/wdio/__snapshots__/reference/orion-fusion-theme/en/chrome_enormous/item-view-spec/with_a_null_display.png b/packages/terra-clinical-item-view/tests/wdio/__snapshots__/reference/orion-fusion-theme/en/chrome_enormous/item-view-spec/with_a_null_display.png
new file mode 100644
index 000000000..969078f92
Binary files /dev/null and b/packages/terra-clinical-item-view/tests/wdio/__snapshots__/reference/orion-fusion-theme/en/chrome_enormous/item-view-spec/with_a_null_display.png differ
diff --git a/packages/terra-clinical-item-view/tests/wdio/__snapshots__/reference/orion-fusion-theme/en/chrome_huge/item-view-spec/with_a_null_display.png b/packages/terra-clinical-item-view/tests/wdio/__snapshots__/reference/orion-fusion-theme/en/chrome_huge/item-view-spec/with_a_null_display.png
new file mode 100644
index 000000000..87796c1a3
Binary files /dev/null and b/packages/terra-clinical-item-view/tests/wdio/__snapshots__/reference/orion-fusion-theme/en/chrome_huge/item-view-spec/with_a_null_display.png differ
diff --git a/packages/terra-clinical-item-view/tests/wdio/__snapshots__/reference/orion-fusion-theme/en/chrome_large/item-view-spec/with_a_null_display.png b/packages/terra-clinical-item-view/tests/wdio/__snapshots__/reference/orion-fusion-theme/en/chrome_large/item-view-spec/with_a_null_display.png
new file mode 100644
index 000000000..0adbaae18
Binary files /dev/null and b/packages/terra-clinical-item-view/tests/wdio/__snapshots__/reference/orion-fusion-theme/en/chrome_large/item-view-spec/with_a_null_display.png differ
diff --git a/packages/terra-clinical-item-view/tests/wdio/__snapshots__/reference/orion-fusion-theme/en/chrome_medium/item-view-spec/with_a_null_display.png b/packages/terra-clinical-item-view/tests/wdio/__snapshots__/reference/orion-fusion-theme/en/chrome_medium/item-view-spec/with_a_null_display.png
new file mode 100644
index 000000000..5fb7a311b
Binary files /dev/null and b/packages/terra-clinical-item-view/tests/wdio/__snapshots__/reference/orion-fusion-theme/en/chrome_medium/item-view-spec/with_a_null_display.png differ
diff --git a/packages/terra-clinical-item-view/tests/wdio/__snapshots__/reference/orion-fusion-theme/en/chrome_small/item-view-spec/with_a_null_display.png b/packages/terra-clinical-item-view/tests/wdio/__snapshots__/reference/orion-fusion-theme/en/chrome_small/item-view-spec/with_a_null_display.png
new file mode 100644
index 000000000..1b322cc91
Binary files /dev/null and b/packages/terra-clinical-item-view/tests/wdio/__snapshots__/reference/orion-fusion-theme/en/chrome_small/item-view-spec/with_a_null_display.png differ
diff --git a/packages/terra-clinical-item-view/tests/wdio/__snapshots__/reference/orion-fusion-theme/en/chrome_tiny/item-view-spec/with_a_null_display.png b/packages/terra-clinical-item-view/tests/wdio/__snapshots__/reference/orion-fusion-theme/en/chrome_tiny/item-view-spec/with_a_null_display.png
new file mode 100644
index 000000000..a877573d9
Binary files /dev/null and b/packages/terra-clinical-item-view/tests/wdio/__snapshots__/reference/orion-fusion-theme/en/chrome_tiny/item-view-spec/with_a_null_display.png differ
diff --git a/packages/terra-clinical-item-view/tests/wdio/__snapshots__/reference/terra-default-theme/en/chrome_enormous/item-view-spec/with_a_null_display.png b/packages/terra-clinical-item-view/tests/wdio/__snapshots__/reference/terra-default-theme/en/chrome_enormous/item-view-spec/with_a_null_display.png
new file mode 100644
index 000000000..cbcafa419
Binary files /dev/null and b/packages/terra-clinical-item-view/tests/wdio/__snapshots__/reference/terra-default-theme/en/chrome_enormous/item-view-spec/with_a_null_display.png differ
diff --git a/packages/terra-clinical-item-view/tests/wdio/__snapshots__/reference/terra-default-theme/en/chrome_huge/item-view-spec/with_a_null_display.png b/packages/terra-clinical-item-view/tests/wdio/__snapshots__/reference/terra-default-theme/en/chrome_huge/item-view-spec/with_a_null_display.png
new file mode 100644
index 000000000..de51f43e4
Binary files /dev/null and b/packages/terra-clinical-item-view/tests/wdio/__snapshots__/reference/terra-default-theme/en/chrome_huge/item-view-spec/with_a_null_display.png differ
diff --git a/packages/terra-clinical-item-view/tests/wdio/__snapshots__/reference/terra-default-theme/en/chrome_large/item-view-spec/with_a_null_display.png b/packages/terra-clinical-item-view/tests/wdio/__snapshots__/reference/terra-default-theme/en/chrome_large/item-view-spec/with_a_null_display.png
new file mode 100644
index 000000000..2f38f1460
Binary files /dev/null and b/packages/terra-clinical-item-view/tests/wdio/__snapshots__/reference/terra-default-theme/en/chrome_large/item-view-spec/with_a_null_display.png differ
diff --git a/packages/terra-clinical-item-view/tests/wdio/__snapshots__/reference/terra-default-theme/en/chrome_medium/item-view-spec/with_a_null_display.png b/packages/terra-clinical-item-view/tests/wdio/__snapshots__/reference/terra-default-theme/en/chrome_medium/item-view-spec/with_a_null_display.png
new file mode 100644
index 000000000..48a64d87b
Binary files /dev/null and b/packages/terra-clinical-item-view/tests/wdio/__snapshots__/reference/terra-default-theme/en/chrome_medium/item-view-spec/with_a_null_display.png differ
diff --git a/packages/terra-clinical-item-view/tests/wdio/__snapshots__/reference/terra-default-theme/en/chrome_small/item-view-spec/with_a_null_display.png b/packages/terra-clinical-item-view/tests/wdio/__snapshots__/reference/terra-default-theme/en/chrome_small/item-view-spec/with_a_null_display.png
new file mode 100644
index 000000000..df05caa19
Binary files /dev/null and b/packages/terra-clinical-item-view/tests/wdio/__snapshots__/reference/terra-default-theme/en/chrome_small/item-view-spec/with_a_null_display.png differ
diff --git a/packages/terra-clinical-item-view/tests/wdio/__snapshots__/reference/terra-default-theme/en/chrome_tiny/item-view-spec/with_a_null_display.png b/packages/terra-clinical-item-view/tests/wdio/__snapshots__/reference/terra-default-theme/en/chrome_tiny/item-view-spec/with_a_null_display.png
new file mode 100644
index 000000000..0aabc2323
Binary files /dev/null and b/packages/terra-clinical-item-view/tests/wdio/__snapshots__/reference/terra-default-theme/en/chrome_tiny/item-view-spec/with_a_null_display.png differ
diff --git a/packages/terra-clinical-item-view/tests/wdio/item-view-spec.js b/packages/terra-clinical-item-view/tests/wdio/item-view-spec.js
index 6f6448f09..8b70f130b 100644
--- a/packages/terra-clinical-item-view/tests/wdio/item-view-spec.js
+++ b/packages/terra-clinical-item-view/tests/wdio/item-view-spec.js
@@ -1,4 +1,10 @@
Terra.describeViewports('Clinical Item View', ['tiny', 'small', 'medium', 'large', 'huge', 'enormous'], () => {
+ it('renders with a null display', () => {
+ browser.url('/raw/tests/terra-clinical-item-view/clinical-item-view/null-item-view');
+
+ Terra.validates.element('with a null display');
+ });
+
it('renders with displays', () => {
browser.url('/raw/tests/terra-clinical-item-view/clinical-item-view/displays-item-view');