diff options
author | Samy Pessé <samypesse@gmail.com> | 2015-10-21 18:05:40 +0200 |
---|---|---|
committer | Samy Pessé <samypesse@gmail.com> | 2015-10-21 18:05:40 +0200 |
commit | 27a43d5aea920faefc01caac9c8e5a60fa05097b (patch) | |
tree | 7efad6611750626cf2c32147bcff33760827e536 /test/heading.js | |
parent | 4e90becd525e88905c44d3f8a3984885c7c9014d (diff) | |
parent | df1d5a06802154c5b6fb922c73365d2afceaecd9 (diff) | |
download | gitbook-27a43d5aea920faefc01caac9c8e5a60fa05097b.zip gitbook-27a43d5aea920faefc01caac9c8e5a60fa05097b.tar.gz gitbook-27a43d5aea920faefc01caac9c8e5a60fa05097b.tar.bz2 |
Merge pull request #986 from GitbookIO/fix/heading_ids
Normalize ID for headings
Diffstat (limited to 'test/heading.js')
-rw-r--r-- | test/heading.js | 37 |
1 files changed, 37 insertions, 0 deletions
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 + } + }); + }); + }); +}); + |