fix(GridItem): click area (#4518)

This commit is contained in:
neverland 2019-09-20 20:26:21 +08:00 committed by GitHub
parent 8cd2efe354
commit 2d04b23671
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View File

@ -82,7 +82,7 @@ export default createComponent({
const { center, border, square, gutter, clickable } = this.parent; const { center, border, square, gutter, clickable } = this.parent;
return ( return (
<div class={[bem({ square })]} style={this.style} onClick={this.onClick}> <div class={[bem({ square })]} style={this.style}>
<div <div
style={this.contentStyle} style={this.contentStyle}
role={clickable ? 'button' : null} role={clickable ? 'button' : null}
@ -96,6 +96,7 @@ export default createComponent({
}), }),
{ [BORDER]: border } { [BORDER]: border }
]} ]}
onClick={this.onClick}
> >
{this.renderContent()} {this.renderContent()}
</div> </div>

View File

@ -19,7 +19,7 @@ test('click grid item', () => {
} }
}); });
const Item = wrapper.find('.van-grid-item'); const Item = wrapper.find('.van-grid-item__content');
Item.trigger('click'); Item.trigger('click');
expect(onClick).toHaveBeenCalledTimes(1); expect(onClick).toHaveBeenCalledTimes(1);