@pie-lib/tools 0.9.36-next.0 → 0.10.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -19
- package/NEXT.CHANGELOG.json +1 -0
- package/lib/index.js.map +1 -1
- package/package.json +4 -3
- package/src/__tests__/__snapshots__/rotatable.test.jsx.snap +37 -0
- package/src/__tests__/anchor-utils.test.js +131 -0
- package/src/__tests__/rotatable.test.jsx +220 -0
- package/src/__tests__/transform-origin.test.jsx +24 -0
- package/src/index.js +1 -0
- package/src/protractor/__tests__/__snapshots__/graphic.test.jsx.snap +1234 -0
- package/src/protractor/__tests__/__snapshots__/index.test.jsx.snap +40 -0
- package/src/protractor/__tests__/graphic.test.jsx +13 -0
- package/src/protractor/__tests__/index.test.jsx +13 -0
- package/src/ruler/__tests__/__snapshots__/graphic.test.jsx.snap +160 -0
- package/src/ruler/__tests__/__snapshots__/index.test.jsx.snap +45 -0
- package/src/ruler/__tests__/__snapshots__/unit-type.test.jsx.snap +12 -0
- package/src/ruler/__tests__/__snapshots__/unit.test.jsx.snap +30 -0
- package/src/ruler/__tests__/graphic.test.jsx +23 -0
- package/src/ruler/__tests__/index.test.jsx +28 -0
- package/src/ruler/__tests__/unit-type.test.jsx +13 -0
- package/src/ruler/__tests__/unit.test.jsx +15 -0
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`protractor snapshot renders 1`] = `
|
|
4
|
+
<WithStyles(Rotatable)
|
|
5
|
+
handle={
|
|
6
|
+
Array [
|
|
7
|
+
Object {
|
|
8
|
+
"class": "leftAnchor",
|
|
9
|
+
"origin": "222.75px 220.5px",
|
|
10
|
+
},
|
|
11
|
+
Object {
|
|
12
|
+
"class": "rightAnchor",
|
|
13
|
+
"origin": "222.75px 220.5px",
|
|
14
|
+
},
|
|
15
|
+
]
|
|
16
|
+
}
|
|
17
|
+
startPosition={
|
|
18
|
+
Object {
|
|
19
|
+
"left": 0,
|
|
20
|
+
"top": 0,
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
>
|
|
24
|
+
<div
|
|
25
|
+
style={
|
|
26
|
+
Object {
|
|
27
|
+
"width": "450px",
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
>
|
|
31
|
+
<WithStyles(Graphic) />
|
|
32
|
+
<WithStyles(Component)
|
|
33
|
+
className="leftAnchor"
|
|
34
|
+
/>
|
|
35
|
+
<WithStyles(Component)
|
|
36
|
+
className="rightAnchor"
|
|
37
|
+
/>
|
|
38
|
+
</div>
|
|
39
|
+
</WithStyles(Rotatable)>
|
|
40
|
+
`;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import toJson from 'enzyme-to-json';
|
|
2
|
+
import { shallow } from 'enzyme';
|
|
3
|
+
import { Graphic } from '../graphic';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
|
|
6
|
+
describe('graphic', () => {
|
|
7
|
+
describe('snapshot', () => {
|
|
8
|
+
it('renders', () => {
|
|
9
|
+
const wrapper = shallow(<Graphic classes={{ path: 'path', line: 'line', circle: 'circle' }} />);
|
|
10
|
+
expect(toJson(wrapper)).toMatchSnapshot();
|
|
11
|
+
});
|
|
12
|
+
});
|
|
13
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import toJson from 'enzyme-to-json';
|
|
2
|
+
import { shallow } from 'enzyme';
|
|
3
|
+
import { Protractor } from '../index';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
|
|
6
|
+
describe('protractor', () => {
|
|
7
|
+
describe('snapshot', () => {
|
|
8
|
+
it('renders', () => {
|
|
9
|
+
const wrapper = shallow(<Protractor classes={{}} />);
|
|
10
|
+
expect(toJson(wrapper)).toMatchSnapshot();
|
|
11
|
+
});
|
|
12
|
+
});
|
|
13
|
+
});
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`graphic snapshot renders 1`] = `
|
|
4
|
+
<svg
|
|
5
|
+
viewBox="0 0 300 100"
|
|
6
|
+
>
|
|
7
|
+
<Bg
|
|
8
|
+
className="bg"
|
|
9
|
+
height={100}
|
|
10
|
+
width={300}
|
|
11
|
+
/>
|
|
12
|
+
<WithStyles(UnitType)
|
|
13
|
+
label="in"
|
|
14
|
+
/>
|
|
15
|
+
<WithStyles(Unit)
|
|
16
|
+
config={
|
|
17
|
+
Object {
|
|
18
|
+
"type": "in",
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
height={100}
|
|
22
|
+
index={1}
|
|
23
|
+
key="1"
|
|
24
|
+
last={false}
|
|
25
|
+
width={25}
|
|
26
|
+
/>
|
|
27
|
+
<WithStyles(Unit)
|
|
28
|
+
config={
|
|
29
|
+
Object {
|
|
30
|
+
"type": "in",
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
height={100}
|
|
34
|
+
index={2}
|
|
35
|
+
key="2"
|
|
36
|
+
last={false}
|
|
37
|
+
width={25}
|
|
38
|
+
/>
|
|
39
|
+
<WithStyles(Unit)
|
|
40
|
+
config={
|
|
41
|
+
Object {
|
|
42
|
+
"type": "in",
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
height={100}
|
|
46
|
+
index={3}
|
|
47
|
+
key="3"
|
|
48
|
+
last={false}
|
|
49
|
+
width={25}
|
|
50
|
+
/>
|
|
51
|
+
<WithStyles(Unit)
|
|
52
|
+
config={
|
|
53
|
+
Object {
|
|
54
|
+
"type": "in",
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
height={100}
|
|
58
|
+
index={4}
|
|
59
|
+
key="4"
|
|
60
|
+
last={false}
|
|
61
|
+
width={25}
|
|
62
|
+
/>
|
|
63
|
+
<WithStyles(Unit)
|
|
64
|
+
config={
|
|
65
|
+
Object {
|
|
66
|
+
"type": "in",
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
height={100}
|
|
70
|
+
index={5}
|
|
71
|
+
key="5"
|
|
72
|
+
last={false}
|
|
73
|
+
width={25}
|
|
74
|
+
/>
|
|
75
|
+
<WithStyles(Unit)
|
|
76
|
+
config={
|
|
77
|
+
Object {
|
|
78
|
+
"type": "in",
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
height={100}
|
|
82
|
+
index={6}
|
|
83
|
+
key="6"
|
|
84
|
+
last={false}
|
|
85
|
+
width={25}
|
|
86
|
+
/>
|
|
87
|
+
<WithStyles(Unit)
|
|
88
|
+
config={
|
|
89
|
+
Object {
|
|
90
|
+
"type": "in",
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
height={100}
|
|
94
|
+
index={7}
|
|
95
|
+
key="7"
|
|
96
|
+
last={false}
|
|
97
|
+
width={25}
|
|
98
|
+
/>
|
|
99
|
+
<WithStyles(Unit)
|
|
100
|
+
config={
|
|
101
|
+
Object {
|
|
102
|
+
"type": "in",
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
height={100}
|
|
106
|
+
index={8}
|
|
107
|
+
key="8"
|
|
108
|
+
last={false}
|
|
109
|
+
width={25}
|
|
110
|
+
/>
|
|
111
|
+
<WithStyles(Unit)
|
|
112
|
+
config={
|
|
113
|
+
Object {
|
|
114
|
+
"type": "in",
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
height={100}
|
|
118
|
+
index={9}
|
|
119
|
+
key="9"
|
|
120
|
+
last={false}
|
|
121
|
+
width={25}
|
|
122
|
+
/>
|
|
123
|
+
<WithStyles(Unit)
|
|
124
|
+
config={
|
|
125
|
+
Object {
|
|
126
|
+
"type": "in",
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
height={100}
|
|
130
|
+
index={10}
|
|
131
|
+
key="10"
|
|
132
|
+
last={false}
|
|
133
|
+
width={25}
|
|
134
|
+
/>
|
|
135
|
+
<WithStyles(Unit)
|
|
136
|
+
config={
|
|
137
|
+
Object {
|
|
138
|
+
"type": "in",
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
height={100}
|
|
142
|
+
index={11}
|
|
143
|
+
key="11"
|
|
144
|
+
last={false}
|
|
145
|
+
width={25}
|
|
146
|
+
/>
|
|
147
|
+
<WithStyles(Unit)
|
|
148
|
+
config={
|
|
149
|
+
Object {
|
|
150
|
+
"type": "in",
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
height={100}
|
|
154
|
+
index={12}
|
|
155
|
+
key="12"
|
|
156
|
+
last={true}
|
|
157
|
+
width={25}
|
|
158
|
+
/>
|
|
159
|
+
</svg>
|
|
160
|
+
`;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`ruler snapshot renders 1`] = `
|
|
4
|
+
<WithStyles(Rotatable)
|
|
5
|
+
handle={
|
|
6
|
+
Array [
|
|
7
|
+
Object {
|
|
8
|
+
"class": "leftAnchor",
|
|
9
|
+
"origin": "bottom right",
|
|
10
|
+
},
|
|
11
|
+
Object {
|
|
12
|
+
"class": "rightAnchor",
|
|
13
|
+
"origin": "bottom left",
|
|
14
|
+
},
|
|
15
|
+
]
|
|
16
|
+
}
|
|
17
|
+
>
|
|
18
|
+
<div
|
|
19
|
+
style={
|
|
20
|
+
Object {
|
|
21
|
+
"height": "60px",
|
|
22
|
+
"width": "480px",
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
>
|
|
26
|
+
<WithStyles(Graphic)
|
|
27
|
+
height={60}
|
|
28
|
+
unit={
|
|
29
|
+
Object {
|
|
30
|
+
"ticks": 16,
|
|
31
|
+
"type": undefined,
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
units={12}
|
|
35
|
+
width={480}
|
|
36
|
+
/>
|
|
37
|
+
<WithStyles(Component)
|
|
38
|
+
className="leftAnchor"
|
|
39
|
+
/>
|
|
40
|
+
<WithStyles(Component)
|
|
41
|
+
className="rightAnchor"
|
|
42
|
+
/>
|
|
43
|
+
</div>
|
|
44
|
+
</WithStyles(Rotatable)>
|
|
45
|
+
`;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`unit snapshot renders 1`] = `
|
|
4
|
+
<g
|
|
5
|
+
style={
|
|
6
|
+
Object {
|
|
7
|
+
"transform": "translate(30px, 0px)",
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
>
|
|
11
|
+
<line
|
|
12
|
+
x1={30}
|
|
13
|
+
x2={30}
|
|
14
|
+
y1={0}
|
|
15
|
+
y2={20}
|
|
16
|
+
/>
|
|
17
|
+
<Ticks
|
|
18
|
+
count={10}
|
|
19
|
+
height={20}
|
|
20
|
+
width={30}
|
|
21
|
+
/>
|
|
22
|
+
<text
|
|
23
|
+
width={30}
|
|
24
|
+
x={25}
|
|
25
|
+
y={15}
|
|
26
|
+
>
|
|
27
|
+
2
|
|
28
|
+
</text>
|
|
29
|
+
</g>
|
|
30
|
+
`;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import toJson from 'enzyme-to-json';
|
|
2
|
+
import { shallow } from 'enzyme';
|
|
3
|
+
import { Graphic } from '../graphic';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
|
|
6
|
+
describe('graphic', () => {
|
|
7
|
+
describe('snapshot', () => {
|
|
8
|
+
it('renders', () => {
|
|
9
|
+
const wrapper = shallow(
|
|
10
|
+
<Graphic
|
|
11
|
+
width={300}
|
|
12
|
+
height={100}
|
|
13
|
+
units={12}
|
|
14
|
+
unit={{
|
|
15
|
+
type: 'in',
|
|
16
|
+
}}
|
|
17
|
+
classes={{ bg: 'bg' }}
|
|
18
|
+
/>,
|
|
19
|
+
);
|
|
20
|
+
expect(toJson(wrapper)).toMatchSnapshot();
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import toJson from 'enzyme-to-json';
|
|
2
|
+
import { shallow } from 'enzyme';
|
|
3
|
+
import { Ruler } from '../index';
|
|
4
|
+
import RulerGraphic from '../graphic';
|
|
5
|
+
import React from 'react';
|
|
6
|
+
|
|
7
|
+
describe('ruler', () => {
|
|
8
|
+
describe('snapshot', () => {
|
|
9
|
+
it('renders', () => {
|
|
10
|
+
const wrapper = shallow(<Ruler classes={{}} />);
|
|
11
|
+
expect(toJson(wrapper)).toMatchSnapshot();
|
|
12
|
+
});
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
describe('logic', () => {
|
|
16
|
+
it('sets unit for imperial', () => {
|
|
17
|
+
const wrapper = shallow(<Ruler measure={'imperial'} classes={{}} label={'in'} />);
|
|
18
|
+
const r = wrapper.find(RulerGraphic);
|
|
19
|
+
expect(r.prop('unit')).toEqual({ ticks: 16, type: 'in' });
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it('sets unit for metric', () => {
|
|
23
|
+
const wrapper = shallow(<Ruler measure={'metric'} classes={{}} label={'cm'} />);
|
|
24
|
+
const r = wrapper.find(RulerGraphic);
|
|
25
|
+
expect(r.prop('unit')).toEqual({ ticks: 10, type: 'cm' });
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import toJson from 'enzyme-to-json';
|
|
2
|
+
import { shallow } from 'enzyme';
|
|
3
|
+
import { UnitType } from '../unit-type';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
|
|
6
|
+
describe('unit-type', () => {
|
|
7
|
+
describe('snapshot', () => {
|
|
8
|
+
it('renders', () => {
|
|
9
|
+
const wrapper = shallow(<UnitType classes={{}} label={'cm'} />);
|
|
10
|
+
expect(toJson(wrapper)).toMatchSnapshot();
|
|
11
|
+
});
|
|
12
|
+
});
|
|
13
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import toJson from 'enzyme-to-json';
|
|
2
|
+
import { shallow } from 'enzyme';
|
|
3
|
+
import { Unit } from '../unit';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
|
|
6
|
+
describe('unit', () => {
|
|
7
|
+
describe('snapshot', () => {
|
|
8
|
+
it('renders', () => {
|
|
9
|
+
const wrapper = shallow(
|
|
10
|
+
<Unit index={2} width={30} height={20} last={false} config={{ ticks: 10 }} classes={{}} />,
|
|
11
|
+
);
|
|
12
|
+
expect(toJson(wrapper)).toMatchSnapshot();
|
|
13
|
+
});
|
|
14
|
+
});
|
|
15
|
+
});
|