chore(core): Linter fixes
This commit is contained in:
parent
a76af50900
commit
56427cc4bd
10 changed files with 43 additions and 91 deletions
|
@ -31,7 +31,7 @@ export function Part() {
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
Part.prototype.macroClosure = function (args) {
|
Part.prototype.macroClosure = function () {
|
||||||
let self = this
|
let self = this
|
||||||
let method = function (key, args) {
|
let method = function (key, args) {
|
||||||
let macro = utils.macroName(key)
|
let macro = utils.macroName(key)
|
||||||
|
@ -59,7 +59,7 @@ Part.prototype.getId = function (prefix = '') {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns a value formatted for units provided in settings */
|
/** Returns a value formatted for units provided in settings */
|
||||||
Part.prototype.unitsClosure = function (value) {
|
Part.prototype.unitsClosure = function () {
|
||||||
const self = this
|
const self = this
|
||||||
const method = function (value) {
|
const method = function (value) {
|
||||||
if (typeof value !== 'number')
|
if (typeof value !== 'number')
|
||||||
|
@ -267,8 +267,8 @@ Part.prototype.shorthand = function () {
|
||||||
shorthand.paths = new Proxy(this.paths || {}, pathsProxy)
|
shorthand.paths = new Proxy(this.paths || {}, pathsProxy)
|
||||||
// Proxy the snippets object
|
// Proxy the snippets object
|
||||||
const snippetsProxy = {
|
const snippetsProxy = {
|
||||||
get: function (target, prop, receiver) {
|
get: function (...args) {
|
||||||
return Reflect.get(...arguments)
|
return Reflect.get(...args)
|
||||||
},
|
},
|
||||||
set: (snippets, name, value) => {
|
set: (snippets, name, value) => {
|
||||||
// Constructor checks
|
// Constructor checks
|
||||||
|
@ -340,12 +340,12 @@ Part.prototype.isEmpty = function () {
|
||||||
if (Object.keys(this.snippets).length > 0) return false
|
if (Object.keys(this.snippets).length > 0) return false
|
||||||
|
|
||||||
if (Object.keys(this.paths).length > 0) {
|
if (Object.keys(this.paths).length > 0) {
|
||||||
for (var p in this.paths) {
|
for (const p in this.paths) {
|
||||||
if (this.paths[p].render && this.paths[p].length()) return false
|
if (this.paths[p].render && this.paths[p].length()) return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (var p in this.points) {
|
for (const p in this.points) {
|
||||||
if (this.points[p].attributes.get('data-text')) return false
|
if (this.points[p].attributes.get('data-text')) return false
|
||||||
if (this.points[p].attributes.get('data-circle')) return false
|
if (this.points[p].attributes.get('data-circle')) return false
|
||||||
}
|
}
|
||||||
|
|
|
@ -393,7 +393,7 @@ function asPath(bezier, debug = false, log = false) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Joins path segments together into one path */
|
/** Joins path segments together into one path */
|
||||||
function joinPaths(paths, closed = false, log = false) {
|
function joinPaths(paths, closed = false) {
|
||||||
let joint = new Path(paths[0].debug).withLog(paths[0].log).move(paths[0].ops[0].to)
|
let joint = new Path(paths[0].debug).withLog(paths[0].log).move(paths[0].ops[0].to)
|
||||||
let current
|
let current
|
||||||
for (let p of paths) {
|
for (let p of paths) {
|
||||||
|
|
|
@ -310,7 +310,6 @@ Pattern.prototype.sampleParts = function () {
|
||||||
Pattern.prototype.sampleRun = function (parts, anchors, run, runs, extraClass = false) {
|
Pattern.prototype.sampleRun = function (parts, anchors, run, runs, extraClass = false) {
|
||||||
this.draft()
|
this.draft()
|
||||||
for (let i in this.parts) {
|
for (let i in this.parts) {
|
||||||
let anchor = false
|
|
||||||
let dx = 0
|
let dx = 0
|
||||||
let dy = 0
|
let dy = 0
|
||||||
if (this.parts[i].points.anchor) {
|
if (this.parts[i].points.anchor) {
|
||||||
|
@ -474,7 +473,7 @@ Pattern.prototype.__loadPlugins = function () {
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
Pattern.prototype.__loadPlugin = function (plugin, data, explicit = false) {
|
Pattern.prototype.__loadPlugin = function (plugin, data) {
|
||||||
this.plugins[plugin.name] = plugin
|
this.plugins[plugin.name] = plugin
|
||||||
if (plugin.hooks) this.__loadPluginHooks(plugin, data)
|
if (plugin.hooks) this.__loadPluginHooks(plugin, data)
|
||||||
if (plugin.macros) this.__loadPluginMacros(plugin)
|
if (plugin.macros) this.__loadPluginMacros(plugin)
|
||||||
|
@ -711,7 +710,7 @@ Pattern.prototype.__resolveParts = function (count = 0) {
|
||||||
// If so, resolve recursively
|
// If so, resolve recursively
|
||||||
if (len > count) return this.__resolveParts(len)
|
if (len > count) return this.__resolveParts(len)
|
||||||
|
|
||||||
for (const [name, part] of Object.entries(this.__parts)) {
|
for (const part of Object.values(this.__parts)) {
|
||||||
this.config = addPartConfig(part, this.config, this.store)
|
this.config = addPartConfig(part, this.config, this.store)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,12 +27,12 @@ Stack.prototype.addPart = function (part) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Returns a list of parts in this stack */
|
/* Returns a list of parts in this stack */
|
||||||
Stack.prototype.getPartList = function (part) {
|
Stack.prototype.getPartList = function () {
|
||||||
return [...this.parts]
|
return [...this.parts]
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Returns a list of names of parts in this stack */
|
/* Returns a list of names of parts in this stack */
|
||||||
Stack.prototype.getPartNames = function (part) {
|
Stack.prototype.getPartNames = function () {
|
||||||
return [...this.parts].map((p) => p.name)
|
return [...this.parts].map((p) => p.name)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -224,7 +224,7 @@ Svg.prototype.renderText = function (point) {
|
||||||
}
|
}
|
||||||
|
|
||||||
Svg.prototype.escapeText = function (text) {
|
Svg.prototype.escapeText = function (text) {
|
||||||
return text.replace(/\"/g, '“')
|
return text.replace(/"/g, '“')
|
||||||
}
|
}
|
||||||
|
|
||||||
Svg.prototype.renderCircle = function (point) {
|
Svg.prototype.renderCircle = function (point) {
|
||||||
|
@ -234,7 +234,7 @@ Svg.prototype.renderCircle = function (point) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns SVG code for a snippet */
|
/** Returns SVG code for a snippet */
|
||||||
Svg.prototype.renderSnippet = function (snippet, part) {
|
Svg.prototype.renderSnippet = function (snippet) {
|
||||||
let x = round(snippet.anchor.x)
|
let x = round(snippet.anchor.x)
|
||||||
let y = round(snippet.anchor.y)
|
let y = round(snippet.anchor.y)
|
||||||
let scale = snippet.attributes.get('data-scale') || 1
|
let scale = snippet.attributes.get('data-scale') || 1
|
||||||
|
|
|
@ -27,7 +27,6 @@ describe('Design', () => {
|
||||||
const settings = {}
|
const settings = {}
|
||||||
settings[key] = ['one', 'two']
|
settings[key] = ['one', 'two']
|
||||||
const Pattern = new Design(settings)
|
const Pattern = new Design(settings)
|
||||||
const m = Pattern.config.parts
|
|
||||||
expect(Pattern.config[key].length).to.equal(2)
|
expect(Pattern.config[key].length).to.equal(2)
|
||||||
expect(Pattern.config[key][0]).to.equal('one')
|
expect(Pattern.config[key][0]).to.equal('one')
|
||||||
expect(Pattern.config[key][1]).to.equal('two')
|
expect(Pattern.config[key][1]).to.equal('two')
|
||||||
|
|
|
@ -184,7 +184,7 @@ describe('Part', () => {
|
||||||
const part = pattern.__createPartWithContext()
|
const part = pattern.__createPartWithContext()
|
||||||
part.hooks.preDraft = [
|
part.hooks.preDraft = [
|
||||||
{
|
{
|
||||||
method: function (p) {
|
method: function () {
|
||||||
count++
|
count++
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -218,7 +218,7 @@ describe('Part', () => {
|
||||||
const design = new Design()
|
const design = new Design()
|
||||||
const pattern = new design()
|
const pattern = new design()
|
||||||
const part = pattern.__createPartWithContext()
|
const part = pattern.__createPartWithContext()
|
||||||
const { Path, paths, Point } = part.shorthand()
|
const { Path, paths } = part.shorthand()
|
||||||
paths.seam = new Path()
|
paths.seam = new Path()
|
||||||
expect(part.isEmpty()).to.be.true
|
expect(part.isEmpty()).to.be.true
|
||||||
})
|
})
|
||||||
|
|
|
@ -1035,7 +1035,7 @@ describe('Path', () => {
|
||||||
const b = new Point(10, 10)
|
const b = new Point(10, 10)
|
||||||
const p1 = new Path().move(a).line(b)
|
const p1 = new Path().move(a).line(b)
|
||||||
expect(invalid).to.equal(false)
|
expect(invalid).to.equal(false)
|
||||||
const p2 = new Path().withLog(log).noop('test').insop(false, p1)
|
new Path().withLog(log).noop('test').insop(false, p1)
|
||||||
expect(invalid).to.equal(true)
|
expect(invalid).to.equal(true)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -1044,7 +1044,7 @@ describe('Path', () => {
|
||||||
const log = { warning: () => (invalid = true) }
|
const log = { warning: () => (invalid = true) }
|
||||||
const a = new Point(0, 0)
|
const a = new Point(0, 0)
|
||||||
const b = new Point(10, 10)
|
const b = new Point(10, 10)
|
||||||
const p1 = new Path().move(a).line(b)
|
new Path().move(a).line(b)
|
||||||
expect(invalid).to.equal(false)
|
expect(invalid).to.equal(false)
|
||||||
try {
|
try {
|
||||||
new Path().withLog(log).noop('test').insop('test')
|
new Path().withLog(log).noop('test').insop('test')
|
||||||
|
@ -1058,7 +1058,7 @@ describe('Path', () => {
|
||||||
let invalid = false
|
let invalid = false
|
||||||
const log = { warning: () => (invalid = true) }
|
const log = { warning: () => (invalid = true) }
|
||||||
expect(invalid).to.equal(false)
|
expect(invalid).to.equal(false)
|
||||||
const p1 = new Path().withLog(log).attr()
|
new Path().withLog(log).attr()
|
||||||
expect(invalid).to.equal(true)
|
expect(invalid).to.equal(true)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -1066,7 +1066,7 @@ describe('Path', () => {
|
||||||
let invalid = false
|
let invalid = false
|
||||||
const log = { warning: () => (invalid = true) }
|
const log = { warning: () => (invalid = true) }
|
||||||
expect(invalid).to.equal(false)
|
expect(invalid).to.equal(false)
|
||||||
const p1 = new Path().withLog(log).attr('test')
|
new Path().withLog(log).attr('test')
|
||||||
expect(invalid).to.equal(true)
|
expect(invalid).to.equal(true)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -1142,7 +1142,7 @@ describe('Path', () => {
|
||||||
it('Should log a warning when calling shiftFractionalong but fraction is not a number', () => {
|
it('Should log a warning when calling shiftFractionalong but fraction is not a number', () => {
|
||||||
const part = {
|
const part = {
|
||||||
name: 'test',
|
name: 'test',
|
||||||
draft: ({ paths, Path, Point, points }) => {
|
draft: ({ Path, Point, points }) => {
|
||||||
points.a = new Path().move(new Point(0, 0)).line(new Point(0, 40)).shiftFractionAlong()
|
points.a = new Path().move(new Point(0, 0)).line(new Point(0, 40)).shiftFractionAlong()
|
||||||
return part
|
return part
|
||||||
},
|
},
|
||||||
|
@ -1158,7 +1158,7 @@ describe('Path', () => {
|
||||||
it('Should log a warning when splitting a path on a non-point', () => {
|
it('Should log a warning when splitting a path on a non-point', () => {
|
||||||
const part = {
|
const part = {
|
||||||
name: 'test',
|
name: 'test',
|
||||||
draft: ({ paths, Path, Point, points }) => {
|
draft: ({ Path, Point, points }) => {
|
||||||
points.a = new Path().move(new Point(0, 0)).line(new Point(0, 40)).split()
|
points.a = new Path().move(new Point(0, 0)).line(new Point(0, 40)).split()
|
||||||
return part
|
return part
|
||||||
},
|
},
|
||||||
|
|
|
@ -5,52 +5,6 @@ const expect = chai.expect
|
||||||
|
|
||||||
describe('Pattern', () => {
|
describe('Pattern', () => {
|
||||||
describe('Pattern.draft()', () => {
|
describe('Pattern.draft()', () => {
|
||||||
const partA = {
|
|
||||||
name: 'test.partA',
|
|
||||||
measurements: ['head', 'knee'],
|
|
||||||
optionalMeasurements: ['chest', 'waist'],
|
|
||||||
options: {
|
|
||||||
optA: { pct: 40, min: 20, max: 80 },
|
|
||||||
},
|
|
||||||
draft: () => {},
|
|
||||||
}
|
|
||||||
const partB = {
|
|
||||||
name: 'test.partB',
|
|
||||||
measurements: ['head', 'knee'],
|
|
||||||
optionalMeasurements: ['knee'],
|
|
||||||
after: partA,
|
|
||||||
plugins: [
|
|
||||||
{
|
|
||||||
name: 'testPlugin',
|
|
||||||
hooks: {
|
|
||||||
preRender: () => {},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
options: {
|
|
||||||
optB: { deg: 40, min: 20, max: 80 },
|
|
||||||
},
|
|
||||||
draft: () => {},
|
|
||||||
}
|
|
||||||
const partC = {
|
|
||||||
name: 'test.partC',
|
|
||||||
measurements: ['head', 'knee'],
|
|
||||||
optionalMeasurements: ['knee'],
|
|
||||||
from: partB,
|
|
||||||
options: {
|
|
||||||
optC: { pct: 20, min: 10, max: 30 },
|
|
||||||
},
|
|
||||||
draft: () => {},
|
|
||||||
}
|
|
||||||
|
|
||||||
const Pattern = new Design({
|
|
||||||
data: {
|
|
||||||
name: 'test',
|
|
||||||
version: '1.2.3',
|
|
||||||
},
|
|
||||||
parts: [partC],
|
|
||||||
})
|
|
||||||
const pattern = new Pattern()
|
|
||||||
|
|
||||||
it('Pattern.draft() should draft according to settings', () => {
|
it('Pattern.draft() should draft according to settings', () => {
|
||||||
let count = 0
|
let count = 0
|
||||||
|
|
|
@ -204,7 +204,7 @@ describe('Pattern', () => {
|
||||||
options: { optionB: { pct: 12, min: 2, max: 20 } },
|
options: { optionB: { pct: 12, min: 2, max: 20 } },
|
||||||
measurements: ['measieB'],
|
measurements: ['measieB'],
|
||||||
optionalMeasurements: ['optmeasieB', 'measieA'],
|
optionalMeasurements: ['optmeasieB', 'measieA'],
|
||||||
draft: ({ points, Point, paths, Path }) => {
|
draft: ({ points, Point, paths, Path, part }) => {
|
||||||
points.b1 = new Point(2, 2)
|
points.b1 = new Point(2, 2)
|
||||||
points.b2 = new Point(22, 22)
|
points.b2 = new Point(22, 22)
|
||||||
paths.b = new Path().move(points.b1).line(points.b2)
|
paths.b = new Path().move(points.b1).line(points.b2)
|
||||||
|
@ -217,7 +217,7 @@ describe('Pattern', () => {
|
||||||
options: { optionC: { deg: 5, min: 0, max: 15 } },
|
options: { optionC: { deg: 5, min: 0, max: 15 } },
|
||||||
measurements: ['measieC'],
|
measurements: ['measieC'],
|
||||||
optionalMeasurements: ['optmeasieC', 'measieA'],
|
optionalMeasurements: ['optmeasieC', 'measieA'],
|
||||||
draft: ({ points, Point, paths, Path }) => {
|
draft: ({ points, Point, paths, Path, part }) => {
|
||||||
points.c1 = new Point(3, 3)
|
points.c1 = new Point(3, 3)
|
||||||
points.c2 = new Point(33, 33)
|
points.c2 = new Point(33, 33)
|
||||||
paths.c = new Path().move(points.c1).line(points.c2)
|
paths.c = new Path().move(points.c1).line(points.c2)
|
||||||
|
@ -232,7 +232,7 @@ describe('Pattern', () => {
|
||||||
options: { optionR: { dflt: 'red', list: ['red', 'green', 'blue'] } },
|
options: { optionR: { dflt: 'red', list: ['red', 'green', 'blue'] } },
|
||||||
measurements: ['measieR'],
|
measurements: ['measieR'],
|
||||||
optionalMeasurements: ['optmeasieR', 'measieA'],
|
optionalMeasurements: ['optmeasieR', 'measieA'],
|
||||||
draft: ({ points, Point, paths, Path }) => {
|
draft: ({ points, Point, paths, Path, part }) => {
|
||||||
points.r1 = new Point(4, 4)
|
points.r1 = new Point(4, 4)
|
||||||
points.r2 = new Point(44, 44)
|
points.r2 = new Point(44, 44)
|
||||||
paths.r = new Path().move(points.r1).line(points.r2)
|
paths.r = new Path().move(points.r1).line(points.r2)
|
||||||
|
@ -355,7 +355,7 @@ describe('Pattern', () => {
|
||||||
options: { optionB: { pct: 12, min: 2, max: 20 } },
|
options: { optionB: { pct: 12, min: 2, max: 20 } },
|
||||||
measurements: ['measieB'],
|
measurements: ['measieB'],
|
||||||
optionalMeasurements: ['optmeasieB', 'measieA'],
|
optionalMeasurements: ['optmeasieB', 'measieA'],
|
||||||
draft: ({ points, Point, paths, Path }) => {
|
draft: ({ points, Point, paths, Path, part }) => {
|
||||||
points.b1 = new Point(2, 2)
|
points.b1 = new Point(2, 2)
|
||||||
points.b2 = new Point(22, 22)
|
points.b2 = new Point(22, 22)
|
||||||
paths.b = new Path().move(points.b1).line(points.b2)
|
paths.b = new Path().move(points.b1).line(points.b2)
|
||||||
|
@ -368,7 +368,7 @@ describe('Pattern', () => {
|
||||||
options: { optionC: { deg: 5, min: 0, max: 15 } },
|
options: { optionC: { deg: 5, min: 0, max: 15 } },
|
||||||
measurements: ['measieC'],
|
measurements: ['measieC'],
|
||||||
optionalMeasurements: ['optmeasieC', 'measieA'],
|
optionalMeasurements: ['optmeasieC', 'measieA'],
|
||||||
draft: ({ points, Point, paths, Path }) => {
|
draft: ({ points, Point, paths, Path, part }) => {
|
||||||
points.c1 = new Point(3, 3)
|
points.c1 = new Point(3, 3)
|
||||||
points.c2 = new Point(33, 33)
|
points.c2 = new Point(33, 33)
|
||||||
paths.c = new Path().move(points.c1).line(points.c2)
|
paths.c = new Path().move(points.c1).line(points.c2)
|
||||||
|
@ -381,7 +381,7 @@ describe('Pattern', () => {
|
||||||
options: { optionD: { dflt: 'red', list: ['red', 'green', 'blue'] } },
|
options: { optionD: { dflt: 'red', list: ['red', 'green', 'blue'] } },
|
||||||
measurements: ['measieD'],
|
measurements: ['measieD'],
|
||||||
optionalMeasurements: ['optmeasieD', 'measieA'],
|
optionalMeasurements: ['optmeasieD', 'measieA'],
|
||||||
draft: ({ points, Point, paths, Path }) => {
|
draft: ({ points, Point, paths, Path, part }) => {
|
||||||
points.d1 = new Point(4, 4)
|
points.d1 = new Point(4, 4)
|
||||||
points.d2 = new Point(44, 44)
|
points.d2 = new Point(44, 44)
|
||||||
paths.d = new Path().move(points.d1).line(points.d2)
|
paths.d = new Path().move(points.d1).line(points.d2)
|
||||||
|
@ -483,8 +483,8 @@ describe('Pattern', () => {
|
||||||
name: 'example',
|
name: 'example',
|
||||||
version: 1,
|
version: 1,
|
||||||
hooks: {
|
hooks: {
|
||||||
preRender: function (svg, attributes) {
|
preRender: function (svg) {
|
||||||
svg.attributes.add('freesewing:plugin-example', version)
|
svg.attributes.add('freesewing:plugin-example', 1)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -504,8 +504,8 @@ describe('Pattern', () => {
|
||||||
name: 'example1',
|
name: 'example1',
|
||||||
version: 1,
|
version: 1,
|
||||||
hooks: {
|
hooks: {
|
||||||
preRender: function (svg, attributes) {
|
preRender: function (svg) {
|
||||||
svg.attributes.add('freesewing:plugin-example1', version)
|
svg.attributes.add('freesewing:plugin-example1', 1)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -513,8 +513,8 @@ describe('Pattern', () => {
|
||||||
name: 'example2',
|
name: 'example2',
|
||||||
version: 2,
|
version: 2,
|
||||||
hooks: {
|
hooks: {
|
||||||
preRender: function (svg, attributes) {
|
preRender: function (svg) {
|
||||||
svg.attributes.add('freesewing:plugin-example2', version)
|
svg.attributes.add('freesewing:plugin-example2', 2)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -529,8 +529,8 @@ describe('Pattern', () => {
|
||||||
name: 'example',
|
name: 'example',
|
||||||
version: 1,
|
version: 1,
|
||||||
hooks: {
|
hooks: {
|
||||||
preRender: function (svg, attributes) {
|
preRender: function (svg) {
|
||||||
svg.attributes.add('freesewing:plugin-example', version)
|
svg.attributes.add('freesewing:plugin-example', 1)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -546,8 +546,8 @@ describe('Pattern', () => {
|
||||||
name: 'example',
|
name: 'example',
|
||||||
version: 1,
|
version: 1,
|
||||||
hooks: {
|
hooks: {
|
||||||
preRender: function (svg, attributes) {
|
preRender: function (svg) {
|
||||||
svg.attributes.add('freesewing:plugin-example', version)
|
svg.attributes.add('freesewing:plugin-example', 1)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -562,8 +562,8 @@ describe('Pattern', () => {
|
||||||
name: 'example',
|
name: 'example',
|
||||||
version: 1,
|
version: 1,
|
||||||
hooks: {
|
hooks: {
|
||||||
preRender: function (svg, attributes) {
|
preRender: function (svg) {
|
||||||
svg.attributes.add('freesewing:plugin-example', version)
|
svg.attributes.add('freesewing:plugin-example', 1)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -584,7 +584,7 @@ describe('Pattern', () => {
|
||||||
const Pattern = new Design()
|
const Pattern = new Design()
|
||||||
const pattern = new Pattern()
|
const pattern = new Pattern()
|
||||||
let count = 0
|
let count = 0
|
||||||
pattern.on('preDraft', function (pattern) {
|
pattern.on('preDraft', function () {
|
||||||
count++
|
count++
|
||||||
})
|
})
|
||||||
pattern.draft()
|
pattern.draft()
|
||||||
|
@ -600,7 +600,7 @@ describe('Pattern', () => {
|
||||||
name: 'test',
|
name: 'test',
|
||||||
version: '0.1-test',
|
version: '0.1-test',
|
||||||
hooks: {
|
hooks: {
|
||||||
preDraft: function (pattern) {
|
preDraft: function () {
|
||||||
count++
|
count++
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -616,10 +616,10 @@ describe('Pattern', () => {
|
||||||
version: '0.1-test',
|
version: '0.1-test',
|
||||||
hooks: {
|
hooks: {
|
||||||
preDraft: [
|
preDraft: [
|
||||||
function (pattern) {
|
function () {
|
||||||
count++
|
count++
|
||||||
},
|
},
|
||||||
function (pattern) {
|
function () {
|
||||||
count++
|
count++
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue