Fix extension register tab with API (#229)

* Get rid of extension manager impl

* nit

* Test register tab
This commit is contained in:
Chenlei Hu
2024-07-26 10:29:20 -04:00
committed by GitHub
parent 8e1d3f3baa
commit ee6eed1c1c
6 changed files with 52 additions and 65 deletions

View File

@@ -42,4 +42,29 @@ test.describe('Menu', () => {
expect(await comfyPage.menu.getThemeId()).toBe('dark')
})
test('Can register sidebar tab', async ({ comfyPage }) => {
const initialChildrenCount = await comfyPage.menu.sideToolBar.evaluate(
(el) => el.children.length
)
await comfyPage.page.evaluate(async () => {
window['app'].extensionManager.registerSidebarTab({
id: 'search',
icon: 'pi pi-search',
title: 'search',
tooltip: 'search',
type: 'custom',
render: (el) => {
el.innerHTML = '<div>Custom search tab</div>'
}
})
})
await comfyPage.nextFrame()
const newChildrenCount = await comfyPage.menu.sideToolBar.evaluate(
(el) => el.children.length
)
expect(newChildrenCount).toBe(initialChildrenCount + 1)
})
})