當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript fireEvent.click方法代碼示例

本文整理匯總了TypeScript中dom-testing-library.fireEvent.click方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript fireEvent.click方法的具體用法?TypeScript fireEvent.click怎麽用?TypeScript fireEvent.click使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在dom-testing-library.fireEvent的用法示例。


在下文中一共展示了fireEvent.click方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: 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

示例2: test

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

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

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

  expect(getAllActiveButtons()).toHaveLength(2)
})
開發者ID:goblindegook,項目名稱:littlefoot,代碼行數:13,代碼來源:allowMultiple.test.ts

示例3: 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

示例4: test

test('setup with activateCallback', () => {
  setDocumentBody('single.html')
  const activateCallback = jest.fn()
  littlefoot({ activateCallback })

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

  const popover = getPopover('1')
  expect(activateCallback).toHaveBeenCalledWith(popover, button)
})
開發者ID:goblindegook,項目名稱:littlefoot,代碼行數:11,代碼來源:activateCallback.test.ts

示例5: test

test('activate footnote when clicking the button', async () => {
  littlefoot(TEST_SETTINGS)
  const button = getButton('1')

  fireEvent.click(button)

  expect(button).toHaveClass('is-changing')
  await waitForChange(button)
  expect(button).toHaveClass('is-active')
  getPopoverByText(/This is the document's only footnote./)
})
開發者ID:goblindegook,項目名稱:littlefoot,代碼行數:11,代碼來源:activate.test.ts


注:本文中的dom-testing-library.fireEvent.click方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。