summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamy Pessé <samypesse@gmail.com>2015-03-28 15:28:28 +0100
committerSamy Pessé <samypesse@gmail.com>2015-03-28 15:28:28 +0100
commitffd69ad1f2f869796f10c425e67680fd7f223ff5 (patch)
treebd41cf93504cb1abe7f8dc185d13e07ff1013a9e
parent90040114797857a52308b5ecbbd08b1dd6f78464 (diff)
downloadgitbook-ffd69ad1f2f869796f10c425e67680fd7f223ff5.zip
gitbook-ffd69ad1f2f869796f10c425e67680fd7f223ff5.tar.gz
gitbook-ffd69ad1f2f869796f10c425e67680fd7f223ff5.tar.bz2
Add test for summary paths
Related to #674
-rw-r--r--test/assertions.js4
-rw-r--r--test/summary.js25
2 files changed, 28 insertions, 1 deletions
diff --git a/test/assertions.js b/test/assertions.js
index 443929a..d807d4d 100644
--- a/test/assertions.js
+++ b/test/assertions.js
@@ -46,7 +46,9 @@ should.Assertion.add('html', function(rules, description) {
// Test attributes
_.each(validations.attributes, function(value, name) {
- $el.attr(name).should.be.equal(value);
+ var attr = $el.attr(name);
+ should(attr).be.ok;
+ attr.should.be.equal(value);
});
});
});
diff --git a/test/summary.js b/test/summary.js
index 99cdf6b..9c6df00 100644
--- a/test/summary.js
+++ b/test/summary.js
@@ -41,5 +41,30 @@ describe('Summary', function () {
book.should.have.file("PAGE1.html");
book.should.have.file("folder/PAGE2.html");
});
+
+ it('should correctly output summary', function() {
+ var PAGE = fs.readFileSync(
+ path.join(book.options.output, "index.html"),
+ { encoding: "utf-8" }
+ );
+
+ PAGE.should.be.html({
+ ".book-summary .chapter[data-level='0'] a": {
+ attributes: {
+ href: "./index.html"
+ }
+ },
+ ".book-summary .chapter[data-level='1'] a": {
+ attributes: {
+ href: "./PAGE1.html"
+ }
+ },
+ ".book-summary .chapter[data-level='2'] a": {
+ attributes: {
+ href: "./folder/PAGE2.html"
+ }
+ }
+ });
+ });
});
});