fix(ui): update popover label

pull/16185/head
Zoe Steinkamp 2020-01-09 09:45:43 -07:00
parent 5b7aca040d
commit 23acf06df2
6 changed files with 15 additions and 22 deletions

View File

@ -394,7 +394,7 @@ describe('Collectors', () => {
cy.reload()
})
it('Can add label', () => {
cy.getByTestID('inline-labels--add').trigger('mouseover')
cy.getByTestID('inline-labels--add').click()
cy.getByTestID('inline-labels--popover-field').type('zoe')
cy.getByTestID('inline-labels--create-new').click()
cy.getByTestID('overlay--container').should('exist')

View File

@ -197,7 +197,7 @@ describe('Dashboards', () => {
cy.createLabel(labelName, id).then(() => {
cy.getByTestID(`inline-labels--add`)
.first()
.trigger('mouseover')
.click()
cy.getByTestID(`label--pill ${labelName}`).click()
@ -213,7 +213,7 @@ describe('Dashboards', () => {
cy.createLabel(labelName, id).then(() => {
cy.getByTestID(`inline-labels--add`)
.first()
.trigger('mouseover')
.click()
cy.getByTestID(`label--pill ${labelName}`).click()
@ -233,7 +233,7 @@ describe('Dashboards', () => {
cy.createLabel(labelName, id).then(() => {
cy.getByTestID(`inline-labels--add`)
.first()
.trigger('mouseover')
.click()
cy.getByTestID(`inline-labels--popover-field`).type(labelName)
@ -249,7 +249,7 @@ describe('Dashboards', () => {
cy.get('@org').then(() => {
cy.getByTestID(`inline-labels--add`)
.first()
.trigger('mouseover')
.click()
cy.getByTestID(`inline-labels--popover-field`)
.type(labelName)
@ -262,7 +262,7 @@ describe('Dashboards', () => {
const label = 'plerps'
cy.getByTestID(`inline-labels--add`)
.first()
.trigger('mouseover')
.click()
cy.getByTestID('inline-labels--popover-field').type(label)
cy.getByTestID('inline-labels--create-new').click()

View File

@ -162,7 +162,7 @@ describe('Dashboard', () => {
.should('equal', secondKey)
// graph tips responds to mouse over
cy.getByTestID('graphtips-question-mark').trigger('mouseover')
cy.getByTestID('graphtips-question-mark').click()
})
})
})

View File

@ -1,5 +1,4 @@
import {cleanup} from 'react-testing-library'
import 'intersection-observer'
jest.mock('honeybadger-js', () => () => null)

View File

@ -65,8 +65,8 @@ export default class InlineLabelPopover extends PureComponent<Props> {
position={PopoverPosition.Below}
triggerRef={triggerRef}
distanceFromTrigger={8}
showEvent={PopoverInteraction.Hover}
hideEvent={PopoverInteraction.Hover}
showEvent={PopoverInteraction.Click}
hideEvent={PopoverInteraction.Click}
testID="inline-labels--popover"
contents={() => (
<span>

View File

@ -2,7 +2,6 @@
import React from 'react'
import {act} from 'react-dom/test-utils'
import {fireEvent} from 'react-testing-library'
import 'intersection-observer'
// Components
import InlineLabelsEditor from 'src/shared/components/inlineLabels/InlineLabelsEditor'
@ -65,14 +64,11 @@ describe('Shared.Components.InlineLabelsEditor', () => {
})
describe('mouse interactions', () => {
it('hovering the plus button opens the popover', () => {
it('Clicking the plus button opens the popover', () => {
const {getByTestId, getAllByTestId} = setup()
const plusButton = getByTestId('inline-labels--add')
act(() => {
fireEvent.mouseOver(plusButton)
})
plusButton.click()
const popover = getAllByTestId('inline-labels--popover-field')
@ -83,9 +79,8 @@ describe('Shared.Components.InlineLabelsEditor', () => {
const {getByTestId, getAllByTestId} = setup()
const plusButton = getByTestId('inline-labels--add')
act(() => {
fireEvent.mouseOver(plusButton)
})
plusButton.click()
const inputValue = 'yodelling is rad'
const input = getByTestId('inline-labels--popover-field')
@ -108,9 +103,8 @@ describe('Shared.Components.InlineLabelsEditor', () => {
const onAddLabel = jest.fn()
const {getByTestId} = setup({onAddLabel})
const button = getByTestId('inline-labels--add')
act(() => {
fireEvent.mouseOver(button)
})
button.click()
const secondListItem = getByTestId(`label-list--item ${secondLabel.name}`)
fireEvent.click(secondListItem)