Merge branch 'master' of gitlab.com:pushrocks/smartpdf
This commit is contained in:
commit
36fea0b0f2
BIN
assets/pdfdir/ERpClkJ4T.pdf
Normal file
BIN
assets/pdfdir/ERpClkJ4T.pdf
Normal file
Binary file not shown.
BIN
assets/pdfdir/deSPavVfr.pdf
Normal file
BIN
assets/pdfdir/deSPavVfr.pdf
Normal file
Binary file not shown.
BIN
assets/pdfdir/yR7XuEXeT.pdf
Normal file
BIN
assets/pdfdir/yR7XuEXeT.pdf
Normal file
Binary file not shown.
@ -8,6 +8,10 @@ tap.test('should create a valid instance of smartpdf', async () => {
|
|||||||
expect(testSmartPdf).to.be.instanceof(smartpdf.SmartPdf);
|
expect(testSmartPdf).to.be.instanceof(smartpdf.SmartPdf);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
tap.test('should start the instance', async () => {
|
||||||
|
await testSmartPdf.start();
|
||||||
|
});
|
||||||
|
|
||||||
tap.test('should create a pdf from html string', async () => {
|
tap.test('should create a pdf from html string', async () => {
|
||||||
await testSmartPdf.getPdfForHtmlString('hi');
|
await testSmartPdf.getPdfForHtmlString('hi');
|
||||||
});
|
});
|
||||||
@ -21,7 +25,7 @@ tap.test('should create a pdf from website as single page PDF', async () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
tap.test('should be able to close properly', async () => {
|
tap.test('should be able to close properly', async () => {
|
||||||
await testSmartPdf.close();
|
await testSmartPdf.stop();
|
||||||
});
|
});
|
||||||
|
|
||||||
tap.start();
|
tap.start();
|
||||||
|
@ -14,10 +14,9 @@ export class SmartPdf {
|
|||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
this._readyDeferred = new plugins.smartpromise.Deferred();
|
this._readyDeferred = new plugins.smartpromise.Deferred();
|
||||||
this.init();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async init() {
|
async start() {
|
||||||
// setup puppeteer
|
// setup puppeteer
|
||||||
this.headlessBrowser = await plugins.puppeteer.launch();
|
this.headlessBrowser = await plugins.puppeteer.launch();
|
||||||
|
|
||||||
@ -36,7 +35,7 @@ export class SmartPdf {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async close() {
|
async stop() {
|
||||||
const done = plugins.smartpromise.defer<void>();
|
const done = plugins.smartpromise.defer<void>();
|
||||||
this.htmlServerInstance.close(() => {
|
this.htmlServerInstance.close(() => {
|
||||||
done.resolve();
|
done.resolve();
|
||||||
|
Loading…
Reference in New Issue
Block a user