diff options
author | Samy Pessé <samypesse@gmail.com> | 2016-02-26 09:41:26 +0100 |
---|---|---|
committer | Samy Pessé <samypesse@gmail.com> | 2016-02-26 09:41:26 +0100 |
commit | d3d64f636c859f7f01a64f7774cf70bd8ccdc562 (patch) | |
tree | 4f7731f37c3a793d187b0ab1cd77680e69534c6c /test/images.js | |
parent | 4cb9cbb5ae3aa8f9211ffa3ac5e3d34232c0ca4f (diff) | |
parent | eef072693b17526347c37b66078a5059c71caa31 (diff) | |
download | gitbook-d3d64f636c859f7f01a64f7774cf70bd8ccdc562.zip gitbook-d3d64f636c859f7f01a64f7774cf70bd8ccdc562.tar.gz gitbook-d3d64f636c859f7f01a64f7774cf70bd8ccdc562.tar.bz2 |
Merge pull request #1109 from GitbookIO/3.0.0
Version 3.0.0
Diffstat (limited to 'test/images.js')
-rw-r--r-- | test/images.js | 58 |
1 files changed, 0 insertions, 58 deletions
diff --git a/test/images.js b/test/images.js deleted file mode 100644 index de45066..0000000 --- a/test/images.js +++ /dev/null @@ -1,58 +0,0 @@ -var fs = require("fs"); -var _ = require("lodash"); -var path = require("path"); -var cheerio = require("cheerio"); - -describe("Images", function () { - var book, readme, $, $img, srcs; - - before(function() { - return books.generate("images", "ebook") - .then(function(_book) { - book = _book; - - readme = fs.readFileSync( - path.join(book.options.output, "index.html"), - { encoding: "utf-8" } - ); - $ = cheerio.load(readme); - $img = $("img"); - srcs = $img.map(function() { - return $(this).attr("src"); - }); - }); - }); - - it("should detect all images", function() { - _.uniq(srcs).should.have.lengthOf(4); - }); - - it("should keep image tags", function() { - srcs.should.have.lengthOf(5); - }); - - it("should not have .svg files", function() { - _.each(srcs, function(src) { - path.extname(src).should.not.equal(".svg"); - }); - }); - - it("should correctly convert svg images to png", function() { - _.each(srcs, function(src) { - book.should.have.file(src); - }); - }); - - it("should handle relative paths", function() { - var PAGE = fs.readFileSync( - path.join(book.options.output, "folder/PAGE.html"), - { encoding: "utf-8" } - ); - - PAGE.should.be.html({ - "img[src=\"../test.png\"]": { - count: 1 - } - }); - }); -}); |