Skip to content

Commit

Permalink
Fix ComfyUI class setup procedure (#846)
Browse files Browse the repository at this point in the history
  • Loading branch information
huchenlei authored Sep 16, 2024
1 parent 091b8a7 commit 45a866f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/scripts/ui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ export class ComfyUI {
})

// For testing. Legacy ui tests don't have vue app initialized.
if (!app.vueAppReady) {
if (window['IS_TEST']) {
this.setup(document.body)
}
}
Expand Down
8 changes: 6 additions & 2 deletions src/scripts/ui/menu/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,9 @@ export class ComfyAppMenu {
resizeHandler = null
}
document.body.style.removeProperty('display')
app.ui.menuContainer.style.removeProperty('display')
if (app.ui.menuContainer) {
app.ui.menuContainer.style.removeProperty('display')
}
this.element.style.display = 'none'
app.ui.restoreMenuPosition()
}
Expand All @@ -192,7 +194,9 @@ export class ComfyAppMenu {

updatePosition(v: MenuPosition) {
document.body.style.display = 'grid'
this.app.ui.menuContainer.style.display = 'none'
if (this.app.ui.menuContainer) {
this.app.ui.menuContainer.style.display = 'none'
}
this.element.style.removeProperty('display')
this.position = v
if (v === 'Bottom') {
Expand Down
1 change: 1 addition & 0 deletions tests-ui/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export async function start(config: StartConfig = {}): Promise<StartResult> {

Object.assign(localStorage, config.localStorage ?? {})
document.body.innerHTML = html.toString()
window['IS_TEST'] = true

mockApi(config)
mockSettingStore()
Expand Down

0 comments on commit 45a866f

Please sign in to comment.