[bugfix] Card: origin-price slot not work (#2927)

This commit is contained in:
neverland 2019-03-08 17:53:46 +08:00 committed by GitHub
parent bfa8f38585
commit 2297baa917
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 31 additions and 1 deletions

View File

@ -94,7 +94,7 @@ function Card(
const OriginPrice = showOriginPrice && (
<div class={bem('origin-price')}>
{slots['origin-price']
? slots['origin-price']
? slots['origin-price']()
: `${props.currency} ${props.originPrice}`}
</div>
);

View File

@ -0,0 +1,13 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`render origin-price slot 1`] = `
<div class="van-card">
<div class="van-card__header">
<div class="van-card__content">
<div class="van-card__bottom">
<div class="van-card__origin-price">Custom Origin Price</div>
</div>
</div>
</div>
</div>
`;

View File

@ -0,0 +1,17 @@
import Card from '..';
import { mount } from '../../../test/utils';
test('render origin-price slot', () => {
const wrapper = mount({
template: `
<card>
<template v-slot:origin-price>Custom Origin Price</template>
</card>
`,
components: {
Card
}
});
expect(wrapper).toMatchSnapshot();
});