✨ Switched from settings.mode to settings.complete
This commit is contained in:
parent
d15515d73c
commit
7c86c6354b
4 changed files with 8 additions and 7 deletions
|
@ -162,10 +162,11 @@ Part.prototype.units = function(input) {
|
||||||
|
|
||||||
/** Returns an object with shorthand access for pattern design */
|
/** Returns an object with shorthand access for pattern design */
|
||||||
Part.prototype.shorthand = function() {
|
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 paperless = this.context.settings.paperless === true ? true : false;
|
||||||
|
let sa = this.context.settings.complete ? this.context.settings.sa || 0 : 0;
|
||||||
return {
|
return {
|
||||||
sa: this.context.settings.sa || 0,
|
sa,
|
||||||
measurements: this.context.settings.measurements || {},
|
measurements: this.context.settings.measurements || {},
|
||||||
options: this.context.options || {},
|
options: this.context.options || {},
|
||||||
store: this.context.store,
|
store: this.context.store,
|
||||||
|
@ -178,7 +179,7 @@ Part.prototype.shorthand = function() {
|
||||||
Point: this.Point,
|
Point: this.Point,
|
||||||
Path: this.Path,
|
Path: this.Path,
|
||||||
Snippet: this.Snippet,
|
Snippet: this.Snippet,
|
||||||
final,
|
complete,
|
||||||
paperless,
|
paperless,
|
||||||
debug: this.debugClosure()
|
debug: this.debugClosure()
|
||||||
};
|
};
|
||||||
|
|
|
@ -21,7 +21,7 @@ export default function Pattern(config = false) {
|
||||||
|
|
||||||
// Data containers
|
// Data containers
|
||||||
this.settings = {
|
this.settings = {
|
||||||
mode: "draft",
|
complete: true,
|
||||||
idPrefix: "fs-",
|
idPrefix: "fs-",
|
||||||
locale: "en",
|
locale: "en",
|
||||||
units: "metric",
|
units: "metric",
|
||||||
|
@ -97,7 +97,7 @@ Pattern.prototype.sample = function() {
|
||||||
|
|
||||||
Pattern.prototype.sampleParts = function() {
|
Pattern.prototype.sampleParts = function() {
|
||||||
let parts = {};
|
let parts = {};
|
||||||
this.settings.mode = "sample";
|
this.settings.quick = true;
|
||||||
this.settings.paperless = false;
|
this.settings.paperless = false;
|
||||||
this.draft();
|
this.draft();
|
||||||
for (let i in this.parts) {
|
for (let i in this.parts) {
|
||||||
|
|
|
@ -108,7 +108,7 @@ it("Should return shorthand", () => {
|
||||||
pattern.settings.paperless = true;
|
pattern.settings.paperless = true;
|
||||||
let part = new pattern.Part();
|
let part = new pattern.Part();
|
||||||
let short = part.shorthand();
|
let short = part.shorthand();
|
||||||
expect(short.final).to.equal(true);
|
expect(short.complete).to.equal(true);
|
||||||
expect(short.paperless).to.equal(true);
|
expect(short.paperless).to.equal(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ it("Pattern constructor should initialize object", () => {
|
||||||
});
|
});
|
||||||
expect(pattern.width).to.equal(false);
|
expect(pattern.width).to.equal(false);
|
||||||
expect(pattern.height).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.parts).to.eql({});
|
||||||
expect(pattern.settings.units).to.equal("metric");
|
expect(pattern.settings.units).to.equal("metric");
|
||||||
expect(pattern.config.foo).to.equal("bar");
|
expect(pattern.config.foo).to.equal("bar");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue