-
Notifications
You must be signed in to change notification settings - Fork 538
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extract business card test into separate file
- Loading branch information
1 parent
63ba98f
commit 89a41e3
Showing
4 changed files
with
29 additions
and
28 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
var test = require('tape') | ||
var pdf = require('../../') | ||
var path = require('path') | ||
var fs = require('fs') | ||
|
||
test('allows custom html and css', function (t) { | ||
t.plan(3) | ||
|
||
var template = path.join(__dirname, 'businesscard.html') | ||
var filename = template.replace('.html', '.pdf') | ||
var templateHtml = fs.readFileSync(template, 'utf8') | ||
|
||
var image = path.join('file://', __dirname, 'image.png') | ||
templateHtml = templateHtml.replace('{{image}}', image) | ||
|
||
var options = { | ||
width: '50mm', | ||
height: '90mm' | ||
} | ||
|
||
.create(templateHtml, options) | ||
.toFile(filename, function (err, pdf) { | ||
t.error(err) | ||
t.assert(pdf.filename, 'Returns the filename') | ||
t.assert(fs.existsSync(pdf.filename), 'Saves the file to the desired destination') | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters