-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: JSX expressions, components, syntax highlighting
- Loading branch information
1 parent
207a1fa
commit 547687c
Showing
1 changed file
with
55 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import { expect } from 'chai'; | ||
import * as cheerio from 'cheerio'; | ||
import { loadFixture, fixLineEndings } from './test-utils.js'; | ||
|
||
describe('Astro Markdown - plain MD mode', () => { | ||
let fixture; | ||
|
||
before(async () => { | ||
fixture = await loadFixture({ | ||
root: './fixtures/astro-markdown/', | ||
markdown: { | ||
mode: 'md', | ||
}, | ||
}); | ||
await fixture.build(); | ||
}); | ||
|
||
it('Leaves JSX expressions unprocessed', async () => { | ||
const html = await fixture.readFile('/jsx-expressions/index.html'); | ||
const $ = cheerio.load(html); | ||
|
||
expect($('h2').html()).to.equal('{frontmatter.title}'); | ||
}); | ||
|
||
it('Leaves JSX components un-transformed', async () => { | ||
const html = await fixture.readFile('/children/index.html'); | ||
|
||
expect(html).to.include('<textblock title="Hello world!" nopadding="">'); | ||
}); | ||
|
||
describe('syntax highlighting', async () => { | ||
it('handles Shiki', async () => { | ||
const html = await fixture.readFile('/code-in-md/index.html'); | ||
const $ = cheerio.load(html); | ||
|
||
expect($('pre.astro-code').length).to.not.equal(0); | ||
}); | ||
|
||
it('handles Prism', async () => { | ||
fixture = await loadFixture({ | ||
root: './fixtures/astro-markdown/', | ||
markdown: { | ||
syntaxHighlight: 'prism', | ||
mode: 'md', | ||
}, | ||
}); | ||
await fixture.build(); | ||
|
||
const html = await fixture.readFile('/code-in-md/index.html'); | ||
const $ = cheerio.load(html); | ||
|
||
expect($('pre.language-html').length).to.not.equal(0); | ||
}); | ||
}); | ||
}); |