From e46fb0fb7a64312d15a2ca8a3a1067e17fc2bcac Mon Sep 17 00:00:00 2001 From: chenjiahan Date: Sat, 28 Nov 2020 19:18:18 +0800 Subject: [PATCH] test(Progress): update test cases --- .../test/__snapshots__/index.legacy.js.snap | 5 ---- .../test/__snapshots__/index.spec.js.snap | 24 +++++++++++++++++++ .../test/{index.legacy.js => index.spec.js} | 15 ++++++------ 3 files changed, 32 insertions(+), 12 deletions(-) delete mode 100644 src/progress/test/__snapshots__/index.legacy.js.snap create mode 100644 src/progress/test/__snapshots__/index.spec.js.snap rename src/progress/test/{index.legacy.js => index.spec.js} (58%) diff --git a/src/progress/test/__snapshots__/index.legacy.js.snap b/src/progress/test/__snapshots__/index.legacy.js.snap deleted file mode 100644 index 47201dd08..000000000 --- a/src/progress/test/__snapshots__/index.legacy.js.snap +++ /dev/null @@ -1,5 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`calc width 1`] = `
`; - -exports[`calc width 2`] = `
test
`; diff --git a/src/progress/test/__snapshots__/index.spec.js.snap b/src/progress/test/__snapshots__/index.spec.js.snap new file mode 100644 index 000000000..fe02e3fdc --- /dev/null +++ b/src/progress/test/__snapshots__/index.spec.js.snap @@ -0,0 +1,24 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`should re-calc width if showing pivot dynamically 1`] = ` +
+ + +
+`; + +exports[`should re-calc width if showing pivot dynamically 2`] = ` +
+ + + test + + +
+`; diff --git a/src/progress/test/index.legacy.js b/src/progress/test/index.spec.js similarity index 58% rename from src/progress/test/index.legacy.js rename to src/progress/test/index.spec.js index 1e67e4626..c7e25e426 100644 --- a/src/progress/test/index.legacy.js +++ b/src/progress/test/index.spec.js @@ -1,25 +1,26 @@ 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, { props: { showPivot: false, percentage: 100, }, }); - await later(); expect(wrapper.html()).toMatchSnapshot(); - wrapper.vm.showPivot = true; - wrapper.vm.pivotText = 'test'; - await later(); + await wrapper.setProps({ + showPivot: true, + pivotText: 'test', + }); expect(wrapper.html()).toMatchSnapshot(); }); -test('track color prop', async () => { +test('should change track color when using track-color prop', () => { const wrapper = mount(Progress, { props: { + percentage: 0, trackColor: 'green', }, });