astro/packages/astro/test/slots-svelte.test.js
Nate Moore ac3e870280
fix: renderer behavior with no children (#2078)
* fix: renderer behavior with no children

* [ci] Prettier fix

* Force CI

* fix: properly handle falsy values

* [ci] Prettier fix

* chore: force ci

* [experiment] netlify ignore

Co-authored-by: GitHub Action <github-action@users.noreply.github.com>
2021-12-02 10:30:15 -06:00

24 lines
845 B
JavaScript

import { expect } from 'chai';
import cheerio from 'cheerio';
import { loadFixture } from './test-utils.js';
describe('Slots: Svelte', () => {
let fixture;
before(async () => {
fixture = await loadFixture({ projectRoot: './fixtures/slots-svelte/', renderers: ['@astrojs/renderer-svelte'] });
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('');
expect($('#false').text().trim()).to.equal('');
expect($('#string').text().trim()).to.equal('');
expect($('#content').text().trim()).to.equal('Hello world!');
});
});