summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorSamy Pesse <samypesse@gmail.com>2016-02-12 19:20:32 +0100
committerSamy Pesse <samypesse@gmail.com>2016-02-12 19:20:32 +0100
commit4555c541a8f98cb6ad4cbec2d7bf85b375dbf505 (patch)
tree0079507e1885a6c8a94a36644650a865f5e8cc5d /test
parenta853a51a0ba0976e8e28f368bd88717611b3c477 (diff)
downloadgitbook-4555c541a8f98cb6ad4cbec2d7bf85b375dbf505.zip
gitbook-4555c541a8f98cb6ad4cbec2d7bf85b375dbf505.tar.gz
gitbook-4555c541a8f98cb6ad4cbec2d7bf85b375dbf505.tar.bz2
Replace links to page of summary by html links
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