mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-28 18:22:40 +00:00
Fix topbar submenu width on mobile/tablet (#1047)
* Fix topbar submenu width on tablet * Add Playwright test * Use better selector * nit --------- Co-authored-by: Chenlei Hu <chenlei.hu@mail.utoronto.ca>
This commit is contained in:
@@ -230,6 +230,10 @@ class Topbar {
|
|||||||
.allInnerTexts()
|
.allInnerTexts()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async openSubmenuMobile() {
|
||||||
|
await this.page.locator('.p-menubar-mobile .p-menubar-button').click()
|
||||||
|
}
|
||||||
|
|
||||||
async getMenuItem(itemLabel: string): Promise<Locator> {
|
async getMenuItem(itemLabel: string): Promise<Locator> {
|
||||||
return this.page.locator(`.p-menubar-item-label:text-is("${itemLabel}")`)
|
return this.page.locator(`.p-menubar-item-label:text-is("${itemLabel}")`)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -486,6 +486,21 @@ test.describe('Menu', () => {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
test.describe('Topbar submmenus', () => {
|
||||||
|
test('@mobile Items fully visible on mobile screen width', async ({
|
||||||
|
comfyPage
|
||||||
|
}) => {
|
||||||
|
await comfyPage.menu.topbar.openSubmenuMobile()
|
||||||
|
const topLevelMenuItem = comfyPage.page
|
||||||
|
.locator('a.p-menubar-item-link')
|
||||||
|
.first()
|
||||||
|
const isTextCutoff = await topLevelMenuItem.evaluate((el) => {
|
||||||
|
return el.scrollWidth > el.clientWidth
|
||||||
|
})
|
||||||
|
expect(isTextCutoff).toBe(false)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
// Only test 'Top' to reduce test time.
|
// Only test 'Top' to reduce test time.
|
||||||
// ['Bottom', 'Top']
|
// ['Bottom', 'Top']
|
||||||
;['Top'].forEach(async (position) => {
|
;['Top'].forEach(async (position) => {
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
:model="items"
|
:model="items"
|
||||||
class="top-menubar border-none p-0 bg-transparent"
|
class="top-menubar border-none p-0 bg-transparent"
|
||||||
:pt="{
|
:pt="{
|
||||||
rootList: 'gap-0 flex-nowrap'
|
rootList: 'gap-0 flex-nowrap w-auto'
|
||||||
}"
|
}"
|
||||||
/>
|
/>
|
||||||
<Divider layout="vertical" class="mx-2" />
|
<Divider layout="vertical" class="mx-2" />
|
||||||
|
|||||||
Reference in New Issue
Block a user