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

View File

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

View File

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

View File

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