Added cypress attributes for the popover menu

This commit is contained in:
Dean 2022-04-20 12:51:44 +01:00
parent 5e21757ef1
commit ea164cb6aa
4 changed files with 8 additions and 5 deletions

View File

@ -6,6 +6,7 @@
export let disabled = false export let disabled = false
export let align = "left" export let align = "left"
export let portalTarget export let portalTarget
export let dataCy
let anchor let anchor
let dropdown let dropdown
@ -36,7 +37,7 @@
<div use:getAnchor on:click={openMenu}> <div use:getAnchor on:click={openMenu}>
<slot name="control" /> <slot name="control" />
</div> </div>
<Popover bind:this={dropdown} {anchor} {align} {portalTarget}> <Popover bind:this={dropdown} {anchor} {align} {portalTarget} {dataCy}>
<Menu> <Menu>
<slot /> <slot />
</Menu> </Menu>

View File

@ -10,6 +10,7 @@
export let anchor export let anchor
export let align = "right" export let align = "right"
export let portalTarget export let portalTarget
export let dataCy
let clazz let clazz
export { clazz as class } export { clazz as class }
@ -40,8 +41,9 @@
use:positionDropdown={{ anchor, align }} use:positionDropdown={{ anchor, align }}
use:clickOutside={hide} use:clickOutside={hide}
on:keydown={handleEscape} on:keydown={handleEscape}
class={"spectrum-Popover is-open " + clazz} class={"spectrum-Popover is-open " + (clazz || "")}
role="presentation" role="presentation"
data-cy={dataCy}
> >
<slot /> <slot />
</div> </div>

View File

@ -109,8 +109,8 @@ filterTests(['all'], () => {
cy.get(".spectrum-Dialog-grid").contains("Unpublish app").click() cy.get(".spectrum-Dialog-grid").contains("Unpublish app").click()
cy.get(".appTable > :nth-child(5) > :nth-child(2) > .spectrum-Icon").click() cy.get(".appTable > :nth-child(5) > :nth-child(2) > .spectrum-Icon").click()
} }
cy.get(".app-row-actions").within(() => { cy.get("[data-cy='app-row-actions-menu-popover']").eq(0).within(() => {
cy.get(".spectrum-Button").contains("Edit").click({ force: true }) cy.get(".spectrum-Menu-item").contains("Edit").click({ force: true })
}) })
cy.get(".spectrum-Modal") cy.get(".spectrum-Modal")
.within(() => { .within(() => {

View File

@ -88,7 +88,7 @@
Edit Edit
</Button> </Button>
</div> </div>
<ActionMenu align="right"> <ActionMenu align="right" dataCy="app-row-actions-menu-popover">
<Icon hoverable slot="control" name="More" dataCy="app-row-actions-menu" /> <Icon hoverable slot="control" name="More" dataCy="app-row-actions-menu" />
{#if app.lockedYou} {#if app.lockedYou}
<MenuItem on:click={() => releaseLock(app)} icon="LockOpen"> <MenuItem on:click={() => releaseLock(app)} icon="LockOpen">