summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamy Pesse <samypesse@gmail.com>2016-02-13 10:49:56 +0100
committerSamy Pesse <samypesse@gmail.com>2016-02-13 10:49:56 +0100
commit3154d37e41da68a16ef29ec69d8896acd9da336a (patch)
tree3c016391c916352b4cabf050030dd2fc06d5bff3
parent272f30af532b247e2b13d2d0b59c89a041723e9a (diff)
downloadgitbook-3154d37e41da68a16ef29ec69d8896acd9da336a.zip
gitbook-3154d37e41da68a16ef29ec69d8896acd9da336a.tar.gz
gitbook-3154d37e41da68a16ef29ec69d8896acd9da336a.tar.bz2
Add more test for svg
-rw-r--r--test/assets-inliner.js23
1 files changed, 19 insertions, 4 deletions
diff --git a/test/assets-inliner.js b/test/assets-inliner.js
index 0636a1b..dd63b41 100644
--- a/test/assets-inliner.js
+++ b/test/assets-inliner.js
@@ -9,18 +9,21 @@ describe('Assets Inliner Output', function() {
var output;
before(function() {
+ var SVG = '<svg xmlns="http://www.w3.org/2000/svg" width="200" height="100" version="1.1"><rect width="200" height="100" stroke="black" stroke-width="6" fill="green"/></svg>';
+
return mock.outputDefaultBook(AssetsInliner, {
'README.md': '![image](test.svg)',
- 'test.svg': '<?xml version="1.0" encoding="UTF-8"?><svg xmlns="http://www.w3.org/2000/svg" width="200" height="100" version="1.1"><rect width="200" height="100" stroke="black" stroke-width="6" fill="green"/></svg>'
+ 'inline.md': 'This is a svg: '+SVG,
+ 'test.svg': '<?xml version="1.0" encoding="UTF-8"?>' + SVG
})
.then(function(_output) {
output = _output;
});
});
- it('should correctly convert to PNG', function() {
- var readme = output.book.getPage('README.md');
- var $ = cheerio.load(readme.content);
+ it('should correctly SVG files convert to PNG', function() {
+ var page = output.book.getPage('README.md');
+ var $ = cheerio.load(page.content);
// Is there an image?
var $img = $('img');
@@ -31,6 +34,18 @@ describe('Assets Inliner Output', function() {
output.should.have.file(src);
});
+ it('should correctly inline SVG convert to PNG', function() {
+ var page = output.book.addPage('README.md');
+ var $ = cheerio.load(page.content);
+
+ // Is there an image?
+ var $img = $('img');
+ $img.length.should.equal(1);
+
+ // Does the file exists
+ var src = $img.attr('src');
+ output.should.have.file(src);
+ });
});
});