astro/packages/astro/test/slots-solid.test.js
Matthew Phillips 259a539d7d
Remove legacy.astroFlavoredMarkdown (#5771)
* Remove legacy.astroFlavoredMarkdown

* update vue mdx test

* Add a changeset
2023-01-05 16:20:40 -05:00

56 lines
1.8 KiB
JavaScript

import { expect } from 'chai';
import * as cheerio from 'cheerio';
import { loadFixture } from './test-utils.js';
describe('Slots: Solid', () => {
let fixture;
before(async () => {
fixture = await loadFixture({ root: './fixtures/slots-solid/' });
await fixture.build();
});
it('Renders default slot', async () => {
const html = await fixture.readFile('/index.html');
const $ = cheerio.load(html);
expect($('#default-self-closing').text().trim()).to.equal('Fallback');
expect($('#default-empty').text().trim()).to.equal('Fallback');
expect($('#zero').text().trim()).to.equal('0');
expect($('#false').text().trim()).to.equal('');
expect($('#string').text().trim()).to.equal('');
expect($('#content').text().trim()).to.equal('Hello world!');
});
it('Renders named slot', async () => {
const html = await fixture.readFile('/index.html');
const $ = cheerio.load(html);
expect($('#named').text().trim()).to.equal('Fallback / Named');
});
it('Converts dash-case slot to camelCase', async () => {
const html = await fixture.readFile('/index.html');
const $ = cheerio.load(html);
expect($('#dash-case').text().trim()).to.equal('Fallback / Dash Case');
});
describe('For MDX Pages', () => {
it('Renders default slot', async () => {
const html = await fixture.readFile('/mdx/index.html');
const $ = cheerio.load(html);
expect($('#content').text().trim()).to.equal('Hello world!');
});
it('Renders named slot', async () => {
const html = await fixture.readFile('/mdx/index.html');
const $ = cheerio.load(html);
expect($('#named').text().trim()).to.equal('Fallback / Named');
});
it('Converts dash-case slot to camelCase', async () => {
const html = await fixture.readFile('/mdx/index.html');
const $ = cheerio.load(html);
expect($('#dash-case').text().trim()).to.equal('Fallback / Dash Case');
});
});
});