diff options
author | 2023-05-30 20:05:48 +0800 | |
---|---|---|
committer | 2023-05-30 08:05:48 -0400 | |
commit | cf621340b00fda441f4ef43196c0363d09eae70c (patch) | |
tree | e3fc963ba6dced58b7657b7cdedaed5c80f49c3b /packages/integrations/mdx/test/astro-content-css.test.js | |
parent | 29da199e9a11db7e7767e559d3344276f8b9a17e (diff) | |
download | astro-cf621340b00fda441f4ef43196c0363d09eae70c.tar.gz astro-cf621340b00fda441f4ef43196c0363d09eae70c.tar.zst astro-cf621340b00fda441f4ef43196c0363d09eae70c.zip |
Bug 6672 (#7062)
* fix miss a head when the templaterender has a promise
* fix
* add some test
* test files move to md directory
* fix add
* delect file
---------
Co-authored-by: wuls <linsheng.wu@beantechs.com>
Diffstat (limited to 'packages/integrations/mdx/test/astro-content-css.test.js')
-rw-r--r-- | packages/integrations/mdx/test/astro-content-css.test.js | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/packages/integrations/mdx/test/astro-content-css.test.js b/packages/integrations/mdx/test/astro-content-css.test.js new file mode 100644 index 000000000..7168795cd --- /dev/null +++ b/packages/integrations/mdx/test/astro-content-css.test.js @@ -0,0 +1,46 @@ +import { expect } from 'chai'; +import * as cheerio from 'cheerio'; +import { loadFixture } from '../../../astro/test/test-utils.js'; +import mdx from '@astrojs/mdx'; + +describe('build css from the component', async () => { + let fixture; + + before(async () => { + fixture = await loadFixture({ root: new URL('./fixtures/astro-content-css/', import.meta.url),integrations: [mdx()], }); + await fixture.build(); + }); + + describe('Build', () => { + before(async () => { + await fixture.build(); + }); + + it('including css and js from the component in pro', async () => { + const html = await fixture.readFile('/index.html'); + const $ = cheerio.load(html); + expect($('link[href$=".css"]').attr('href')).to.match(/^\/_astro\//); + expect($('script[src$=".js"]').attr('src')).to.match(/^\/_astro\//); + }); + }) + + describe('Dev', () => { + let devServer + before(async () => { + devServer = await fixture.startDevServer(); + }); + + after(async () => { + devServer.stop(); + }); + + it('ncluding css and js from the component in Dev', async () => { + let res = await fixture.fetch(`/`); + expect(res.status).to.equal(200); + const html = await res.text(); + const $ = cheerio.load(html); + expect($.html()).to.include('CornflowerBlue'); + expect($('script[src$=".js"]').attr('src')).to.include('astro'); + }); + }) +}) |