mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
test(Progress): update test cases
This commit is contained in:
parent
75c296f0a8
commit
e46fb0fb7a
@ -1,5 +0,0 @@
|
|||||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
||||||
|
|
||||||
exports[`calc width 1`] = `<div class="van-progress"><span class="van-progress__portion" style="width: 0px;"></span></div>`;
|
|
||||||
|
|
||||||
exports[`calc width 2`] = `<div class="van-progress"><span class="van-progress__portion" style="width: 0px;"><span class="van-progress__pivot" style="left: 0px;">test</span></span></div>`;
|
|
24
src/progress/test/__snapshots__/index.spec.js.snap
Normal file
24
src/progress/test/__snapshots__/index.spec.js.snap
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
|
exports[`should re-calc width if showing pivot dynamically 1`] = `
|
||||||
|
<div class="van-progress">
|
||||||
|
<span class="van-progress__portion"
|
||||||
|
style="width: 0px;"
|
||||||
|
>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
|
|
||||||
|
exports[`should re-calc width if showing pivot dynamically 2`] = `
|
||||||
|
<div class="van-progress">
|
||||||
|
<span class="van-progress__portion"
|
||||||
|
style="width: 0px;"
|
||||||
|
>
|
||||||
|
<span style="left: 0px;"
|
||||||
|
class="van-progress__pivot"
|
||||||
|
>
|
||||||
|
test
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
`;
|
@ -1,25 +1,26 @@
|
|||||||
import Progress from '..';
|
import Progress from '..';
|
||||||
import { mount, later } from '../../../test';
|
import { mount } from '../../../test';
|
||||||
|
|
||||||
test('calc width', async () => {
|
test('should re-calc width if showing pivot dynamically', async () => {
|
||||||
const wrapper = mount(Progress, {
|
const wrapper = mount(Progress, {
|
||||||
props: {
|
props: {
|
||||||
showPivot: false,
|
showPivot: false,
|
||||||
percentage: 100,
|
percentage: 100,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
await later();
|
|
||||||
expect(wrapper.html()).toMatchSnapshot();
|
expect(wrapper.html()).toMatchSnapshot();
|
||||||
|
|
||||||
wrapper.vm.showPivot = true;
|
await wrapper.setProps({
|
||||||
wrapper.vm.pivotText = 'test';
|
showPivot: true,
|
||||||
await later();
|
pivotText: 'test',
|
||||||
|
});
|
||||||
expect(wrapper.html()).toMatchSnapshot();
|
expect(wrapper.html()).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
|
|
||||||
test('track color prop', async () => {
|
test('should change track color when using track-color prop', () => {
|
||||||
const wrapper = mount(Progress, {
|
const wrapper = mount(Progress, {
|
||||||
props: {
|
props: {
|
||||||
|
percentage: 0,
|
||||||
trackColor: 'green',
|
trackColor: 'green',
|
||||||
},
|
},
|
||||||
});
|
});
|
Loading…
x
Reference in New Issue
Block a user