From b7360c3303545fa0b72b45bffeab15e2d75bdf04 Mon Sep 17 00:00:00 2001 From: Fabiano Brito Date: Mon, 24 Dec 2018 12:10:16 -0200 Subject: [PATCH 01/14] fix(Checkbox): Let click handler call onClick to avoid duplicate calls (#3348) --- src/modules/Checkbox/Checkbox.js | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/src/modules/Checkbox/Checkbox.js b/src/modules/Checkbox/Checkbox.js index 778dee9c12..c99a3f94c1 100644 --- a/src/modules/Checkbox/Checkbox.js +++ b/src/modules/Checkbox/Checkbox.js @@ -144,29 +144,33 @@ export default class Checkbox extends Component { handleChange = (e, fromMouseUp) => { debug('handleChange()') const { id } = this.props - const { checked, indeterminate } = this.state + const { checked } = this.state if (!this.canToggle()) return if (fromMouseUp && !_.isNil(id)) return - _.invoke(this.props, 'onClick', e, { + _.invoke(this.props, 'onChange', e, { ...this.props, checked: !checked, - indeterminate: !!indeterminate, + indeterminate: false, }) - _.invoke(this.props, 'onChange', e, { ...this.props, checked: !checked, indeterminate: false }) this.trySetState({ checked: !checked, indeterminate: false }) } handleClick = (e) => { - // We handle onClick in onChange if it is provided, to preserve proper call order. - // Don't call onClick twice if their is already an onChange handler, it calls onClick. - // https://github.com/Semantic-Org/Semantic-UI-React/pull/2748 - const { onChange, onClick } = this.props - if (onChange || !onClick) return + debug('handleClick()') + const { id } = this.props + const { checked, indeterminate } = this.state - onClick(e, this.props) + if (!this.canToggle()) return + if (!_.isNil(id)) return + + _.invoke(this.props, 'onClick', e, { + ...this.props, + checked: !checked, + indeterminate: !!indeterminate, + }) } handleMouseDown = (e) => { From 4161c4128506414211773614e529849a6a7e99cc Mon Sep 17 00:00:00 2001 From: Fabiano Brito Date: Mon, 24 Dec 2018 12:11:41 -0200 Subject: [PATCH 02/14] fix(Checkbox): Fix test to call onClick from a click event (#3348) --- test/specs/modules/Checkbox/Checkbox-test.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/specs/modules/Checkbox/Checkbox-test.js b/test/specs/modules/Checkbox/Checkbox-test.js index 32981670e7..e1b6c38376 100644 --- a/test/specs/modules/Checkbox/Checkbox-test.js +++ b/test/specs/modules/Checkbox/Checkbox-test.js @@ -239,10 +239,10 @@ describe('Checkbox', () => { }) describe('onClick', () => { - it('is called with (event, data) on mouse up', () => { + it('is called with (event, data) on click', () => { const onClick = sandbox.spy() const props = { name: 'foo', value: 'bar', checked: false, indeterminate: true } - mount().simulate('mouseup') + mount().simulate('click') onClick.should.have.been.calledOnce() onClick.should.have.been.calledWithMatch( From 2d88857960ce08e766c7f2dd4052ddb4c35e9bde Mon Sep 17 00:00:00 2001 From: Fabiano Brito Date: Mon, 24 Dec 2018 14:49:45 -0200 Subject: [PATCH 03/14] fix(Checkbox): Move onClick call completely to handleChange (#3348). --- src/modules/Checkbox/Checkbox.js | 23 +++++++++----------- test/specs/modules/Checkbox/Checkbox-test.js | 4 ++-- 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/src/modules/Checkbox/Checkbox.js b/src/modules/Checkbox/Checkbox.js index c99a3f94c1..a8d7dd4df6 100644 --- a/src/modules/Checkbox/Checkbox.js +++ b/src/modules/Checkbox/Checkbox.js @@ -143,12 +143,18 @@ export default class Checkbox extends Component { handleChange = (e, fromMouseUp) => { debug('handleChange()') - const { id } = this.props + const { id, indeterminate } = this.props const { checked } = this.state if (!this.canToggle()) return if (fromMouseUp && !_.isNil(id)) return + _.invoke(this.props, 'onClick', e, { + ...this.props, + checked: !checked, + indeterminate: !!indeterminate, + }) + _.invoke(this.props, 'onChange', e, { ...this.props, checked: !checked, @@ -158,19 +164,10 @@ export default class Checkbox extends Component { this.trySetState({ checked: !checked, indeterminate: false }) } - handleClick = (e) => { + handleClick = () => { debug('handleClick()') - const { id } = this.props - const { checked, indeterminate } = this.state - - if (!this.canToggle()) return - if (!_.isNil(id)) return - - _.invoke(this.props, 'onClick', e, { - ...this.props, - checked: !checked, - indeterminate: !!indeterminate, - }) + // handleClick is left empty because it's already called within handleChange, and also + // to avoid duplicate calls matching all DOM Checkbox comparisons. } handleMouseDown = (e) => { diff --git a/test/specs/modules/Checkbox/Checkbox-test.js b/test/specs/modules/Checkbox/Checkbox-test.js index e1b6c38376..e7045a6956 100644 --- a/test/specs/modules/Checkbox/Checkbox-test.js +++ b/test/specs/modules/Checkbox/Checkbox-test.js @@ -239,10 +239,10 @@ describe('Checkbox', () => { }) describe('onClick', () => { - it('is called with (event, data) on click', () => { + it('is called with (event, data) on mouseup', () => { const onClick = sandbox.spy() const props = { name: 'foo', value: 'bar', checked: false, indeterminate: true } - mount().simulate('click') + mount().simulate('mouseup') onClick.should.have.been.calledOnce() onClick.should.have.been.calledWithMatch( From c9f0d1becaba09b074239621f4c57fb73ca1df1e Mon Sep 17 00:00:00 2001 From: Fabiano Brito Date: Wed, 26 Dec 2018 16:57:24 -0200 Subject: [PATCH 04/14] fix(Checkbox): Create tests for DOM Comparisons (#3348). --- test/specs/modules/Checkbox/Checkbox-test.js | 47 +++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) diff --git a/test/specs/modules/Checkbox/Checkbox-test.js b/test/specs/modules/Checkbox/Checkbox-test.js index e7045a6956..9310b91504 100644 --- a/test/specs/modules/Checkbox/Checkbox-test.js +++ b/test/specs/modules/Checkbox/Checkbox-test.js @@ -23,7 +23,8 @@ const wrapperMount = (element, opts) => { const wrapperShallow = (...args) => (wrapper = shallow(...args)) describe('Checkbox', () => { - common.isConformant(Checkbox) + // TODO: check how to deal with the empty handler `handleClick` + // common.isConformant(Checkbox) common.hasUIClassName(Checkbox) common.propKeyOnlyToClassName(Checkbox, 'checked') @@ -298,6 +299,50 @@ describe('Checkbox', () => { }) }) + describe('DOM Comparisons', () => { + let onClick = sandbox.spy() + let onChange = sandbox.spy() + let props = {} + let comparisonAssertion + + beforeEach(() => { + onClick = sandbox.spy() + onChange = sandbox.spy() + props = { onClick, onChange, checked: false } + comparisonAssertion = () => { + onClick.should.have.been.calledOnce() + onClick.should.have.been.calledWithMatch({}, { checked: true }) + + onChange.should.have.been.calledOnce() + onChange.should.have.been.calledWithMatch({}, { checked: true }) + } + }) + + it('matches behavior on input change', () => { + wrapperMount() + wrapper.find('input').simulate('change') + comparisonAssertion() + }) + + it('matches behavior on label change', () => { + wrapperMount() + wrapper.find('label').simulate('change') + comparisonAssertion() + }) + + it('matches behavior on input change with "id"', () => { + wrapperMount() + wrapper.find('input').simulate('change') + comparisonAssertion() + }) + + it('matches behavior on label change with "id"', () => { + wrapperMount() + wrapper.find('label').simulate('change') + comparisonAssertion() + }) + }) + describe('readOnly', () => { it('cannot be checked', () => { wrapperShallow() From 5919bfe83646fa3fc9d2e76e1b306d55785f96ef Mon Sep 17 00:00:00 2001 From: Oleksandr Fediashov Date: Thu, 3 Jan 2019 17:22:04 +0200 Subject: [PATCH 05/14] revert change --- src/modules/Checkbox/Checkbox.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/modules/Checkbox/Checkbox.js b/src/modules/Checkbox/Checkbox.js index a8d7dd4df6..5758ace20b 100644 --- a/src/modules/Checkbox/Checkbox.js +++ b/src/modules/Checkbox/Checkbox.js @@ -143,8 +143,8 @@ export default class Checkbox extends Component { handleChange = (e, fromMouseUp) => { debug('handleChange()') - const { id, indeterminate } = this.props - const { checked } = this.state + const { id } = this.props + const { checked, indeterminate } = this.state if (!this.canToggle()) return if (fromMouseUp && !_.isNil(id)) return @@ -154,7 +154,6 @@ export default class Checkbox extends Component { checked: !checked, indeterminate: !!indeterminate, }) - _.invoke(this.props, 'onChange', e, { ...this.props, checked: !checked, From 0ef94c172c9de6a32f56026b2d6b51621544a087 Mon Sep 17 00:00:00 2001 From: Oleksandr Fediashov Date: Thu, 3 Jan 2019 17:23:17 +0200 Subject: [PATCH 06/14] Update Checkbox-test.js --- test/specs/modules/Checkbox/Checkbox-test.js | 92 ++++++++++---------- 1 file changed, 48 insertions(+), 44 deletions(-) diff --git a/test/specs/modules/Checkbox/Checkbox-test.js b/test/specs/modules/Checkbox/Checkbox-test.js index 9310b91504..e51a2199bb 100644 --- a/test/specs/modules/Checkbox/Checkbox-test.js +++ b/test/specs/modules/Checkbox/Checkbox-test.js @@ -299,50 +299,6 @@ describe('Checkbox', () => { }) }) - describe('DOM Comparisons', () => { - let onClick = sandbox.spy() - let onChange = sandbox.spy() - let props = {} - let comparisonAssertion - - beforeEach(() => { - onClick = sandbox.spy() - onChange = sandbox.spy() - props = { onClick, onChange, checked: false } - comparisonAssertion = () => { - onClick.should.have.been.calledOnce() - onClick.should.have.been.calledWithMatch({}, { checked: true }) - - onChange.should.have.been.calledOnce() - onChange.should.have.been.calledWithMatch({}, { checked: true }) - } - }) - - it('matches behavior on input change', () => { - wrapperMount() - wrapper.find('input').simulate('change') - comparisonAssertion() - }) - - it('matches behavior on label change', () => { - wrapperMount() - wrapper.find('label').simulate('change') - comparisonAssertion() - }) - - it('matches behavior on input change with "id"', () => { - wrapperMount() - wrapper.find('input').simulate('change') - comparisonAssertion() - }) - - it('matches behavior on label change with "id"', () => { - wrapperMount() - wrapper.find('label').simulate('change') - comparisonAssertion() - }) - }) - describe('readOnly', () => { it('cannot be checked', () => { wrapperShallow() @@ -397,4 +353,52 @@ describe('Checkbox', () => { .should.have.prop('type', 'radio') }) }) + + describe('comparisons with native DOM', () => { + const assertMatrix = [ + { + description: 'click on label: fires on mouse up', + event: 'mouseup', + target: 'label', + }, + { + description: 'key on input: fires on space key', + event: 'click', + target: 'input', + }, + + { + description: 'click on label: fires on mouse click', + event: 'click', + target: 'label', + id: 'foo', + }, + ] + + assertMatrix.forEach(({ description, event, target, ...props }) => { + it(description, () => { + const dataId = _.uniqueId('checkbox') + const selector = `[data-id=${dataId}] ${target}` + + const onClick = sandbox.spy() + const onChange = sandbox.spy() + + wrapperMount( + , + { attachTo }, + ) + domEvent.fire(document.querySelector(selector), event) + + onClick.should.have.been.calledOnce() + onChange.should.have.been.calledOnce() + + onChange.should.have.been.calledAfter(onClick) + }) + }) + }) }) From 4683ade9c34c531af1118d6872532efe8e6da420 Mon Sep 17 00:00:00 2001 From: Oleksandr Fediashov Date: Thu, 3 Jan 2019 17:23:46 +0200 Subject: [PATCH 07/14] Update Checkbox-test.js --- test/specs/modules/Checkbox/Checkbox-test.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/specs/modules/Checkbox/Checkbox-test.js b/test/specs/modules/Checkbox/Checkbox-test.js index e51a2199bb..53d0099b7b 100644 --- a/test/specs/modules/Checkbox/Checkbox-test.js +++ b/test/specs/modules/Checkbox/Checkbox-test.js @@ -23,8 +23,9 @@ const wrapperMount = (element, opts) => { const wrapperShallow = (...args) => (wrapper = shallow(...args)) describe('Checkbox', () => { - // TODO: check how to deal with the empty handler `handleClick` - // common.isConformant(Checkbox) + common.isConformant(Checkbox, { + disabledHandlers: ['onClick'], + }) common.hasUIClassName(Checkbox) common.propKeyOnlyToClassName(Checkbox, 'checked') From a028ed71ed6e1238956e68325a5a7ee5c5222919 Mon Sep 17 00:00:00 2001 From: Oleksandr Fediashov Date: Thu, 3 Jan 2019 17:25:17 +0200 Subject: [PATCH 08/14] Update isConformant.js --- test/specs/commonTests/isConformant.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/specs/commonTests/isConformant.js b/test/specs/commonTests/isConformant.js index 2218e4c622..386dcea032 100644 --- a/test/specs/commonTests/isConformant.js +++ b/test/specs/commonTests/isConformant.js @@ -13,6 +13,7 @@ import hasValidTypings from './hasValidTypings' * Assert Component conforms to guidelines that are applicable to all components. * @param {React.Component|Function} Component A component that should conform. * @param {Object} [options={}] + * @param {String[]} [options.disabledHandlers=[]] An array of listeners that are disabled. * @param {Object} [options.eventTargets={}] Map of events and the child component to target. * @param {Number} [options.nestingLevel=0] The nesting level of the component. * @param {boolean} [options.rendersChildren=false] Does this component render any children? @@ -22,6 +23,7 @@ import hasValidTypings from './hasValidTypings' */ export default (Component, options = {}) => { const { + disabledHandlers = [], eventTargets = {}, nestingLevel = 0, requiredProps = {}, @@ -218,7 +220,7 @@ export default (Component, options = {}) => { // This test catches the case where a developer forgot to call the event prop // after handling it internally. It also catch cases where the synthetic event was not passed back. _.each(syntheticEvent.types, ({ eventShape, listeners }) => { - _.each(listeners, (listenerName) => { + _.each(_.without(listeners, ...disabledHandlers), (listenerName) => { // onKeyDown => keyDown const eventName = _.camelCase(listenerName.replace('on', '')) From 6cf3eb1043b791f5f40da72945f103cf92766ba2 Mon Sep 17 00:00:00 2001 From: Fabiano Brito Date: Thu, 3 Jan 2019 14:29:34 -0200 Subject: [PATCH 09/14] fix(Checkbox): Fix typo in handleClick comment (#3348). --- src/modules/Checkbox/Checkbox.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/Checkbox/Checkbox.js b/src/modules/Checkbox/Checkbox.js index 5758ace20b..a9555a1618 100644 --- a/src/modules/Checkbox/Checkbox.js +++ b/src/modules/Checkbox/Checkbox.js @@ -165,8 +165,8 @@ export default class Checkbox extends Component { handleClick = () => { debug('handleClick()') - // handleClick is left empty because it's already called within handleChange, and also - // to avoid duplicate calls matching all DOM Checkbox comparisons. + // handleClick is left empty because it's already called within handleChange, + // and also to avoid duplicate calls, matching all DOM Checkbox comparisons. } handleMouseDown = (e) => { From 37be6cdf483d4c642a46be6999b69ef68d57ad8f Mon Sep 17 00:00:00 2001 From: Fabiano Brito Date: Thu, 3 Jan 2019 14:30:02 -0200 Subject: [PATCH 10/14] fix(Checkbox): Add tests for controlled component with setState as function (#3348). --- test/specs/modules/Checkbox/Checkbox-test.js | 38 ++++++++++++++++---- 1 file changed, 31 insertions(+), 7 deletions(-) diff --git a/test/specs/modules/Checkbox/Checkbox-test.js b/test/specs/modules/Checkbox/Checkbox-test.js index 53d0099b7b..363a372a69 100644 --- a/test/specs/modules/Checkbox/Checkbox-test.js +++ b/test/specs/modules/Checkbox/Checkbox-test.js @@ -256,7 +256,7 @@ describe('Checkbox', () => { ) }) - it('is not called when on change when "id" is passed', () => { + it('is not called when "id" is passed', () => { const onClick = sandbox.spy() mount().simulate('mouseup') @@ -385,12 +385,7 @@ describe('Checkbox', () => { const onChange = sandbox.spy() wrapperMount( - , + , { attachTo }, ) domEvent.fire(document.querySelector(selector), event) @@ -402,4 +397,33 @@ describe('Checkbox', () => { }) }) }) + + describe('Controlled component', () => { + class ControlledCheckbox extends React.Component { + state = { checked: false } + toggle = () => this.setState(prevState => ({ checked: !prevState.checked })) + render() { + return ( + + ) + } + } + + it('toggles state on "change" with "setState" as function', () => { + wrapperShallow() + wrapper.find('Checkbox').simulate('change') + wrapper.state().should.eql({ checked: true }) + }) + + it('toggles state on "click" with "setState" as function', () => { + wrapperShallow() + wrapper.find('Checkbox').simulate('click') + wrapper.state().should.eql({ checked: true }) + }) + }) }) From 91f259d98c60e08599aafc2f42592ffb8b3c2a26 Mon Sep 17 00:00:00 2001 From: Levi Thomason Date: Thu, 3 Jan 2019 09:58:45 -0800 Subject: [PATCH 11/14] fix(Checkbox): ensure onClick is called --- src/modules/Checkbox/Checkbox.js | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/src/modules/Checkbox/Checkbox.js b/src/modules/Checkbox/Checkbox.js index a9555a1618..fb78f8a8e1 100644 --- a/src/modules/Checkbox/Checkbox.js +++ b/src/modules/Checkbox/Checkbox.js @@ -163,10 +163,28 @@ export default class Checkbox extends Component { this.trySetState({ checked: !checked, indeterminate: false }) } - handleClick = () => { + handleClick = (e) => { + const { onChange } = this.props + const { checked, indeterminate } = this.state + + // https://github.com/Semantic-Org/Semantic-UI-React/pull/3351 + // + // We need to avoid duplicate calls to onClick. + // We need to handle clicks on the root and bubble clicks from the label and input. + // The order of the events needs to match that of a vanilla DOM checkbox. + // + // The browser calls onClick AFTER onChange since onClick is on the root element. + // Because of this, we call onClick in handleChange to preserve the correct order. + // In that case, we skip calls to onClick here to avoid duplicate calls. + if (onChange) return + debug('handleClick()') - // handleClick is left empty because it's already called within handleChange, - // and also to avoid duplicate calls, matching all DOM Checkbox comparisons. + + _.invoke(this.props, 'onClick', e, { + ...this.props, + checked: !checked, + indeterminate: !!indeterminate, + }) } handleMouseDown = (e) => { From 6f80c21ed442268dc63fe0de5917bde83604c226 Mon Sep 17 00:00:00 2001 From: Fabiano Brito Date: Thu, 3 Jan 2019 16:35:24 -0200 Subject: [PATCH 12/14] fix(Checkbox): Fire DOM event on controlled component tests to emulate the real behavior (#3348). --- test/specs/modules/Checkbox/Checkbox-test.js | 31 +++++++++----------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/test/specs/modules/Checkbox/Checkbox-test.js b/test/specs/modules/Checkbox/Checkbox-test.js index 363a372a69..907e9820d8 100644 --- a/test/specs/modules/Checkbox/Checkbox-test.js +++ b/test/specs/modules/Checkbox/Checkbox-test.js @@ -399,30 +399,27 @@ describe('Checkbox', () => { }) describe('Controlled component', () => { - class ControlledCheckbox extends React.Component { - state = { checked: false } - toggle = () => this.setState(prevState => ({ checked: !prevState.checked })) - render() { - return ( - - ) + const getControlledCheckbox = isOnClick => + class ControlledCheckbox extends React.Component { + state = { checked: false } + toggle = () => this.setState(prevState => ({ checked: !prevState.checked })) + render() { + const handler = isOnClick ? { onClick: this.toggle } : { onChange: this.toggle } + return + } } - } it('toggles state on "change" with "setState" as function', () => { - wrapperShallow() - wrapper.find('Checkbox').simulate('change') + const ControlledCheckbox = getControlledCheckbox(false) + wrapperMount() + domEvent.fire(document.querySelector('input'), 'click') wrapper.state().should.eql({ checked: true }) }) it('toggles state on "click" with "setState" as function', () => { - wrapperShallow() - wrapper.find('Checkbox').simulate('click') + const ControlledCheckbox = getControlledCheckbox(true) + wrapperMount() + domEvent.fire(document.querySelector('input'), 'click') wrapper.state().should.eql({ checked: true }) }) }) From 9e5a7aa47fbbe807a70442d95f5096053c6c96ac Mon Sep 17 00:00:00 2001 From: Fabiano Brito Date: Fri, 4 Jan 2019 09:31:10 -0200 Subject: [PATCH 13/14] fix(Checkbox): Completely remove click handler (#3348). --- src/modules/Checkbox/Checkbox.js | 27 ++------------------------- 1 file changed, 2 insertions(+), 25 deletions(-) diff --git a/src/modules/Checkbox/Checkbox.js b/src/modules/Checkbox/Checkbox.js index fb78f8a8e1..468db39df8 100644 --- a/src/modules/Checkbox/Checkbox.js +++ b/src/modules/Checkbox/Checkbox.js @@ -149,6 +149,8 @@ export default class Checkbox extends Component { if (!this.canToggle()) return if (fromMouseUp && !_.isNil(id)) return + // We don't have a separate click handler as it's already called in here, + // and also to avoid duplicate calls, matching all DOM Checkbox comparisons. _.invoke(this.props, 'onClick', e, { ...this.props, checked: !checked, @@ -163,30 +165,6 @@ export default class Checkbox extends Component { this.trySetState({ checked: !checked, indeterminate: false }) } - handleClick = (e) => { - const { onChange } = this.props - const { checked, indeterminate } = this.state - - // https://github.com/Semantic-Org/Semantic-UI-React/pull/3351 - // - // We need to avoid duplicate calls to onClick. - // We need to handle clicks on the root and bubble clicks from the label and input. - // The order of the events needs to match that of a vanilla DOM checkbox. - // - // The browser calls onClick AFTER onChange since onClick is on the root element. - // Because of this, we call onClick in handleChange to preserve the correct order. - // In that case, we skip calls to onClick here to avoid duplicate calls. - if (onChange) return - - debug('handleClick()') - - _.invoke(this.props, 'onClick', e, { - ...this.props, - checked: !checked, - indeterminate: !!indeterminate, - }) - } - handleMouseDown = (e) => { debug('handleMouseDown()') const { checked, indeterminate } = this.state @@ -262,7 +240,6 @@ export default class Checkbox extends Component { {...rest} className={classes} onChange={this.handleChange} - onClick={this.handleClick} onMouseDown={this.handleMouseDown} onMouseUp={this.handleMouseUp} > From a5a76efb5e8a19d085978b364352a9c1ec9a1294 Mon Sep 17 00:00:00 2001 From: Oleksandr Fediashov Date: Wed, 16 Jan 2019 20:19:10 +0100 Subject: [PATCH 14/14] small cleanup --- test/specs/modules/Checkbox/Checkbox-test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/specs/modules/Checkbox/Checkbox-test.js b/test/specs/modules/Checkbox/Checkbox-test.js index 907e9820d8..075a3acc3f 100644 --- a/test/specs/modules/Checkbox/Checkbox-test.js +++ b/test/specs/modules/Checkbox/Checkbox-test.js @@ -388,7 +388,7 @@ describe('Checkbox', () => { , { attachTo }, ) - domEvent.fire(document.querySelector(selector), event) + domEvent.fire(selector, event) onClick.should.have.been.calledOnce() onChange.should.have.been.calledOnce()