Skip to content

Commit

Permalink
fix double flyouts in add panel flow (elastic#65861)
Browse files Browse the repository at this point in the history
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
  • Loading branch information
Dosant and elasticmachine committed May 11, 2020
1 parent f99cc49 commit 01ef406
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*/

import * as React from 'react';
import { EuiFlyout } from '@elastic/eui';
import { AddPanelFlyout } from './add_panel_flyout';
import {
ContactCardEmbeddableFactory,
Expand Down Expand Up @@ -75,6 +76,9 @@ test('createNewEmbeddable() add embeddable to container', async () => {
/>
) as ReactWrapper<unknown, unknown, AddPanelFlyout>;

// https://github.com/elastic/kibana/issues/64789
expect(component.exists(EuiFlyout)).toBe(false);

expect(Object.values(container.getInput().panels).length).toBe(0);
component.instance().createNewEmbeddable(CONTACT_CARD_EMBEDDABLE);
await new Promise(r => setTimeout(r, 1));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,7 @@ import { FormattedMessage } from '@kbn/i18n/react';
import React, { ReactElement } from 'react';
import { CoreSetup } from 'src/core/public';

import {
EuiContextMenuItem,
EuiFlyout,
EuiFlyoutBody,
EuiFlyoutHeader,
EuiTitle,
} from '@elastic/eui';
import { EuiContextMenuItem, EuiFlyoutBody, EuiFlyoutHeader, EuiTitle } from '@elastic/eui';

import { EmbeddableStart } from 'src/plugins/embeddable/public';
import { IContainer } from '../../../../containers';
Expand Down Expand Up @@ -152,7 +146,7 @@ export class AddPanelFlyout extends React.Component<Props, State> {
);

return (
<EuiFlyout ownFocus onClose={this.props.onClose} data-test-subj="dashboardAddPanel">
<>
<EuiFlyoutHeader hasBorder>
<EuiTitle size="m">
<h2>
Expand All @@ -161,7 +155,7 @@ export class AddPanelFlyout extends React.Component<Props, State> {
</EuiTitle>
</EuiFlyoutHeader>
<EuiFlyoutBody>{savedObjectsFinder}</EuiFlyoutBody>
</EuiFlyout>
</>
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ export async function openAddPanelFlyout(options: {
/>
),
{
'data-test-subj': 'addPanelFlyout',
'data-test-subj': 'dashboardAddPanel',
ownFocus: true,
}
);
}

0 comments on commit 01ef406

Please sign in to comment.