Skip to content

Commit 9b02d2a

Browse files
committed
test: fix all color tests
1 parent f787d8e commit 9b02d2a

File tree

4 files changed

+16
-17
lines changed

4 files changed

+16
-17
lines changed

package-lock.json

+4-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
"@vue/cli-service": "^4.5.9",
4141
"@vue/compiler-sfc": "^3.0.4",
4242
"@vue/eslint-config-airbnb": "^5.3.0",
43-
"@vue/test-utils": "^2.0.0-beta.11",
43+
"@vue/test-utils": "^2.0.0-beta.13",
4444
"babel-eslint": "^10.1.0",
4545
"chai": "^4.2.0",
4646
"eslint": "^7.15.0",

tests/unit/circle/circle-colors.spec.js

+11-11
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import CircleContainer from "@/components/Circle/CircleContainer.vue";
33
import Gradient from "@/components/Gradient.vue";
44
import { factory } from "@/../tests/helper";
55

6-
const localFactory = (colorObject) => factory({ container: CircleContainer, props: colorObject });
6+
const localFactory = (props) => factory({ container: CircleContainer, props });
77

88
const gradientColor = {
99
radial: false,
@@ -21,9 +21,9 @@ const gradientColor = {
2121
],
2222
};
2323

24-
const colorAsStringTests = (colorProp, color, selector, fill = false) => {
24+
const colorAsStringTests = (colorProp, color, selector, fill = false, half) => {
2525
describe("applies color as string", () => {
26-
const wrapper = localFactory({ ...colorProp });
26+
const wrapper = localFactory({ ...colorProp, half });
2727
const circleWrapper = wrapper.find(selector);
2828

2929
it("do not recognize gradient colors", () => {
@@ -42,9 +42,9 @@ const colorAsStringTests = (colorProp, color, selector, fill = false) => {
4242
});
4343
};
4444

45-
const gradientColorTests = (colorProp, selector, gradientURLPrefix, fill = false) => {
45+
const gradientColorTests = (colorProp, selector, gradientURLPrefix, fill = false, half) => {
4646
describe("applies gradient color correctly", () => {
47-
const wrapper = localFactory(colorProp);
47+
const wrapper = localFactory({ ...colorProp, half });
4848
const circleWrapper = wrapper.find(selector);
4949
const id = 0;
5050
const stopColorWrappers = wrapper.findAll("stop");
@@ -90,14 +90,14 @@ const colorTests = (colorProp, half = false, empty = false, gradientURLPrefix) =
9090

9191
it("does not render fill circle", () => {
9292
expect(
93-
localFactory({ [colorProp]: color })
93+
localFactory({ [colorProp]: color, half })
9494
.find(`.ep-${half ? "half-" : ""}circle--${empty ? "empty" : "progress"}__fill`)
9595
.exists()
9696
).to.be.false;
9797
});
9898

99-
colorAsStringTests({ [colorProp]: color }, color, circleSelector, false);
100-
gradientColorTests({ [colorProp]: gradientColor }, circleSelector, gradientURLPrefix, false);
99+
colorAsStringTests({ [colorProp]: color }, color, circleSelector, false, half);
100+
gradientColorTests({ [colorProp]: gradientColor }, circleSelector, gradientURLPrefix, false, half);
101101
};
102102

103103
const colorFillTests = (colorProp, half = false, empty = false, gradientURLPrefix) => {
@@ -109,14 +109,14 @@ const colorFillTests = (colorProp, half = false, empty = false, gradientURLPrefi
109109

110110
it("renders fill circle", () => {
111111
expect(
112-
localFactory({ [colorProp]: color })
112+
localFactory({ [colorProp]: color, half })
113113
.find(circleSelector)
114114
.exists()
115115
).to.be.true;
116116
});
117117

118-
colorAsStringTests({ [colorProp]: color }, color, circleSelector, true);
119-
gradientColorTests({ [colorProp]: gradientColor }, circleSelector, gradientURLPrefix, true);
118+
colorAsStringTests({ [colorProp]: color }, color, circleSelector, true, half);
119+
gradientColorTests({ [colorProp]: gradientColor }, circleSelector, gradientURLPrefix, true, half);
120120
};
121121

122122
describe("Colors", () => {

tests/unit/container.spec.js

-1
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,6 @@ describe("[ EllipseProgressContainer.vue ]", () => {
126126
"legend-caption": '<span id="my-slot">Hello Circle</span>',
127127
},
128128
});
129-
console.log(wrapper.html());
130129
expect(wrapper.get("#my-slot"));
131130
});
132131
});

0 commit comments

Comments
 (0)