diff --git a/packages/astro/test/astro-directives.test.js b/packages/astro/test/astro-directives.test.js index c4d868df3edf..80b4d32d1143 100644 --- a/packages/astro/test/astro-directives.test.js +++ b/packages/astro/test/astro-directives.test.js @@ -1,5 +1,5 @@ import assert from 'node:assert/strict'; -import { before, describe, it } from 'node:test'; +import { after, before, describe, it } from 'node:test'; import * as cheerio from 'cheerio'; import { loadFixture } from './test-utils.js'; @@ -117,4 +117,52 @@ describe('Directives', async () => { // Should not create Astro islands assert.equal($('astro-island').length, 0); }); + + it('set:html Fragment as slot (children)', async () => { + let res = await fixture.readFile('/set-html-children/index.html'); + assert.equal(res.includes('Test'), true); + }); +}); + +describe('set:html dev', () => { + /** @type {import('./test-utils').Fixture} */ + let fixture; + + before(async () => { + fixture = await loadFixture({ + root: './fixtures/astro-directives/', + }); + }); + + describe('Development', () => { + /** @type {import('./test-utils').DevServer} */ + let devServer; + + before(async () => { + devServer = await fixture.startDevServer(); + globalThis.TEST_FETCH = (fetch, url, init) => { + return fetch(fixture.resolveUrl(url), init); + }; + }); + + after(async () => { + await devServer.stop(); + }); + + it('set:html can take a fetch()', async () => { + let res = await fixture.fetch('/set-html-fetch'); + assert.equal(res.status, 200); + let html = await res.text(); + const $ = cheerio.load(html); + assert.equal($('#fetched-html').length, 1); + assert.equal($('#fetched-html').text(), 'works'); + }); + + it('set:html Fragment as slot (children) in dev', async () => { + let res = await fixture.fetch('/set-html-children'); + assert.equal(res.status, 200); + let html = await res.text(); + assert.equal(html.includes('Test'), true); + }); + }); }); diff --git a/packages/astro/test/astro-external-files.test.js b/packages/astro/test/astro-external-files.test.js index 80adb5986d45..5903f189d9c7 100644 --- a/packages/astro/test/astro-external-files.test.js +++ b/packages/astro/test/astro-external-files.test.js @@ -6,12 +6,12 @@ describe('External file references', () => { let fixture; before(async () => { - fixture = await loadFixture({ root: './fixtures/astro-external-files/' }); + fixture = await loadFixture({ root: './fixtures/astro-public/' }); await fixture.build(); }); it('Build with external reference', async () => { - const html = await fixture.readFile('/index.html'); + const html = await fixture.readFile('/external-files/index.html'); assert.equal(html.includes('