test('custom buttonTemplate', () => {
  littlefoot({
    buttonTemplate: `<button
      title="Footnote <%= number %>"
      data-id="<%= id %>"
      data-number="<%= number %>"
      data-reference="<%= reference %>"
      data-content="<%= content %>"
    />`
  })

  const button = getByTitle(document.body, 'Footnote 1')
  expect(button).toHaveAttribute('data-id', '1')
  expect(button).toHaveAttribute('data-number', '1')
  expect(button).toHaveAttribute('data-reference', 'fnref:1')
  expect(button.getAttribute('data-content')).toContain(
    `This is the document's only footnote.`
  )
})
Example #2
0
export function getButton(id: string) {
  return getByTitle(document.body, `See Footnote ${id}`)
}