forked from pencil-js/pencil.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathellipse.test.js
39 lines (32 loc) · 939 Bytes
/
ellipse.test.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
import test from "ava";
import Ellipse from "./ellipse";
test.beforeEach((t) => {
t.context = new Ellipse([10, 20], 50, 100);
});
test("constructor", (t) => {
t.is(t.context.horizontalRadius, 50);
t.is(t.context.verticalRadius, 100);
t.is(t.context.startAngle, 0);
t.is(t.context.endAngle, 1);
});
test("toJSON", (t) => {
const json = t.context.toJSON();
t.is(json.horizontalRadius, 50);
t.is(json.verticalRadius, 100);
t.is(json.startAngle, undefined);
t.is(json.endAngle, undefined);
t.is(json.constructor, "Ellipse");
});
test("from", (t) => {
const definition = {
horizontalRadius: 10,
verticalRadius: 20,
};
const ellipse = Ellipse.from(definition);
t.is(ellipse.horizontalRadius, 10);
t.is(ellipse.verticalRadius, 20);
});
test("defaultOptions", (t) => {
t.truthy(Ellipse.defaultOptions.fill);
t.falsy(Ellipse.defaultOptions.stroke);
});