Skip to content

Commit ab8394d

Browse files
committed
test: add circle-progress slot test
1 parent 26b8296 commit ab8394d

File tree

2 files changed

+28
-3
lines changed

2 files changed

+28
-3
lines changed

src/App.vue

+4-3
Original file line numberDiff line numberDiff line change
@@ -104,15 +104,16 @@
104104
</template>
105105
</ve-progress>
106106

107-
<ve-progress :progress="progress" animation="bounce 3000 300" :loading="loading">
107+
<ve-progress :size="400" :progress="progress" animation="bounce 3000 300" :loading="loading">
108108
<template #circle-progress="{ attrs }">
109-
<svg xmlns="http://www.w3.org/2000/svg" width="200" height="200" fill="none" viewBox="0 0 53 53"
109+
<svg xmlns="http://www.w3.org/2000/svg" :width="attrs.size" :height="attrs.size" fill="none" viewBox="0 0 53 53"
110110
version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svgjs="http://svgjs.dev/svgjs">
111111
<path ref="customPath" fill="url(&quot;#SvgjsLinearGradient1660&quot;)"
112-
:stroke-width="1"
112+
:stroke-width="1.5"
113113
:stroke="attrs.color"
114114
:stroke-dashoffset="attrs.calculateProgressOffset(163.32911682128906)"
115115
:stroke-dasharray="163.32911682128906"
116+
:stroke-linecap="attrs.line"
116117
:style="attrs.baseStyles"
117118
d="M52.1 26.5c0 3.2-4.3 5.6-5.5 8.4-1.2 2.9.1 7.6-2.1 9.8-2.2 2.2-6.9.9-9.8 2.1-2.8 1.2-5.2 5.5-8.4 5.5s-5.6-4.3-8.4-5.5c-2.9-1.2-7.6.1-9.8-2.1-2.2-2.2-.9-6.9-2.1-9.8C4.8 32.1.5 29.7.5 26.5s4.3-5.6 5.5-8.4c1.2-2.9-.1-7.6 2.1-9.8 2.2-2.2 6.9-.9 9.8-2.1C20.7 5 23.1.7 26.3.7s5.6 4.3 8.4 5.5c2.9 1.2 7.6-.1 9.8 2.1 2.2 2.2.9 6.9 2.1 9.8 1.2 2.8 5.5 5.2 5.5 8.4Z"></path>
118119
<defs>

tests/unit/container.spec.js

+24
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,30 @@ describe("[ EllipseProgressContainer.vue ]", () => {
174174
}, 100);
175175
});
176176
});
177+
describe("#circle-progress", () => {
178+
const wrapper = mount(VueEllipseProgress, {
179+
props: { progress: 35 },
180+
slots: {
181+
"circle-progress": `
182+
<template #default="attrs" >
183+
<polygon
184+
ref="polygon"
185+
:stroke-dashoffset="attrs.strokeDashOffset"
186+
:stroke-dasharray="582.4922485351562"
187+
points="10,10 190,100 10,190"
188+
style="fill: lime; stroke: purple; stroke-width: 3"
189+
:style="attrs.styles"
190+
/>
191+
</template>`,
192+
},
193+
});
194+
195+
it("renders provided slot", () => expect(wrapper.find("polygon").exists()).to.be.true);
196+
197+
it("replaces default progress circle", () => {
198+
expect(wrapper.find(".ep-circle--progress").exists()).to.be.false;
199+
});
200+
});
177201
});
178202
describe("#data", () => {
179203
const data = [

0 commit comments

Comments
 (0)