Skip to content

Commit d8686a0

Browse files
committed
test: should extract any content above <!-- more --> as excerpt
1 parent 0431e1c commit d8686a0

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

packages/@vuepress/core/lib/node/__tests__/prepare/Page.spec.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,14 @@ describe('markdown page', () => {
113113
expect(page._content.startsWith('---')).toBe(true)
114114
expect(page._strippedContent.startsWith('---')).toBe(false)
115115
})
116+
117+
test('should extract any content above <!-- more --> as excerpt', async () => {
118+
const { relative, filePath } = getDocument('excerpt.md')
119+
const markdown = getMarkdown()
120+
const page = await setupPage({ filePath, relative }, { markdown })
121+
122+
expect(page.excerpt).toMatchSnapshot()
123+
})
116124
})
117125

118126
describe('title', () => {
@@ -250,7 +258,6 @@ describe('public api', () => {
250258
// TODO permalink - driven by global pattern
251259
// TODO I18n
252260
// TODO Add a page with explicit content
253-
// TODO Excerpt
254261
// TODO SFC
255262
// TODO Headers
256263

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`markdown page should extract any content above <!-- more --> as excerpt 1`] = `
4+
<h1 id="excerpt"><a class="header-anchor" href="#excerpt" aria-hidden="true">#</a> Excerpt</h1>
5+
<p>Blablabla...</p>
6+
`;
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Excerpt
2+
3+
Blablabla...
4+
<!-- more -->

0 commit comments

Comments
 (0)