tooltip.spec.ts 740 B

1234567891011121314151617181920212223
  1. // Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. import { waitFor } from '@testing-library/vue'
  3. import { describe } from 'vitest'
  4. import renderComponent from '#tests/support/components/renderComponent.ts'
  5. describe('Shared TooltipDirective', () => {
  6. it('adds aria label without showing tooltip', async () => {
  7. const wrapper = renderComponent({
  8. template: `
  9. <div v-tooltip="'Hello, Tooltip'">Foo Test World</div>
  10. `,
  11. })
  12. expect(wrapper.getByLabelText('Hello, Tooltip')).toBeInTheDocument()
  13. await wrapper.events.hover(wrapper.getByText('Foo Test World'))
  14. await waitFor(() =>
  15. expect(wrapper.queryByText('Hello, Tooltip')).not.toBeInTheDocument(),
  16. )
  17. })
  18. })