test(Popover): improve snapshot (#8713)

This commit is contained in:
neverland 2021-05-17 10:00:12 +08:00 committed by GitHub
parent 908210a225
commit c0fa715cf4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 24 additions and 4 deletions

View File

@ -72,6 +72,7 @@ export default defineComponent({
show: Boolean,
overlay: Boolean,
duration: [Number, String],
iconPrefix: String,
overlayClass: unknownProp,
overlayStyle: Object as PropType<CSSProperties>,
closeOnClickAction: truthProp,
@ -101,7 +102,6 @@ export default defineComponent({
type: [String, Object] as PropType<TeleportProps['to']>,
default: 'body',
},
iconPrefix: String,
},
emits: ['select', 'touchstart', 'update:show'],

View File

@ -224,7 +224,7 @@ export default {
| close-on-click-outside | Whether to close when clicking outside | _boolean_ | `true` |
| close-on-click-overlay `v3.0.10` | Whether to close when clicking overlay | _boolean_ | `true` |
| teleport | Return the mount node for Popover | _string \| Element_ | `body` |
| icon-prefix | Icon className prefix | _string_ | `van-icon` |
| icon-prefix `v3.0.17` | Icon className prefix | _string_ | `van-icon` |
### Data Structure of Action

View File

@ -234,7 +234,7 @@ export default {
| close-on-click-outside | 是否在点击外部元素后关闭菜单 | _boolean_ | `true` |
| close-on-click-overlay `v3.0.10` | 是否在点击遮罩层后关闭菜单 | _boolean_ | `true` |
| teleport | 指定挂载的节点,[用法示例](#/zh-CN/popup#zhi-ding-gua-zai-wei-zhi) | _string \| Element_ | `body` |
| icon-prefix | 图标类名前缀,同 Icon 组件的 [class-prefix 属性](#/zh-CN/icon#props) | _string_ | `van-icon` |
| icon-prefix `v3.0.17` | 图标类名前缀,同 Icon 组件的 [class-prefix 属性](#/zh-CN/icon#props) | _string_ | `van-icon` |
### Action 数据结构

View File

@ -13,6 +13,25 @@ exports[`should allow to custom the className of action 1`] = `
exports[`should change icon class prefix when using icon-prefix prop 1`] = `
<span class="van-popover__wrapper">
</span>
<transition-stub>
<div class="van-popup van-popover van-popover--light">
<div class="van-popover__arrow">
</div>
<div role="menu"
class="van-popover__content"
>
<div role="menuitem"
class="van-popover__action van-popover__action--with-icon"
>
<i class="van-badge__wrapper my-icon my-icon-success van-popover__action-icon">
</i>
<div class="van-popover__action-text van-hairline--bottom">
foo
</div>
</div>
</div>
</div>
</transition-stub>
`;
exports[`should locate to reference element when showed 1`] = `

View File

@ -192,8 +192,9 @@ test('should change icon class prefix when using icon-prefix prop', () => {
const wrapper = mount(Popover, {
props: {
show: true,
icon: 'success',
teleport: null,
iconPrefix: 'my-icon',
actions: [{ icon: 'success', text: 'foo' }],
},
});