Skip to content

Commit ffd69ad

Browse files
committed
Add test for summary paths
Related to GitbookIO#674
1 parent 9004011 commit ffd69ad

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

test/assertions.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,9 @@ should.Assertion.add('html', function(rules, description) {
4646

4747
// Test attributes
4848
_.each(validations.attributes, function(value, name) {
49-
$el.attr(name).should.be.equal(value);
49+
var attr = $el.attr(name);
50+
should(attr).be.ok;
51+
attr.should.be.equal(value);
5052
});
5153
});
5254
});

test/summary.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,30 @@ describe('Summary', function () {
4141
book.should.have.file("PAGE1.html");
4242
book.should.have.file("folder/PAGE2.html");
4343
});
44+
45+
it('should correctly output summary', function() {
46+
var PAGE = fs.readFileSync(
47+
path.join(book.options.output, "index.html"),
48+
{ encoding: "utf-8" }
49+
);
50+
51+
PAGE.should.be.html({
52+
".book-summary .chapter[data-level='0'] a": {
53+
attributes: {
54+
href: "./index.html"
55+
}
56+
},
57+
".book-summary .chapter[data-level='1'] a": {
58+
attributes: {
59+
href: "./PAGE1.html"
60+
}
61+
},
62+
".book-summary .chapter[data-level='2'] a": {
63+
attributes: {
64+
href: "./folder/PAGE2.html"
65+
}
66+
}
67+
});
68+
});
4469
});
4570
});

0 commit comments

Comments
 (0)