-
Notifications
You must be signed in to change notification settings - Fork 42
/
shared.js
71 lines (64 loc) · 1.73 KB
/
shared.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import React from "react";
import TestRenderer from "react-test-renderer";
import { iterator } from "@times-components/test-utils";
import { Svg, G, Path, Polygon, Rect } from "../src";
export default () => {
const tests = [
{
name: "an SVG, G, Path",
test() {
const testInstance = TestRenderer.create(
<Svg height={100} version="1.1" viewBox="145 50 108 120" width={100}>
<G fill="none" fillRule="evenodd" stroke="none" strokeWidth="1">
<Path d="M211.26076,54" fill="#000000" />
</G>
</Svg>
);
expect(testInstance).toMatchSnapshot();
}
},
{
name: "a Path with no fill",
test() {
const testInstance = TestRenderer.create(
<Path d="M211.26076,54" fill="none" />
);
expect(testInstance).toMatchSnapshot();
}
},
{
name: "a polygon",
test() {
const strokeColour = "red";
const fillColour = "blue";
const testInstance = TestRenderer.create(
<Polygon
fill={fillColour}
points="16.3405361 4.14989474 16.3405361 9.66442105 22.0216082 12.8146667 22.0216082 0.999894737"
stroke={strokeColour}
/>
);
expect(testInstance).toMatchSnapshot();
}
},
{
name: "a rect",
test() {
const testInstance = TestRenderer.create(
<Rect
fill="rgba(0,0,0)"
fillOpacity="0.4"
height="100"
stroke="rgb(255,255,255)"
strokeWidth="8"
width="100"
x="5"
y="10"
/>
);
expect(testInstance).toMatchSnapshot();
}
}
];
iterator(tests);
};