fix: Explore popovers issues (#11428)

* Fix spaces and comas not working in filter popover

* Fix popup not opening automatically

* Add e2e test

* Remove only from test

* Remove redundant test, add checking label content

* Add comments to e2e test

* Fix unit test

* Use destructuring

* Always open popup for functions and saved metrics, too

* Fix popover for adhoc metrics too

* Small refactor to consistency

* Refactor for consistency

* Remove redundant functions

* Test fix

Co-authored-by: Jesse Yang <jesse.yang@airbnb.com>
This commit is contained in:
Kamil Gabryjelski
2020-10-28 17:38:52 +01:00
committed by GitHub
parent 88e5e9855d
commit b2636f01bb
8 changed files with 120 additions and 112 deletions

View File

@@ -19,7 +19,7 @@
/* eslint-disable no-unused-expressions */
import React from 'react';
import sinon from 'sinon';
import { styledShallow as shallow } from 'spec/helpers/theming';
import { shallow } from 'enzyme';
import Popover from 'src/common/components/Popover';
import Label from 'src/components/Label';
@@ -46,7 +46,7 @@ function setup(overrides) {
datasource: {},
...overrides,
};
const wrapper = shallow(<AdhocFilterOption {...props} />).dive();
const wrapper = shallow(<AdhocFilterOption {...props} />);
return { wrapper };
}

View File

@@ -19,7 +19,7 @@
/* eslint-disable no-unused-expressions */
import React from 'react';
import sinon from 'sinon';
import { styledShallow as shallow } from 'spec/helpers/theming';
import { shallow } from 'enzyme';
import Popover from 'src/common/components/Popover';
import Label from 'src/components/Label';
@@ -46,7 +46,7 @@ function setup(overrides) {
columns,
...overrides,
};
const wrapper = shallow(<AdhocMetricOption {...props} />).dive();
const wrapper = shallow(<AdhocMetricOption {...props} />);
return { wrapper, onMetricEdit };
}
@@ -73,11 +73,13 @@ describe('AdhocMetricOption', () => {
it('returns to default labels when the custom label is cleared', () => {
const { wrapper } = setup();
expect(wrapper.state('title').label).toBe('SUM(value)');
wrapper.instance().onLabelChange({ target: { value: 'new label' } });
expect(wrapper.state('title').label).toBe('new label');
wrapper.instance().onLabelChange({ target: { value: '' } });
// close and open the popover
wrapper.instance().closeMetricEditOverlay();
wrapper.instance().onOverlayEntered();
expect(wrapper.state('title').label).toBe('SUM(value)');
expect(wrapper.state('title').hasCustomLabel).toBe(false);
});