summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamy Pessé <samypesse@gmail.com>2015-06-02 10:18:44 +0200
committerSamy Pessé <samypesse@gmail.com>2015-06-02 10:18:44 +0200
commitaddac85696aa836f504993b5536b3ecbf7c124c5 (patch)
tree96b7dee03ee0e4d68d043999a4e571a8197e0f19
parentf998e2dec9281cf5194383f8c69f267d31fa36c0 (diff)
downloadgitbook-addac85696aa836f504993b5536b3ecbf7c124c5.zip
gitbook-addac85696aa836f504993b5536b3ecbf7c124c5.tar.gz
gitbook-addac85696aa836f504993b5536b3ecbf7c124c5.tar.bz2
Add test for custom print style
-rw-r--r--test/books/style-print/README.md3
-rw-r--r--test/books/style-print/SUMMARY.md1
-rw-r--r--test/books/style-print/styles/print.css3
-rw-r--r--test/ebook.js31
4 files changed, 38 insertions, 0 deletions
diff --git a/test/books/style-print/README.md b/test/books/style-print/README.md
new file mode 100644
index 0000000..09ade40
--- /dev/null
+++ b/test/books/style-print/README.md
@@ -0,0 +1,3 @@
+# Readme
+
+Default description for the book.
diff --git a/test/books/style-print/SUMMARY.md b/test/books/style-print/SUMMARY.md
new file mode 100644
index 0000000..ac9323c
--- /dev/null
+++ b/test/books/style-print/SUMMARY.md
@@ -0,0 +1 @@
+# Summary
diff --git a/test/books/style-print/styles/print.css b/test/books/style-print/styles/print.css
new file mode 100644
index 0000000..b05faf8
--- /dev/null
+++ b/test/books/style-print/styles/print.css
@@ -0,0 +1,3 @@
+body {
+ color: red;
+}
diff --git a/test/ebook.js b/test/ebook.js
index c9bb924..9b353d2 100644
--- a/test/ebook.js
+++ b/test/ebook.js
@@ -21,4 +21,35 @@ describe('eBook generator', function () {
book.should.have.file("gitbook/style.css");
});
});
+
+ describe('Custom styles', function() {
+ var book;
+
+ before(function() {
+ return books.generate("style-print", "ebook")
+ .then(function(_book) {
+ book = _book;
+ });
+ });
+
+ it('should remove default print.css', function() {
+ var PAGE = fs.readFileSync(
+ path.join(book.options.output, "index.html"),
+ { encoding: "utf-8" }
+ );
+ PAGE.should.be.html({
+ "link": {
+ count: 1,
+ attributes: {
+ href: "./styles/print.css"
+ }
+ }
+ });
+ });
+
+ it('should correctly print.css', function() {
+ book.should.have.file("styles");
+ book.should.have.file("styles/print.css");
+ });
+ })
});