mirror of
https://github.com/apache/superset.git
synced 2026-04-17 23:25:05 +00:00
Clickable checkbox labels (#8534)
* passing onClick prop to header with the existing onChange method. * basic test checking that label click fires the onChange method. * cleaning up stuff caught by linting.
This commit is contained in:
committed by
Maxime Beauchemin
parent
a867d41d2a
commit
1b3e40feac
@@ -19,7 +19,7 @@
|
||||
/* eslint-disable no-unused-expressions */
|
||||
import React from 'react';
|
||||
import sinon from 'sinon';
|
||||
import { shallow } from 'enzyme';
|
||||
import { shallow, mount } from 'enzyme';
|
||||
|
||||
import CheckboxControl from '../../../../src/explore/components/controls/CheckboxControl';
|
||||
import ControlHeader from '../../../../src/explore/components/ControlHeader';
|
||||
@@ -46,4 +46,16 @@ describe('CheckboxControl', () => {
|
||||
const headerWrapper = controlHeader.shallow();
|
||||
expect(headerWrapper.find(Checkbox)).toHaveLength(1);
|
||||
});
|
||||
|
||||
it('Checks the box when the label is clicked', () => {
|
||||
const fullComponent = mount(<CheckboxControl {...defaultProps} />);
|
||||
|
||||
const spy = sinon.spy(fullComponent.instance(), 'onChange');
|
||||
|
||||
fullComponent.instance().forceUpdate();
|
||||
|
||||
fullComponent.find('label span').last().simulate('click');
|
||||
|
||||
expect(spy.calledOnce).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user