summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorSamy Pessé <samypesse@gmail.com>2015-10-21 17:58:06 +0200
committerSamy Pessé <samypesse@gmail.com>2015-10-21 17:58:06 +0200
commitdf1d5a06802154c5b6fb922c73365d2afceaecd9 (patch)
tree7efad6611750626cf2c32147bcff33760827e536 /test
parent722109faf0408fce189a142776bf10773f8682b4 (diff)
downloadgitbook-df1d5a06802154c5b6fb922c73365d2afceaecd9.zip
gitbook-df1d5a06802154c5b6fb922c73365d2afceaecd9.tar.gz
gitbook-df1d5a06802154c5b6fb922c73365d2afceaecd9.tar.bz2
Correctly generate id if none found
Diffstat (limited to 'test')
-rw-r--r--test/books/headings/README.md3
-rw-r--r--test/books/headings/SUMMARY.md0
-rw-r--r--test/heading.js37
3 files changed, 40 insertions, 0 deletions
diff --git a/test/books/headings/README.md b/test/books/headings/README.md
new file mode 100644
index 0000000..b08c485
--- /dev/null
+++ b/test/books/headings/README.md
@@ -0,0 +1,3 @@
+# Hello World
+
+## Hello {#hello-custom}
diff --git a/test/books/headings/SUMMARY.md b/test/books/headings/SUMMARY.md
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test/books/headings/SUMMARY.md
diff --git a/test/heading.js b/test/heading.js
new file mode 100644
index 0000000..f6d65c3
--- /dev/null
+++ b/test/heading.js
@@ -0,0 +1,37 @@
+var path = require('path');
+var fs = require('fs');
+
+describe('Headings', function () {
+ var book, PAGE;
+
+ before(function() {
+ return books.generate('headings', 'website')
+ .then(function(_book) {
+ book = _book;
+
+ PAGE = fs.readFileSync(
+ path.join(book.options.output, 'index.html'),
+ { encoding: 'utf-8' }
+ );
+ });
+ });
+
+ describe('IDs', function() {
+ it('should correctly generate an ID', function() {
+ PAGE.should.be.html({
+ 'h1#hello-world': {
+ count: 1
+ }
+ });
+ });
+
+ it('should correctly accept custom ID', function() {
+ PAGE.should.be.html({
+ 'h2#hello-custom': {
+ count: 1
+ }
+ });
+ });
+ });
+});
+