diff options
author | Samy Pessé <samypesse@gmail.com> | 2015-03-24 11:54:03 +0100 |
---|---|---|
committer | Samy Pessé <samypesse@gmail.com> | 2015-03-24 11:54:03 +0100 |
commit | afbca4bdf522f01e12cf61ec738c5c81fc05209b (patch) | |
tree | a8036419c8817e261f759a9fc0aab7511c1e071c /test/glossary.js | |
parent | b61371942b0b29df418a1d7fda4fbec82afb534f (diff) | |
download | gitbook-afbca4bdf522f01e12cf61ec738c5c81fc05209b.zip gitbook-afbca4bdf522f01e12cf61ec738c5c81fc05209b.tar.gz gitbook-afbca4bdf522f01e12cf61ec738c5c81fc05209b.tar.bz2 |
Improve tests for glossary
Diffstat (limited to 'test/glossary.js')
-rw-r--r-- | test/glossary.js | 36 |
1 files changed, 29 insertions, 7 deletions
diff --git a/test/glossary.js b/test/glossary.js index c616a51..acfd184 100644 --- a/test/glossary.js +++ b/test/glossary.js @@ -33,21 +33,43 @@ describe('Glossary', function () { }); describe('Page Integration', function() { - var page; + var readme, page; before(function() { - page = fs.readFileSync( + readme = fs.readFileSync( path.join(book.options.output, "index.html"), { encoding: "utf-8" } ); + page = fs.readFileSync( + path.join(book.options.output, "folder/PAGE.html"), + { encoding: "utf-8" } + ); }); it('should correctly replaced terms by links', function() { - page.should.be.html(".page-inner a[href='GLOSSARY.html#test']", { - count: 1, - text: "test", - attributes: { - title: "Just a simple and easy to understand test." + readme.should.be.html({ + ".page-inner a[href='GLOSSARY.html#test']": { + count: 1, + text: "test", + attributes: { + title: "Just a simple and easy to understand test." + } + } + }); + }); + + it('should correctly replaced terms by links (relative)', function() { + page.should.be.html({ + ".page-inner a[href='../GLOSSARY.html#test']": { + count: 1 + } + }); + }); + + it('should not replace terms in codeblocks', function() { + readme.should.be.html({ + ".page-inner code a": { + count: 0 } }); }); |