Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mbondyra committed Oct 2, 2020
1 parent 1cc3a16 commit 70eda9a
Showing 1 changed file with 10 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ describe('LayerPanel', () => {
groupId: 'a',
accessors: ['newid'],
filterOperations: () => true,
supportsMoreColumns: false,
supportsMoreColumns: true,
dataTestSubj: 'lnsGroup',
enableDimensionEditor: true,
},
Expand All @@ -220,11 +220,14 @@ describe('LayerPanel', () => {
mockVisualization.renderDimensionEditor = jest.fn();

const component = mountWithIntl(<LayerPanel {...getDefaultProps()} />);
act(() => {
component.find('[data-test-subj="lns-empty-dimension"]').first().simulate('click');
});
component.update();

const group = component.find('DimensionContainer');
const panel = mount(group.prop('panel'));

expect(panel.children()).toHaveLength(2);
const group = component.find('DimensionContainer').first();
const panel: React.ReactElement = group.prop('panel');
expect(panel.props.children).toHaveLength(2);
});

it('should keep the DimensionContainer open when configuring a new dimension', () => {
Expand Down Expand Up @@ -263,11 +266,8 @@ describe('LayerPanel', () => {
});

const component = mountWithIntl(<LayerPanel {...getDefaultProps()} />);

const group = component.find('DimensionContainer');
const triggerButton = mountWithIntl(group.prop('trigger'));
act(() => {
triggerButton.find('[data-test-subj="lns-empty-dimension"]').first().simulate('click');
component.find('[data-test-subj="lns-empty-dimension"]').first().simulate('click');
});
component.update();

Expand Down Expand Up @@ -312,10 +312,8 @@ describe('LayerPanel', () => {

const component = mountWithIntl(<LayerPanel {...getDefaultProps()} />);

const group = component.find('DimensionContainer');
const triggerButton = mountWithIntl(group.prop('trigger'));
act(() => {
triggerButton.find('[data-test-subj="lns-empty-dimension"]').first().simulate('click');
component.find('[data-test-subj="lns-empty-dimension"]').first().simulate('click');
});
component.update();
expect(component.find('EuiFlyoutHeader').exists()).toBe(true);
Expand Down

0 comments on commit 70eda9a

Please sign in to comment.