1
0
Fork 0

Switched from settings.mode to settings.complete

This commit is contained in:
Joost De Cock 2018-09-12 17:34:53 +02:00
parent d15515d73c
commit 7c86c6354b
4 changed files with 8 additions and 7 deletions

View file

@ -162,10 +162,11 @@ Part.prototype.units = function(input) {
/** Returns an object with shorthand access for pattern design */
Part.prototype.shorthand = function() {
let final = this.context.settings.mode === "draft" ? true : false;
let complete = this.context.settings.complete ? true : false;
let paperless = this.context.settings.paperless === true ? true : false;
let sa = this.context.settings.complete ? this.context.settings.sa || 0 : 0;
return {
sa: this.context.settings.sa || 0,
sa,
measurements: this.context.settings.measurements || {},
options: this.context.options || {},
store: this.context.store,
@ -178,7 +179,7 @@ Part.prototype.shorthand = function() {
Point: this.Point,
Path: this.Path,
Snippet: this.Snippet,
final,
complete,
paperless,
debug: this.debugClosure()
};

View file

@ -21,7 +21,7 @@ export default function Pattern(config = false) {
// Data containers
this.settings = {
mode: "draft",
complete: true,
idPrefix: "fs-",
locale: "en",
units: "metric",
@ -97,7 +97,7 @@ Pattern.prototype.sample = function() {
Pattern.prototype.sampleParts = function() {
let parts = {};
this.settings.mode = "sample";
this.settings.quick = true;
this.settings.paperless = false;
this.draft();
for (let i in this.parts) {

View file

@ -108,7 +108,7 @@ it("Should return shorthand", () => {
pattern.settings.paperless = true;
let part = new pattern.Part();
let short = part.shorthand();
expect(short.final).to.equal(true);
expect(short.complete).to.equal(true);
expect(short.paperless).to.equal(true);
});

View file

@ -11,7 +11,7 @@ it("Pattern constructor should initialize object", () => {
});
expect(pattern.width).to.equal(false);
expect(pattern.height).to.equal(false);
expect(pattern.settings.mode).to.equal("draft");
expect(pattern.settings.complete).to.equal(true);
expect(pattern.parts).to.eql({});
expect(pattern.settings.units).to.equal("metric");
expect(pattern.config.foo).to.equal("bar");