1
0
Fork 0

get tests passing

This commit is contained in:
Enoch Riese 2022-11-14 16:33:57 -06:00
parent f26098fe90
commit 0115a46d8a
3 changed files with 9 additions and 7 deletions

View file

@ -140,11 +140,7 @@ Pattern.prototype.createPartForSet = function (partName, set = 0) {
if (this.__needs(partName, set)) {
// Draft part
const result = this.draftPartForSet(partName, set)
if (typeof result === 'undefined') {
this.setStores[set].log.error(
`Result of drafting part ${partName} was undefined. Did you forget to return the part?`
)
} else this.parts[set][partName] = result
if (typeof result !== 'undefined') this.parts[set][partName] = result
// FIXME: THis won't work not that this is immutable
// But is it still needed?
// this.parts[set][partName].hidden === true ? true : !this.__wants(partName, set)
@ -163,6 +159,11 @@ Pattern.prototype.draftPartForSet = function (partName, set) {
this.__runHooks('prePartDraft')
const result = this.__designParts[partName].draft(this.parts[set][partName].shorthand())
this.__runHooks('postPartDraft')
if (typeof result === 'undefined') {
this.setStores[set].log.error(
`Result of drafting part ${partName} was undefined. Did you forget to return the part?`
)
}
return result
} catch (err) {
this.setStores[set].log.error([`Unable to draft part \`${partName}\` (set ${set})`, err])

View file

@ -19,6 +19,7 @@ describe('Hooks', () => {
preSample: [],
postSample: [],
preRender: [],
preLayout: [],
postLayout: [],
postRender: [],
insertText: [],

View file

@ -3,7 +3,7 @@ import { useGist } from 'shared/hooks/useGist'
import Layout from 'shared/components/layouts/default'
import Menu from 'shared/components/workbench/menu/index.js'
import DraftError from 'shared/components/workbench/draft/error.js'
import theme from '@freesewing/plugin-theme'
import { pluginTheme } from '@freesewing/plugin-theme'
import preloaders from 'shared/components/workbench/preload.js'
import Modal from 'shared/components/modal'
@ -122,7 +122,7 @@ const WorkbenchWrapper = ({ app, design, preload = false, from = false, layout =
//draft.__init()
// add theme to svg renderer
if (gist.renderer === 'svg') draft.use(theme)
if (gist.renderer === 'svg') draft.use(pluginTheme)
// draft it for draft and event views. Other views may add plugins, etc and we don't want to draft twice
try {