Skip to content

Commit

Permalink
Update Curation page to render the flyout
Browse files Browse the repository at this point in the history
  • Loading branch information
cee-chen committed Mar 18, 2021
1 parent a2fc5c5 commit f232aec
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ import { Loading } from '../../../../shared/loading';
jest.mock('./curation_logic', () => ({ CurationLogic: jest.fn() }));
import { CurationLogic } from './curation_logic';

import { AddResultFlyout } from './results';

import { Curation } from './';

describe('Curation', () => {
Expand All @@ -31,6 +33,7 @@ describe('Curation', () => {
const values = {
dataLoading: false,
queries: ['query A', 'query B'],
isFlyoutOpen: false,
};
const actions = {
loadCuration: jest.fn(),
Expand Down Expand Up @@ -60,6 +63,13 @@ describe('Curation', () => {
expect(wrapper.find(Loading)).toHaveLength(1);
});

it('renders the add result flyout when open', () => {
setMockValues({ ...values, isFlyoutOpen: true });
const wrapper = shallow(<Curation {...props} />);

expect(wrapper.find(AddResultFlyout)).toHaveLength(1);
});

it('initializes CurationLogic with a curationId prop from URL param', () => {
(useParams as jest.Mock).mockReturnValueOnce({ curationId: 'hello-world' });
shallow(<Curation {...props} />);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import { MANAGE_CURATION_TITLE, RESTORE_CONFIRMATION } from '../constants';
import { CurationLogic } from './curation_logic';
import { PromotedDocuments, OrganicDocuments, HiddenDocuments } from './documents';
import { ActiveQuerySelect, ManageQueriesModal } from './queries';
import { AddResultLogic, AddResultFlyout } from './results';

interface Props {
curationsBreadcrumb: BreadcrumbTrail;
Expand All @@ -32,6 +33,7 @@ export const Curation: React.FC<Props> = ({ curationsBreadcrumb }) => {
const { curationId } = useParams() as { curationId: string };
const { loadCuration, resetCuration } = useActions(CurationLogic({ curationId }));
const { dataLoading, queries } = useValues(CurationLogic({ curationId }));
const { isFlyoutOpen } = useValues(AddResultLogic);

useEffect(() => {
loadCuration();
Expand Down Expand Up @@ -77,7 +79,7 @@ export const Curation: React.FC<Props> = ({ curationsBreadcrumb }) => {
<EuiSpacer />
<HiddenDocuments />

{/* TODO: AddResult flyout */}
{isFlyoutOpen && <AddResultFlyout />}
</>
);
};

0 comments on commit f232aec

Please sign in to comment.