[new feature] SubmitBar: add suffix-label prop

This commit is contained in:
陈嘉涵
2019-05-10 11:37:22 +08:00
parent 19efe4b316
commit 0f68edb8fd
7 changed files with 100 additions and 25 deletions
@@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`decimal length 1`] = `
exports[`decimal-length prop 1`] = `
<div class="van-submit-bar">
<div class="van-submit-bar__bar">
<div class="van-submit-bar__text"><span>合计:</span><span class="van-submit-bar__price">¥ 1.1</span></div><button class="van-button van-button--danger van-button--large van-button--square"><span class="van-button__text"></span></button>
@@ -15,3 +15,22 @@ exports[`disable submit 1`] = `
</div>
</div>
`;
exports[`suffix-label prop 1`] = `
<div class="van-submit-bar">
<div class="van-submit-bar__bar">
<div class="van-submit-bar__text"><span>Label</span><span class="van-submit-bar__price">¥ 1.11</span><span class="van-submit-bar__suffix-label">Suffix Label</span></div><button class="van-button van-button--danger van-button--large van-button--square"><span class="van-button__text"></span></button>
</div>
</div>
`;
exports[`top slot 1`] = `
<div class="van-submit-bar">top<div class="van-submit-bar__bar"><button class="van-button van-button--danger van-button--large van-button--square"><span class="van-button__text"></span></button></div>
</div>
`;
exports[`without price 1`] = `
<div class="van-submit-bar">
<div class="van-submit-bar__bar"><button class="van-button van-button--danger van-button--large van-button--square"><span class="van-button__text"></span></button></div>
</div>
`;
+38 -2
View File
@@ -1,7 +1,7 @@
import SubmitBar from '..';
import { mount } from '../../../test/utils';
test('submit', () => {
test('submit event', () => {
const submit = jest.fn();
const wrapper = mount(SubmitBar, {
context: {
@@ -37,7 +37,29 @@ test('disable submit', () => {
expect(submit).toHaveBeenCalledTimes(0);
});
test('decimal length', () => {
test('without price', () => {
const wrapper = mount(SubmitBar, {
context: {
props: {
label: 'Label'
}
}
});
expect(wrapper).toMatchSnapshot();
});
test('top slot', () => {
const wrapper = mount(SubmitBar, {
scopedSlots: {
top: () => 'top'
}
});
expect(wrapper).toMatchSnapshot();
});
test('decimal-length prop', () => {
const wrapper = mount(SubmitBar, {
context: {
props: {
@@ -49,3 +71,17 @@ test('decimal length', () => {
expect(wrapper).toMatchSnapshot();
});
test('suffix-label prop', () => {
const wrapper = mount(SubmitBar, {
context: {
props: {
price: 111,
label: 'Label',
suffixLabel: 'Suffix Label'
}
}
});
expect(wrapper).toMatchSnapshot();
});