[new feature] SubmitBar: add decimal-length prop (#3151)
This commit is contained in:
@@ -1,9 +1,17 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`decimal length 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>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
|
||||
exports[`disable submit 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">¥ 0.00</span></div><button disabled="disabled" class="van-button van-button--danger van-button--large van-button--disabled van-button--square"><span class="van-button__text"></span></button>
|
||||
<div class="van-submit-bar__text"><span>合计:</span><span class="van-submit-bar__price">¥ 0.01</span></div><button disabled="disabled" class="van-button van-button--danger van-button--large van-button--disabled van-button--square"><span class="van-button__text"></span></button>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
|
||||
@@ -6,7 +6,7 @@ test('submit', () => {
|
||||
const wrapper = mount(SubmitBar, {
|
||||
context: {
|
||||
props: {
|
||||
price: 0.01
|
||||
price: 1
|
||||
},
|
||||
on: { submit }
|
||||
}
|
||||
@@ -22,7 +22,7 @@ test('disable submit', () => {
|
||||
const wrapper = mount(SubmitBar, {
|
||||
context: {
|
||||
props: {
|
||||
price: 0.01,
|
||||
price: 1,
|
||||
disabled: true
|
||||
},
|
||||
on: { submit }
|
||||
@@ -36,3 +36,16 @@ test('disable submit', () => {
|
||||
button.trigger('click');
|
||||
expect(submit).toHaveBeenCalledTimes(0);
|
||||
});
|
||||
|
||||
test('decimal length', () => {
|
||||
const wrapper = mount(SubmitBar, {
|
||||
context: {
|
||||
props: {
|
||||
price: 111,
|
||||
decimalLength: 1
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
expect(wrapper).toMatchSnapshot();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user