fix(Popover): incorrect border position in wework (#7702)

* fix(Popover): incorrect border position in wework

* test(Popover): update snapshot
This commit is contained in:
neverland 2020-12-07 20:58:18 +08:00 committed by GitHub
parent e20cef22a6
commit 2e6b032464
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 11 deletions

View File

@ -106,14 +106,14 @@ export default createComponent({
renderAction(action, index) { renderAction(action, index) {
const { icon, text, disabled, className } = action; const { icon, text, disabled, className } = action;
return ( return (
<button <div
type="button" role="menuitem"
class={[bem('action', { disabled, 'with-icon': icon }), className]} class={[bem('action', { disabled, 'with-icon': icon }), className]}
onClick={() => this.onClickAction(action, index)} onClick={() => this.onClickAction(action, index)}
> >
{icon && <Icon name={icon} class={bem('action-icon')} />} {icon && <Icon name={icon} class={bem('action-icon')} />}
<div class={[bem('action-text'), BORDER_BOTTOM]}>{text}</div> <div class={[bem('action-text'), BORDER_BOTTOM]}>{text}</div>
</button> </div>
); );
}, },
@ -187,7 +187,7 @@ export default createComponent({
nativeOnTouchstart={this.onTouchstart} nativeOnTouchstart={this.onTouchstart}
> >
<div class={bem('arrow')} /> <div class={bem('arrow')} />
<div class={bem('content')}> <div class={bem('content')} role="menu">
{this.slots('default') || this.actions.map(this.renderAction)} {this.slots('default') || this.actions.map(this.renderAction)}
</div> </div>
</Popup> </Popup>

View File

@ -34,8 +34,6 @@
padding: 0 @padding-md; padding: 0 @padding-md;
font-size: @popover-action-font-size; font-size: @popover-action-font-size;
line-height: @line-height-md; line-height: @line-height-md;
background-color: transparent;
border: none;
cursor: pointer; cursor: pointer;
&:last-child { &:last-child {

View File

@ -1,9 +1,9 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`should allow to custom the className of action 1`] = ` exports[`should allow to custom the className of action 1`] = `
<button type="button" class="van-popover__action foo"> <div role="menuitem" class="van-popover__action foo">
<div class="van-popover__action-text van-hairline--bottom">Option</div> <div class="van-popover__action-text van-hairline--bottom">Option</div>
</button> </div>
`; `;
exports[`should locate to reference element when showed 1`] = `<!---->`; exports[`should locate to reference element when showed 1`] = `<!---->`;
@ -11,20 +11,20 @@ exports[`should locate to reference element when showed 1`] = `<!---->`;
exports[`should locate to reference element when showed 2`] = ` exports[`should locate to reference element when showed 2`] = `
<div class="van-popup van-popover van-popover--light" name="van-popover-zoom" style="position: absolute; left: 0px; top: 8px; margin: 0px; z-index: 2007;" data-popper-placement="bottom"> <div class="van-popup van-popover van-popover--light" name="van-popover-zoom" style="position: absolute; left: 0px; top: 8px; margin: 0px; z-index: 2007;" data-popper-placement="bottom">
<div class="van-popover__arrow"></div> <div class="van-popover__arrow"></div>
<div class="van-popover__content"></div> <div role="menu" class="van-popover__content"></div>
</div> </div>
`; `;
exports[`should locate to reference element when showed 3`] = ` exports[`should locate to reference element when showed 3`] = `
<div class="van-popup van-popover van-popover--light" name="van-popover-zoom" style="position: absolute; left: 0px; top: 8px; margin: 0px; z-index: 2007; display: none;" data-popper-placement="bottom"> <div class="van-popup van-popover van-popover--light" name="van-popover-zoom" style="position: absolute; left: 0px; top: 8px; margin: 0px; z-index: 2007; display: none;" data-popper-placement="bottom">
<div class="van-popover__arrow"></div> <div class="van-popover__arrow"></div>
<div class="van-popover__content"></div> <div role="menu" class="van-popover__content"></div>
</div> </div>
`; `;
exports[`should watch placement prop and update location 1`] = ` exports[`should watch placement prop and update location 1`] = `
<div class="van-popup van-popover van-popover--light" name="van-popover-zoom" style="z-index: 2008; position: absolute; left: 0px; top: -8px; margin: 0px;" data-popper-placement="top"> <div class="van-popup van-popover van-popover--light" name="van-popover-zoom" style="z-index: 2008; position: absolute; left: 0px; top: -8px; margin: 0px;" data-popper-placement="top">
<div class="van-popover__arrow"></div> <div class="van-popover__arrow"></div>
<div class="van-popover__content"></div> <div role="menu" class="van-popover__content"></div>
</div> </div>
`; `;