Skip to content

Commit

Permalink
fix: event can not be triggered when it has stopped propagation in Vu…
Browse files Browse the repository at this point in the history
…e/React/Angular, close #353
  • Loading branch information
Javey committed Nov 25, 2019
1 parent ffc66f7 commit 170b95e
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 21 deletions.
31 changes: 31 additions & 0 deletions components/button/index.react.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import React from 'react';
import ReactDOM from 'react-dom';
import {mount, unmount, dispatchEvent} from '../../test/utils';
import {Button} from 'kpc/components/button';

describe('Button', () => {
let container;

beforeEach(() => {
container = document.createElement('div');
document.body.appendChild(container);
});

afterEach(() => {
document.body.removeChild(container);
});

it('should trigger click even it is stopped propagation', () => {
const click = sinon.spy(() => console.log('click'));
ReactDOM.render(
<div onClick={e => e.stopPropagation()}>
<Button onClick={click}>Click</Button>
</div>,
container
);

const button = container.querySelector('button');
dispatchEvent(button, 'click');
expect(click.callCount).to.eql(1);
});
});
18 changes: 9 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,9 @@
"dayjs": "^1.8.15",
"downloadjs": "^1.4.7",
"enquire.js": "^2.1.6",
"intact": "^2.5.8",
"intact-react": "^1.1.22",
"intact-vue": "^0.5.1",
"intact": "^2.5.9",
"intact-react": "^1.1.23",
"intact-vue": "^0.5.2",
"monaco-editor": "^0.17.0",
"resize-observer-polyfill": "^1.5.0",
"tinycolor2": "^1.4.1"
Expand Down
14 changes: 7 additions & 7 deletions packages/kpc-angular/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions packages/kpc-angular/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
"dayjs": "^1.8.15",
"downloadjs": "^1.4.7",
"enquire.js": "^2.1.6",
"intact": "^2.5.6",
"intact-angular": "^0.1.1",
"intact": "^2.5.9",
"intact-angular": "^0.1.2",
"monaco-editor": "^0.17.0",
"resize-observer-polyfill": "^1.5.0",
"tslib": "^1.10.0"
Expand Down

0 comments on commit 170b95e

Please sign in to comment.