Merge branch 'develop' of github.com:freesewing/freesewing into develop
This commit is contained in:
commit
12e2a5319a
1818 changed files with 4379 additions and 5904 deletions
|
@ -416,7 +416,20 @@ Part.prototype.setCutOnFold = function (p1, p2) {
|
|||
}
|
||||
|
||||
Part.prototype.isEmpty = function() {
|
||||
return Object.keys(this.paths).length === 0 && Object.keys(this.snippets).length === 0
|
||||
if (Object.keys(this.snippets).length > 0) return false
|
||||
|
||||
if (Object.keys(this.paths).length > 0) {
|
||||
for (var p in this.paths) {
|
||||
if (this.paths[p].render && this.paths[p].length()) return false
|
||||
}
|
||||
}
|
||||
|
||||
for (var p in this.points) {
|
||||
if (this.points[p].attributes.get('data-text')) return false
|
||||
if (this.points[p].attributes.get('data-circle')) return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
export default Part
|
||||
|
|
|
@ -408,11 +408,27 @@ describe('isEmpty', () => {
|
|||
expect(part.isEmpty()).to.be.true
|
||||
})
|
||||
|
||||
it("Should return false if the part has a path", () => {
|
||||
it("Should return true if the part has paths but they have no length", () => {
|
||||
let pattern = new freesewing.Pattern();
|
||||
let part = new pattern.Part();
|
||||
const { Path, paths } = part.shorthand()
|
||||
const { Path, paths, Point } = part.shorthand()
|
||||
paths.seam = new Path()
|
||||
expect(part.isEmpty()).to.be.true
|
||||
})
|
||||
|
||||
it("Should return true if the part has paths but they don't render", () => {
|
||||
let pattern = new freesewing.Pattern();
|
||||
let part = new pattern.Part();
|
||||
const { Path, paths, Point } = part.shorthand()
|
||||
paths.seam = new Path().move(new Point(0,0)).line(new Point(2,3)).setRender(false)
|
||||
expect(part.isEmpty()).to.be.true
|
||||
})
|
||||
|
||||
it("Should return false if the part has a path with length", () => {
|
||||
let pattern = new freesewing.Pattern();
|
||||
let part = new pattern.Part();
|
||||
const { Path, paths, Point } = part.shorthand()
|
||||
paths.seam = new Path().move(new Point(0,0)).line(new Point(2,3))
|
||||
|
||||
expect(part.isEmpty()).to.be.false
|
||||
})
|
||||
|
@ -425,6 +441,24 @@ describe('isEmpty', () => {
|
|||
|
||||
expect(part.isEmpty()).to.be.false
|
||||
})
|
||||
|
||||
it("Should return false if the part has a point that has text", () => {
|
||||
let pattern = new freesewing.Pattern();
|
||||
let part = new pattern.Part();
|
||||
const {Point, points} = part.shorthand()
|
||||
points.test = new Point(0,0)
|
||||
points.test.attributes.set('data-text', 'text')
|
||||
expect(part.isEmpty()).to.be.false
|
||||
})
|
||||
|
||||
it("Should return false if the part has a point that has a circle", () => {
|
||||
let pattern = new freesewing.Pattern();
|
||||
let part = new pattern.Part();
|
||||
const {Point, points} = part.shorthand()
|
||||
points.test = new Point(0,0)
|
||||
points.test.attributes.set('data-circle', 10)
|
||||
expect(part.isEmpty()).to.be.false
|
||||
})
|
||||
})
|
||||
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue