[Pkg-javascript-commits] [pdf.js] 155/210: Add more unit tests for the API
David Prévot
taffit at moszumanska.debian.org
Thu Jun 5 14:21:12 UTC 2014
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch upstream
in repository pdf.js.
commit a984fe5b55b3e7a0fad47badf8af2f5ef8d6de3a
Author: Jonas Jenwald <jonas.jenwald at gmail.com>
Date: Sun May 18 23:35:29 2014 +0200
Add more unit tests for the API
---
src/core/obj.js | 2 +-
test/unit/api_spec.js | 18 ++++++++++++++++++
2 files changed, 19 insertions(+), 1 deletion(-)
diff --git a/src/core/obj.js b/src/core/obj.js
index 9c2c77f..6c11319 100644
--- a/src/core/obj.js
+++ b/src/core/obj.js
@@ -449,7 +449,7 @@ var Catalog = (function CatalogClosure() {
},
get attachments() {
var xref = this.xref;
- var attachments, nameTreeRef;
+ var attachments = null, nameTreeRef;
var obj = this.catDict.get('Names');
if (obj) {
nameTreeRef = obj.getRaw('EmbeddedFiles');
diff --git a/test/unit/api_spec.js b/test/unit/api_spec.js
index 1331cf0..dfdb010 100644
--- a/test/unit/api_spec.js
+++ b/test/unit/api_spec.js
@@ -69,6 +69,18 @@ describe('api', function() {
0, 841.89, null] });
});
});
+ it('gets attachments', function() {
+ var promise = doc.getAttachments();
+ waitsForPromise(promise, function (data) {
+ expect(data).toEqual(null);
+ });
+ });
+ it('gets javascript', function() {
+ var promise = doc.getJavaScript();
+ waitsForPromise(promise, function (data) {
+ expect(data).toEqual([]);
+ });
+ });
it('gets outline', function() {
var promise = doc.getOutline();
waitsForPromise(promise, function(outline) {
@@ -93,6 +105,12 @@ describe('api', function() {
expect(true).toEqual(true);
});
});
+ it('gets filesize in bytes', function() {
+ var promise = doc.getDownloadInfo();
+ waitsForPromise(promise, function (data) {
+ expect(data.length).toEqual(105779);
+ });
+ });
});
describe('Page', function() {
var resolvePromise;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/pdf.js.git
More information about the Pkg-javascript-commits
mailing list