summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/page.js47
1 files changed, 37 insertions, 10 deletions
diff --git a/test/page.js b/test/page.js
index 5f5c311..90a0260 100644
--- a/test/page.js
+++ b/test/page.js
@@ -5,29 +5,56 @@ describe('Page', function() {
before(function() {
return mock.setupDefaultBook({
- 'heading.md': '# Hello\n\n## World'
+ 'heading.md': '# Hello\n\n## World',
+ 'links.md': '[link](hello.md) [readme](README.md)'
})
.then(function(_book) {
book = _book;
- return book.summary.load();
+ return book.parse();
});
});
- it('should add a default ID to headings', function() {
- var page = book.addPage('heading.md');
+ describe('Headings', function() {
+ it('should add a default ID to headings', function() {
+ var page = book.addPage('heading.md');
- return page.parse()
- .then(function() {
+ return page.parse()
+ .then(function() {
+ page.content.should.be.html({
+ 'h1#hello': {
+ count: 1
+ },
+ 'h2#world': {
+ count: 1
+ }
+ });
+ });
+ });
+ });
+
+ describe('Links', function() {
+ var page;
+
+ before(function() {
+ page = book.addPage('links.md');
+ return page.parse();
+ });
+
+ it('should replace links to page to .html', function() {
page.content.should.be.html({
- 'h1#hello': {
- count: 1
- },
- 'h2#world': {
+ 'a[href="index.html"]': {
count: 1
}
});
});
+ it('should not replace links to file not in SUMMARY', function() {
+ page.content.should.be.html({
+ 'a[href="hello.md"]': {
+ count: 1
+ }
+ });
+ });
});
}); \ No newline at end of file