1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
import assert from 'node:assert/strict';
import { describe, before, it } from 'node:test';
import * as cheerio from 'cheerio';
import { loadFixture } from './test-utils.js';
describe('Astro Markdown without remark-rehype config', () => {
let fixture;
before(async () => {
fixture = await loadFixture({
root: './fixtures/astro-markdown-remarkRehype/',
});
await fixture.build();
});
it('Renders footnotes with default English labels', async () => {
const html = await fixture.readFile('/index.html');
const $ = cheerio.load(html);
assert.equal($('#footnote-label').text(), 'Footnotes');
assert.equal($('.data-footnote-backref').first().attr('aria-label'), 'Back to reference 1');
});
});
describe('Astro Markdown with remark-rehype config', () => {
let fixture;
before(async () => {
fixture = await loadFixture({
root: './fixtures/astro-markdown-remarkRehype/',
markdown: {
remarkRehype: {
footnoteLabel: 'Catatan kaki',
footnoteBackLabel: 'Kembali ke konten',
},
},
});
await fixture.build();
});
it('Renders footnotes with values from the configuration', async () => {
const html = await fixture.readFile('/index.html');
const $ = cheerio.load(html);
assert.equal($('#footnote-label').text(), 'Catatan kaki');
assert.equal($('.data-footnote-backref').first().attr('aria-label'), 'Kembali ke konten');
});
});
|