mdx-slots.test.js — astro Source File
Architecture documentation for mdx-slots.test.js, a javascript file in the astro codebase. 6 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 32da8a94_9856_e1c5_b7b5_f643c0efdb36["mdx-slots.test.js"] 0a624eac_945e_c9e8_c9de_3feb9de2dd15["test-utils.js"] 32da8a94_9856_e1c5_b7b5_f643c0efdb36 --> 0a624eac_945e_c9e8_c9de_3feb9de2dd15 dd4f09ce_3fd7_8295_f616_8876cda4555c["loadFixture"] 32da8a94_9856_e1c5_b7b5_f643c0efdb36 --> dd4f09ce_3fd7_8295_f616_8876cda4555c e1e2fac7_5a95_7a88_cb1e_0a3b91c4e607["strict"] 32da8a94_9856_e1c5_b7b5_f643c0efdb36 --> e1e2fac7_5a95_7a88_cb1e_0a3b91c4e607 6b0635f9_51ea_77aa_767b_7857878e98a6["node:test"] 32da8a94_9856_e1c5_b7b5_f643c0efdb36 --> 6b0635f9_51ea_77aa_767b_7857878e98a6 b05fd4c1_a3ee_3301_adcd_43b49bae78f1["mdx"] 32da8a94_9856_e1c5_b7b5_f643c0efdb36 --> b05fd4c1_a3ee_3301_adcd_43b49bae78f1 cb315bcc_59d8_fa19_79aa_5da7cd3730c5["linkedom"] 32da8a94_9856_e1c5_b7b5_f643c0efdb36 --> cb315bcc_59d8_fa19_79aa_5da7cd3730c5 style 32da8a94_9856_e1c5_b7b5_f643c0efdb36 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import * as assert from 'node:assert/strict';
import { after, before, describe, it } from 'node:test';
import mdx from '@astrojs/mdx';
import { parseHTML } from 'linkedom';
import { loadFixture } from '../../../astro/test/test-utils.js';
describe('MDX slots', () => {
let fixture;
before(async () => {
fixture = await loadFixture({
root: new URL('./fixtures/mdx-slots/', import.meta.url),
integrations: [mdx()],
});
});
describe('build', () => {
before(async () => {
await fixture.build();
});
it('supports top-level imports', async () => {
const html = await fixture.readFile('/index.html');
const { document } = parseHTML(html);
const h1 = document.querySelector('h1');
const defaultSlot = document.querySelector('[data-default-slot]');
const namedSlot = document.querySelector('[data-named-slot]');
assert.equal(h1.textContent, 'Hello slotted component!');
assert.equal(defaultSlot.textContent, 'Default content.');
assert.equal(namedSlot.textContent, 'Content for named slot.');
});
it('supports glob imports - <Component.default />', async () => {
const html = await fixture.readFile('/glob/index.html');
const { document } = parseHTML(html);
const h1 = document.querySelector('[data-default-export] h1');
const defaultSlot = document.querySelector('[data-default-export] [data-default-slot]');
const namedSlot = document.querySelector('[data-default-export] [data-named-slot]');
assert.equal(h1.textContent, 'Hello slotted component!');
assert.equal(defaultSlot.textContent, 'Default content.');
assert.equal(namedSlot.textContent, 'Content for named slot.');
});
it('supports glob imports - <Content />', async () => {
const html = await fixture.readFile('/glob/index.html');
const { document } = parseHTML(html);
const h1 = document.querySelector('[data-content-export] h1');
const defaultSlot = document.querySelector('[data-content-export] [data-default-slot]');
const namedSlot = document.querySelector('[data-content-export] [data-named-slot]');
assert.equal(h1.textContent, 'Hello slotted component!');
assert.equal(defaultSlot.textContent, 'Default content.');
assert.equal(namedSlot.textContent, 'Content for named slot.');
});
});
// ... (65 more lines)
Domain
Dependencies
- linkedom
- loadFixture
- mdx
- node:test
- strict
- test-utils.js
Source
Frequently Asked Questions
What does mdx-slots.test.js do?
mdx-slots.test.js is a source file in the astro codebase, written in javascript. It belongs to the CoreAstro domain.
What does mdx-slots.test.js depend on?
mdx-slots.test.js imports 6 module(s): linkedom, loadFixture, mdx, node:test, strict, test-utils.js.
Where is mdx-slots.test.js in the architecture?
mdx-slots.test.js is located at packages/integrations/mdx/test/mdx-slots.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