import { screen } from '@testing-library/dom' import { beforeEach, expect, test } from 'vitest' import littlefoot from '../../src/littlefoot' import { getButton, setDocumentBody } from '../helper' beforeEach(() => { setDocumentBody('single.html') }) test('default buttonTemplate', () => { littlefoot() const button = getButton('1') expect(button.id).toBe('lf-fnref:1') expect(button.dataset).toMatchObject({ footnoteButton: '', footnoteId: '1', }) }) test('custom buttonTemplate using <%= %> delimiters', () => { littlefoot({ buttonTemplate: ``, }) const button = screen.getByRole('button', { name: 'Footnote 1' }) expect(button.dataset).toMatchObject({ footnoteButton: '', footnoteId: '1', testContent: `
This is the document's only footnote.
`, testId: '1', testNumber: '1', testReference: 'lf-fnref:1', }) }) test('custom buttonTemplate using <% %> delimiters', () => { littlefoot({ buttonTemplate: ``, }) const button = screen.getByRole('button', { name: 'Footnote 1' }) expect(button.dataset).toMatchObject({ footnoteButton: '', footnoteId: '1', testContent: `This is the document's only footnote.
`, testId: '1', testNumber: '1', testReference: 'lf-fnref:1', }) })