mirror of
https://github.com/apache/superset.git
synced 2026-04-17 23:25:05 +00:00
test: Adds tests to the filter scope components (#13887)
This commit is contained in:
committed by
GitHub
parent
3b11654c5a
commit
4602ead10c
@@ -19,8 +19,8 @@
|
||||
/* eslint-disable no-unused-expressions */
|
||||
import React from 'react';
|
||||
import sinon from 'sinon';
|
||||
import { shallow, mount } from 'enzyme';
|
||||
|
||||
import { mount } from 'enzyme';
|
||||
import { ThemeProvider, supersetTheme } from '@superset-ui/core';
|
||||
import CheckboxControl from 'src/explore/components/controls/CheckboxControl';
|
||||
import ControlHeader from 'src/explore/components/ControlHeader';
|
||||
import Checkbox from 'src/components/Checkbox';
|
||||
@@ -36,20 +36,21 @@ describe('CheckboxControl', () => {
|
||||
let wrapper;
|
||||
|
||||
beforeEach(() => {
|
||||
wrapper = shallow(<CheckboxControl {...defaultProps} />);
|
||||
wrapper = mount(
|
||||
<ThemeProvider theme={supersetTheme}>
|
||||
<CheckboxControl {...defaultProps} />
|
||||
</ThemeProvider>,
|
||||
);
|
||||
});
|
||||
|
||||
it('renders a Checkbox', () => {
|
||||
const controlHeader = wrapper.find(ControlHeader);
|
||||
const controlHeader = wrapper.childAt(0).find(ControlHeader);
|
||||
expect(controlHeader).toHaveLength(1);
|
||||
|
||||
const headerWrapper = controlHeader.shallow();
|
||||
expect(headerWrapper.find(Checkbox)).toHaveLength(1);
|
||||
expect(controlHeader.find(Checkbox)).toHaveLength(1);
|
||||
});
|
||||
|
||||
it('Checks the box when the label is clicked', () => {
|
||||
const fullComponent = mount(<CheckboxControl {...defaultProps} />);
|
||||
|
||||
const fullComponent = wrapper.childAt(0);
|
||||
const spy = sinon.spy(fullComponent.instance(), 'onChange');
|
||||
|
||||
fullComponent.instance().forceUpdate();
|
||||
|
||||
Reference in New Issue
Block a user