diff --git a/packages/module/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithSources.tsx b/packages/module/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithSources.tsx index 5038e614..26502ed7 100644 --- a/packages/module/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithSources.tsx +++ b/packages/module/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithSources.tsx @@ -78,6 +78,37 @@ export const MessageWithSourcesExample: FunctionComponent = () => { ] }} /> + Documentation + }, + { + title: 'Azure Red Hat OpenShift documentation', + link: '#', + body: 'Microsoft Azure Red Hat OpenShift allows you to deploy a production ready Red Hat OpenShift cluster in Azure ...', + isExternal: true, + headerContent: + }, + { + title: 'OKD Documentation: Home', + link: '#', + body: 'OKD is a distribution of Kubernetes optimized for continuous application development and multi-tenant deployment. OKD also serves as the upstream code base upon ...', + isExternal: true, + headerContent: + } + ], + onSetPage + }} + /> { screen.getByRole('button', { name: /Go to next page/i }); }); + it('should render headerContent above the title', () => { + render( + Dessert + } + ]} + /> + ); + expect(screen.getByText('Dessert')).toBeTruthy(); + expect(screen.getByText('How to make an apple pie')).toBeTruthy(); + }); + it('should render with wrap layout when layout is set to wrap', () => { render( { expect(screen.getByRole('link', { name: /How to make an apple pie/i })).toHaveClass('test'); }); + it('should render headerContent above the title', () => { + render( + Dessert + } + ]} + /> + ); + expect(screen.getByText('Dessert')).toBeTruthy(); + expect(screen.getByText('How to make an apple pie')).toBeTruthy(); + }); + + it('should update headerContent when navigating between sources', async () => { + render( + Dessert + }, + { + title: 'How to make cookies', + link: '', + headerContent: Snack + } + ]} + /> + ); + expect(screen.getByText('Dessert')).toBeTruthy(); + expect(screen.queryByText('Snack')).toBeFalsy(); + await userEvent.click(screen.getByRole('button', { name: /Go to next page/i })); + expect(screen.queryByText('Dessert')).toBeFalsy(); + expect(screen.getByText('Snack')).toBeTruthy(); + }); + + it('should render headerContent when using wrap layout', () => { + render( + Dessert + }, + { + title: 'How to make cookies', + link: '', + headerContent: Snack + } + ]} + /> + ); + expect(screen.getByText('Dessert')).toBeTruthy(); + expect(screen.getByText('Snack')).toBeTruthy(); + }); + it('should render with wrap layout when layout prop is set to wrap', () => { render( = ({ > + {source.headerContent && ( +
{source.headerContent}
+ )}