import React , { Fragment } from 'react' ; import { shallow , ShallowWrapper } from 'enzyme' ; import { EuiPageHeaderProps , EuiTab } from '@elastic/eui' ; export const getPageHeader = ( wrapper ) => { const pageHeader = wrapper . prop ( 'pageHeader' ) as EuiPageHeaderProps ; return pageHeader || { } ; } ; export const getPageTitle = ( wrapper ) => { return getPageHeader ( wrapper ) . pageTitle ; } ; export const getPageDescription = ( wrapper ) => { return getPageHeader ( wrapper ) . description ; } ; export const getPageHeaderActions = ( wrapper ) => { const actions = getPageHeader ( wrapper ) . rightSideItems || [ ] ; return shallow ( < div > { actions . map ( ( action , i ) => ( < Fragment key = { i } > { action } < /Fragment>))} < /div>); } ; export const getPageHeaderTabs = ( wrapper ) => { const tabs = getPageHeader ( wrapper ) . tabs || [ ] ; return shallow ( < div > { tabs . map ( ( tabProps , i ) => ( < EuiTab { ... tabProps } key = { i } / > ) ) } < /div>); } ; export const getPageHeaderChildren = ( wrapper ) => { const children = getPageHeader ( wrapper ) . children || null ; return shallow ( < div > { children } < /div>); } ;