Home / File/ mdx-astro-markdown-remarkRehype.test.js — astro Source File

mdx-astro-markdown-remarkRehype.test.js — astro Source File

Architecture documentation for mdx-astro-markdown-remarkRehype.test.js, a javascript file in the astro codebase. 6 imports, 0 dependents.

Entity Profile

Dependency Diagram

graph LR
  cf3a6bda_a2fc_f509_0076_7d17456e141c["mdx-astro-markdown-remarkRehype.test.js"]
  0a624eac_945e_c9e8_c9de_3feb9de2dd15["test-utils.js"]
  cf3a6bda_a2fc_f509_0076_7d17456e141c --> 0a624eac_945e_c9e8_c9de_3feb9de2dd15
  dd4f09ce_3fd7_8295_f616_8876cda4555c["loadFixture"]
  cf3a6bda_a2fc_f509_0076_7d17456e141c --> dd4f09ce_3fd7_8295_f616_8876cda4555c
  e1e2fac7_5a95_7a88_cb1e_0a3b91c4e607["strict"]
  cf3a6bda_a2fc_f509_0076_7d17456e141c --> e1e2fac7_5a95_7a88_cb1e_0a3b91c4e607
  6b0635f9_51ea_77aa_767b_7857878e98a6["node:test"]
  cf3a6bda_a2fc_f509_0076_7d17456e141c --> 6b0635f9_51ea_77aa_767b_7857878e98a6
  b05fd4c1_a3ee_3301_adcd_43b49bae78f1["mdx"]
  cf3a6bda_a2fc_f509_0076_7d17456e141c --> b05fd4c1_a3ee_3301_adcd_43b49bae78f1
  cb315bcc_59d8_fa19_79aa_5da7cd3730c5["linkedom"]
  cf3a6bda_a2fc_f509_0076_7d17456e141c --> cb315bcc_59d8_fa19_79aa_5da7cd3730c5
  style cf3a6bda_a2fc_f509_0076_7d17456e141c fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import * as assert from 'node:assert/strict';
import { describe, it } from 'node:test';
import mdx from '@astrojs/mdx';
import { parseHTML } from 'linkedom';
import { loadFixture } from '../../../astro/test/test-utils.js';

describe('MDX with Astro Markdown remark-rehype config', () => {
	it('Renders footnotes with values from the default configuration', async () => {
		const fixture = await loadFixture({
			root: new URL('./fixtures/mdx-astro-markdown-remarkRehype/', import.meta.url),
			integrations: [mdx()],
			markdown: {
				remarkRehype: {
					footnoteLabel: 'Catatan kaki',
					footnoteBackLabel: 'Kembali ke konten',
				},
			},
		});

		await fixture.build();
		const html = await fixture.readFile('/index.html');
		const { document } = parseHTML(html);

		assert.equal(document.querySelector('#footnote-label').textContent, 'Catatan kaki');
		assert.equal(
			document.querySelector('.data-footnote-backref').getAttribute('aria-label'),
			'Kembali ke konten',
		);
	});

	it('Renders footnotes with values from custom configuration extending the default', async () => {
		const fixture = await loadFixture({
			root: new URL('./fixtures/mdx-astro-markdown-remarkRehype/', import.meta.url),
			integrations: [
				mdx({
					remarkRehype: {
						footnoteLabel: 'Catatan kaki',
						footnoteBackLabel: 'Kembali ke konten',
					},
				}),
			],
			markdown: {
				remarkRehype: {
					footnoteBackLabel: 'Replace me',
				},
			},
		});

		await fixture.build();
		const html = await fixture.readFile('/index.html');
		const { document } = parseHTML(html);

		assert.equal(document.querySelector('#footnote-label').textContent, 'Catatan kaki');
		assert.equal(
			document.querySelector('.data-footnote-backref').getAttribute('aria-label'),
			'Kembali ke konten',
		);
	});

	it('Renders footnotes with values from custom configuration without extending the default', async () => {
		const fixture = await loadFixture({
			root: new URL('./fixtures/mdx-astro-markdown-remarkRehype/', import.meta.url),
			integrations: [
				mdx({
					extendPlugins: 'astroDefaults',
					remarkRehype: {
						footnoteLabel: 'Catatan kaki',
					},
				}),
			],
			markdown: {
				remarkRehype: {
					footnoteBackLabel: 'Kembali ke konten',
				},
			},
		});

		await fixture.build();
		const html = await fixture.readFile('/index.html');
		const { document } = parseHTML(html);

		assert.equal(document.querySelector('#footnote-label').textContent, 'Catatan kaki');
		assert.equal(
			document.querySelector('.data-footnote-backref').getAttribute('aria-label'),
			'Back to reference 1',
		);
	});
});

Domain

Dependencies

Frequently Asked Questions

What does mdx-astro-markdown-remarkRehype.test.js do?
mdx-astro-markdown-remarkRehype.test.js is a source file in the astro codebase, written in javascript. It belongs to the CoreAstro domain.
What does mdx-astro-markdown-remarkRehype.test.js depend on?
mdx-astro-markdown-remarkRehype.test.js imports 6 module(s): linkedom, loadFixture, mdx, node:test, strict, test-utils.js.
Where is mdx-astro-markdown-remarkRehype.test.js in the architecture?
mdx-astro-markdown-remarkRehype.test.js is located at packages/integrations/mdx/test/mdx-astro-markdown-remarkRehype.test.js (domain: CoreAstro, directory: packages/integrations/mdx/test).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free