chore: TypeScript <Label /> (#10494)

* chore: TypeScript <Label />

* rebase

* chore: TypeScript <Label />

* rebase

* A bunch o' test fixes. One more to go!

* helper for mountying Emotional components with Enzyme

* asf license

* fixed last test, some linting

* improve the storybook

* Adressing comments

Co-authored-by: Evan Rusackas <evan@preset.io>
This commit is contained in:
Maxime Beauchemin
2020-08-06 22:33:07 -07:00
committed by GitHub
parent 96b9ba3364
commit 0bad77f0fe
33 changed files with 328 additions and 106 deletions

View File

@@ -20,8 +20,9 @@
import React from 'react';
import sinon from 'sinon';
import { shallow } from 'enzyme';
import { Label, OverlayTrigger } from 'react-bootstrap';
import { OverlayTrigger } from 'react-bootstrap';
import Label from 'src/components/Label';
import AdhocFilter, {
EXPRESSION_TYPES,
CLAUSES,

View File

@@ -20,8 +20,9 @@
import React from 'react';
import sinon from 'sinon';
import { shallow } from 'enzyme';
import { Label, OverlayTrigger } from 'react-bootstrap';
import { OverlayTrigger } from 'react-bootstrap';
import Label from 'src/components/Label';
import AdhocMetric from 'src/explore/AdhocMetric';
import AdhocMetricOption from 'src/explore/components/AdhocMetricOption';
import { AGGREGATES } from 'src/explore/constants';

View File

@@ -19,9 +19,10 @@
/* eslint-disable no-unused-expressions */
import React from 'react';
import sinon from 'sinon';
import { mount } from 'enzyme';
import { Button, Label } from 'react-bootstrap';
import { styledMount as mount } from 'spec/helpers/theming';
import { Button } from 'react-bootstrap';
import Label from 'src/components/Label';
import DateFilterControl from 'src/explore/components/controls/DateFilterControl';
import ControlHeader from 'src/explore/components/ControlHeader';

View File

@@ -18,8 +18,8 @@
*/
import React from 'react';
import { shallow } from 'enzyme';
import { Label } from 'react-bootstrap';
import Label from 'src/components/Label';
import TooltipWrapper from 'src/components/TooltipWrapper';
import RowCountLabel from 'src/explore/components/RowCountLabel';

View File

@@ -18,9 +18,10 @@
*/
/* eslint-disable no-unused-expressions */
import React from 'react';
import { shallow } from 'enzyme';
import { OverlayTrigger, Label } from 'react-bootstrap';
import { styledMount as mount } from 'spec/helpers/theming';
import { OverlayTrigger } from 'react-bootstrap';
import Label from 'src/components/Label';
import ViewportControl from 'src/explore/components/controls/ViewportControl';
import TextControl from 'src/explore/components/controls/TextControl';
import ControlHeader from 'src/explore/components/ControlHeader';
@@ -33,13 +34,14 @@ const defaultProps = {
bearing: 0,
pitch: 0,
},
name: 'foo',
};
describe('ViewportControl', () => {
let wrapper;
let inst;
beforeEach(() => {
wrapper = shallow(<ViewportControl {...defaultProps} />);
wrapper = mount(<ViewportControl {...defaultProps} />);
inst = wrapper.instance();
});
@@ -50,13 +52,12 @@ describe('ViewportControl', () => {
});
it('renders a Popover with 5 TextControl', () => {
const popOver = shallow(inst.renderPopover());
const popOver = mount(inst.renderPopover());
expect(popOver.find(TextControl)).toHaveLength(5);
});
it('renders a summary in the label', () => {
expect(wrapper.find(Label).first().render().text()).toBe(
'6° 51\' 8.50" | 31° 13\' 21.56"',
);
const label = wrapper.find(Label).first();
expect(label.render().text()).toBe('6° 51\' 8.50" | 31° 13\' 21.56"');
});
});