1
0
Fork 0

🎨 Moved round() to utils

This commit is contained in:
Joost De Cock 2018-08-31 09:44:12 +02:00
parent 85137b2334
commit 1faad2a01b
9 changed files with 34 additions and 23 deletions

View file

@ -12,8 +12,6 @@ it("Svg constructor should initialize object", () => {
expect(part.width).to.equal(false);
expect(part.height).to.equal(false);
expect(part.render).to.equal(true);
expect(part.points.origin.x).to.equal(0);
expect(part.points.origin.y).to.equal(0);
});
it("Should return a function from macroClosure", () => {
@ -97,12 +95,11 @@ it("Should set part attributes", () => {
it("Should copy a part", () => {
let pattern = new freesewing.Pattern();
let part = new pattern.Part();
part.points.origin.x = 16;
part.points.foo = new part.Point(12, 23);
let test = new pattern.Part();
test.copy(part);
expect(test.points.origin.x).to.equal(0);
expect(test.points.foo.x).to.equal(12);
expect(test.points.foo.y).to.equal(23);
});
it("Should return shorthand", () => {

View file

@ -1,5 +1,6 @@
let expect = require("chai").expect;
let freesewing = require("./dist/index.js");
let round = freesewing.utils.round;
it("Should offset a line", () => {
let pattern = new freesewing.Pattern();
@ -617,7 +618,3 @@ it("Should split a path on a line", () => {
expect(line.to.x).to.equal(29.81);
expect(line.to.y).to.equal(46.98);
});
function round(value) {
return Math.round(value * 1e2) / 1e2;
}

View file

@ -4,6 +4,7 @@ let expect = require("chai").expect;
let chai = require("chai");
chai.use(require("chai-string"));
let freesewing = require("./dist/index.js");
var round = freesewing.utils.round;
it("Svg constructor should initialize object", () => {
let pattern = new freesewing.Pattern();

View file

@ -452,3 +452,8 @@ it("Should not find intersections between identical circles", () => {
);
expect(intersections).to.equal(false);
});
it("Should return scale for a given amount of stretch", () => {
expect(freesewing.utils.stretchToScale(0)).to.equal(1);
expect(freesewing.utils.stretchToScale(0.15)).to.equal(0.9);
});