当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript dom-testing-library.fireEvent类代码示例

本文整理汇总了TypeScript中dom-testing-library.fireEvent的典型用法代码示例。如果您正苦于以下问题:TypeScript fireEvent类的具体用法?TypeScript fireEvent怎么用?TypeScript fireEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了fireEvent类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: test

test('dismiss on popover unhover', async () => {
  setDocumentBody('single.html')

  littlefoot({
    activateDelay: 1,
    activateOnHover: true,
    dismissDelay: 1,
    dismissOnUnhover: true,
    hoverDelay: 1
  })

  const button = getButton('1')

  fireEvent.mouseOver(button)
  await waitForChange(button)

  const popover = getPopover('1')

  fireEvent.mouseOut(button)
  fireEvent.mouseOver(popover)
  fireEvent.mouseOut(popover)
  await waitForChange(button)

  expect(button).not.toHaveClass('is-hovered')
  expect(button).not.toHaveClass('is-active')
})
开发者ID:goblindegook,项目名称:littlefoot,代码行数:26,代码来源:dismissOnUnhover.test.ts

示例2: test

test('set ARIA expanded state to false', async () => {
  littlefoot(TEST_SETTINGS)

  const button = getButton('1')

  fireEvent.click(button)
  await waitForChange(button)
  fireEvent.click(button)
  await waitForChange(button)

  expect(button).toHaveAttribute('aria-expanded', 'false')
})
开发者ID:goblindegook,项目名称:littlefoot,代码行数:12,代码来源:dismiss.test.ts

示例3: test

test('activate multiple footnotes on hover', async () => {
  littlefoot({ activateDelay: 1, activateOnHover: true, allowMultiple: true })

  const one = getButton('1')
  fireEvent.mouseOver(one)
  await waitForChange(one)

  const two = getButton('2')
  fireEvent.mouseOver(two)
  await waitForChange(two)

  expect(getAllActiveButtons()).toHaveLength(2)
})
开发者ID:goblindegook,项目名称:littlefoot,代码行数:13,代码来源:allowMultiple.test.ts

示例4: test

test('setup with custom contentTemplate', async () => {
  setDocumentBody('single.html')

  littlefoot({
    activateDelay: 1,
    contentTemplate: `<aside class="custom"
      data-footnote-popover-id="<%= id %>"
      data-footnote-number="<%= number %>"
      >
      <div class="littlefoot-footnote__wrapper">
        <div class="littlefoot-footnote__content">
          <%= content %>
        </div>
      </div>
    </aside>`
  })

  const button = getButton('1')
  fireEvent.click(button)
  await waitForChange(button)

  const footnote = document.querySelector('aside.custom')
  expect(footnote).toHaveAttribute('data-footnote-popover-id', '1')
  expect(footnote).toHaveAttribute('data-footnote-number', '1')

  const content = footnote!.querySelector('.littlefoot-footnote__content')
  expect(content).toContainHTML(`This is the document's only footnote.`)
})
开发者ID:goblindegook,项目名称:littlefoot,代码行数:28,代码来源:contentTemplate.test.ts

示例5: test

test('activate on hover', async () => {
  setDocumentBody('single.html')
  littlefoot({ activateDelay: 1, activateOnHover: true, hoverDelay: 1 })

  const button = getButton('1')
  fireEvent.mouseOver(button)
  await waitForChange(button)

  expect(button).toHaveClass('is-hovered')
  expect(button).toHaveClass('is-active')
})
开发者ID:goblindegook,项目名称:littlefoot,代码行数:11,代码来源:activateOnHover.test.ts


注:本文中的dom-testing-library.fireEvent类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。