Browse Source

Let the two annotation factories use static methods

This corresponds to how other factories are implemented.
Tim van der Meij 8 years ago
parent
commit
4f02857394
No known key found for this signature in database
GPG Key ID: 8C3FD2925A5F2762
  1. 2
      src/core/annotation.js
  2. 3
      src/core/document.js
  3. 6
      src/display/annotation_layer.js
  4. 90
      test/unit/annotation_spec.js

2
src/core/annotation.js

@ -32,7 +32,7 @@ class AnnotationFactory {
* @param {Object} idFactory * @param {Object} idFactory
* @returns {Annotation} * @returns {Annotation}
*/ */
create(xref, ref, pdfManager, idFactory) { static create(xref, ref, pdfManager, idFactory) {
let dict = xref.fetchIfRef(ref); let dict = xref.fetchIfRef(ref);
if (!isDict(dict)) { if (!isDict(dict)) {
return; return;

3
src/core/document.js

@ -316,10 +316,9 @@ var Page = (function PageClosure() {
get annotations() { get annotations() {
var annotations = []; var annotations = [];
var annotationRefs = this.getInheritedPageProp('Annots') || []; var annotationRefs = this.getInheritedPageProp('Annots') || [];
var annotationFactory = new AnnotationFactory();
for (var i = 0, n = annotationRefs.length; i < n; ++i) { for (var i = 0, n = annotationRefs.length; i < n; ++i) {
var annotationRef = annotationRefs[i]; var annotationRef = annotationRefs[i];
var annotation = annotationFactory.create(this.xref, annotationRef, var annotation = AnnotationFactory.create(this.xref, annotationRef,
this.pdfManager, this.pdfManager,
this.idFactory); this.idFactory);
if (annotation) { if (annotation) {

6
src/display/annotation_layer.js

@ -38,7 +38,7 @@ class AnnotationElementFactory {
* @param {AnnotationElementParameters} parameters * @param {AnnotationElementParameters} parameters
* @returns {AnnotationElement} * @returns {AnnotationElement}
*/ */
create(parameters) { static create(parameters) {
let subtype = parameters.data.annotationType; let subtype = parameters.data.annotationType;
switch (subtype) { switch (subtype) {
@ -974,14 +974,12 @@ class AnnotationLayer {
* @memberof AnnotationLayer * @memberof AnnotationLayer
*/ */
static render(parameters) { static render(parameters) {
let annotationElementFactory = new AnnotationElementFactory();
for (let i = 0, ii = parameters.annotations.length; i < ii; i++) { for (let i = 0, ii = parameters.annotations.length; i < ii; i++) {
let data = parameters.annotations[i]; let data = parameters.annotations[i];
if (!data) { if (!data) {
continue; continue;
} }
let element = annotationElementFactory.create({ let element = AnnotationElementFactory.create({
data, data,
layer: parameters.div, layer: parameters.div,
page: parameters.page, page: parameters.page,

90
test/unit/annotation_spec.js

@ -44,10 +44,9 @@ describe('annotation', function() {
} }
IdFactoryMock.prototype = {}; IdFactoryMock.prototype = {};
var annotationFactory, pdfManagerMock, idFactoryMock; var pdfManagerMock, idFactoryMock;
beforeAll(function (done) { beforeAll(function (done) {
annotationFactory = new AnnotationFactory();
pdfManagerMock = new PDFManagerMock({ pdfManagerMock = new PDFManagerMock({
docBaseUrl: null, docBaseUrl: null,
}); });
@ -56,7 +55,6 @@ describe('annotation', function() {
}); });
afterAll(function () { afterAll(function () {
annotationFactory = null;
pdfManagerMock = null; pdfManagerMock = null;
idFactoryMock = null; idFactoryMock = null;
}); });
@ -72,7 +70,7 @@ describe('annotation', function() {
{ ref: annotationRef, data: annotationDict, } { ref: annotationRef, data: annotationDict, }
]); ]);
var annotation = annotationFactory.create(xref, annotationRef, var annotation = AnnotationFactory.create(xref, annotationRef,
pdfManagerMock, idFactoryMock); pdfManagerMock, idFactoryMock);
var data = annotation.data; var data = annotation.data;
expect(data.annotationType).toEqual(AnnotationType.LINK); expect(data.annotationType).toEqual(AnnotationType.LINK);
@ -92,9 +90,9 @@ describe('annotation', function() {
startObjId: 0, startObjId: 0,
}); });
var annotation1 = annotationFactory.create(xref, annotationDict, var annotation1 = AnnotationFactory.create(xref, annotationDict,
pdfManagerMock, idFactory); pdfManagerMock, idFactory);
var annotation2 = annotationFactory.create(xref, annotationDict, var annotation2 = AnnotationFactory.create(xref, annotationDict,
pdfManagerMock, idFactory); pdfManagerMock, idFactory);
var data1 = annotation1.data, data2 = annotation2.data; var data1 = annotation1.data, data2 = annotation2.data;
expect(data1.annotationType).toEqual(AnnotationType.LINK); expect(data1.annotationType).toEqual(AnnotationType.LINK);
@ -113,7 +111,7 @@ describe('annotation', function() {
{ ref: annotationRef, data: annotationDict, } { ref: annotationRef, data: annotationDict, }
]); ]);
var annotation = annotationFactory.create(xref, annotationRef, var annotation = AnnotationFactory.create(xref, annotationRef,
pdfManagerMock, idFactoryMock); pdfManagerMock, idFactoryMock);
var data = annotation.data; var data = annotation.data;
expect(data.annotationType).toBeUndefined(); expect(data.annotationType).toBeUndefined();
@ -298,7 +296,7 @@ describe('annotation', function() {
{ ref: annotationRef, data: annotationDict, } { ref: annotationRef, data: annotationDict, }
]); ]);
var annotation = annotationFactory.create(xref, annotationRef, var annotation = AnnotationFactory.create(xref, annotationRef,
pdfManagerMock, idFactoryMock); pdfManagerMock, idFactoryMock);
var data = annotation.data; var data = annotation.data;
expect(data.annotationType).toEqual(AnnotationType.LINK); expect(data.annotationType).toEqual(AnnotationType.LINK);
@ -326,7 +324,7 @@ describe('annotation', function() {
{ ref: annotationRef, data: annotationDict, } { ref: annotationRef, data: annotationDict, }
]); ]);
var annotation = annotationFactory.create(xref, annotationRef, var annotation = AnnotationFactory.create(xref, annotationRef,
pdfManagerMock, idFactoryMock); pdfManagerMock, idFactoryMock);
var data = annotation.data; var data = annotation.data;
expect(data.annotationType).toEqual(AnnotationType.LINK); expect(data.annotationType).toEqual(AnnotationType.LINK);
@ -359,7 +357,7 @@ describe('annotation', function() {
{ ref: annotationRef, data: annotationDict, } { ref: annotationRef, data: annotationDict, }
]); ]);
var annotation = annotationFactory.create(xref, annotationRef, var annotation = AnnotationFactory.create(xref, annotationRef,
pdfManagerMock, idFactoryMock); pdfManagerMock, idFactoryMock);
var data = annotation.data; var data = annotation.data;
expect(data.annotationType).toEqual(AnnotationType.LINK); expect(data.annotationType).toEqual(AnnotationType.LINK);
@ -389,7 +387,7 @@ describe('annotation', function() {
{ ref: annotationRef, data: annotationDict, } { ref: annotationRef, data: annotationDict, }
]); ]);
var annotation = annotationFactory.create(xref, annotationRef, var annotation = AnnotationFactory.create(xref, annotationRef,
pdfManagerMock, idFactoryMock); pdfManagerMock, idFactoryMock);
var data = annotation.data; var data = annotation.data;
expect(data.annotationType).toEqual(AnnotationType.LINK); expect(data.annotationType).toEqual(AnnotationType.LINK);
@ -418,7 +416,7 @@ describe('annotation', function() {
{ ref: annotationRef, data: annotationDict, } { ref: annotationRef, data: annotationDict, }
]); ]);
var annotation = annotationFactory.create(xref, annotationRef, var annotation = AnnotationFactory.create(xref, annotationRef,
pdfManagerMock, idFactoryMock); pdfManagerMock, idFactoryMock);
var data = annotation.data; var data = annotation.data;
expect(data.annotationType).toEqual(AnnotationType.LINK); expect(data.annotationType).toEqual(AnnotationType.LINK);
@ -450,7 +448,7 @@ describe('annotation', function() {
docBaseUrl: 'http://www.example.com/test/pdfs/qwerty.pdf', docBaseUrl: 'http://www.example.com/test/pdfs/qwerty.pdf',
}); });
var annotation = annotationFactory.create(xref, annotationRef, var annotation = AnnotationFactory.create(xref, annotationRef,
pdfManager, idFactoryMock); pdfManager, idFactoryMock);
var data = annotation.data; var data = annotation.data;
expect(data.annotationType).toEqual(AnnotationType.LINK); expect(data.annotationType).toEqual(AnnotationType.LINK);
@ -479,7 +477,7 @@ describe('annotation', function() {
{ ref: annotationRef, data: annotationDict, } { ref: annotationRef, data: annotationDict, }
]); ]);
var annotation = annotationFactory.create(xref, annotationRef, var annotation = AnnotationFactory.create(xref, annotationRef,
pdfManagerMock, idFactoryMock); pdfManagerMock, idFactoryMock);
var data = annotation.data; var data = annotation.data;
expect(data.annotationType).toEqual(AnnotationType.LINK); expect(data.annotationType).toEqual(AnnotationType.LINK);
@ -508,7 +506,7 @@ describe('annotation', function() {
{ ref: annotationRef, data: annotationDict, } { ref: annotationRef, data: annotationDict, }
]); ]);
var annotation = annotationFactory.create(xref, annotationRef, var annotation = AnnotationFactory.create(xref, annotationRef,
pdfManagerMock, idFactoryMock); pdfManagerMock, idFactoryMock);
var data = annotation.data; var data = annotation.data;
expect(data.annotationType).toEqual(AnnotationType.LINK); expect(data.annotationType).toEqual(AnnotationType.LINK);
@ -548,7 +546,7 @@ describe('annotation', function() {
docBaseUrl: 'http://www.example.com/test/pdfs/qwerty.pdf', docBaseUrl: 'http://www.example.com/test/pdfs/qwerty.pdf',
}); });
var annotation = annotationFactory.create(xref, annotationRef, var annotation = AnnotationFactory.create(xref, annotationRef,
pdfManager, idFactoryMock); pdfManager, idFactoryMock);
var data = annotation.data; var data = annotation.data;
expect(data.annotationType).toEqual(AnnotationType.LINK); expect(data.annotationType).toEqual(AnnotationType.LINK);
@ -583,7 +581,7 @@ describe('annotation', function() {
{ ref: annotationRef, data: annotationDict, } { ref: annotationRef, data: annotationDict, }
]); ]);
var annotation = annotationFactory.create(xref, annotationRef, var annotation = AnnotationFactory.create(xref, annotationRef,
pdfManagerMock, pdfManagerMock,
idFactoryMock); idFactoryMock);
var data = annotation.data; var data = annotation.data;
@ -635,7 +633,7 @@ describe('annotation', function() {
{ ref: annotationRef, data: annotationDict, } { ref: annotationRef, data: annotationDict, }
]); ]);
var annotation = annotationFactory.create(xref, annotationRef, var annotation = AnnotationFactory.create(xref, annotationRef,
pdfManagerMock, idFactoryMock); pdfManagerMock, idFactoryMock);
var data = annotation.data; var data = annotation.data;
expect(data.annotationType).toEqual(AnnotationType.LINK); expect(data.annotationType).toEqual(AnnotationType.LINK);
@ -656,7 +654,7 @@ describe('annotation', function() {
{ ref: annotationRef, data: annotationDict, } { ref: annotationRef, data: annotationDict, }
]); ]);
var annotation = annotationFactory.create(xref, annotationRef, var annotation = AnnotationFactory.create(xref, annotationRef,
pdfManagerMock, idFactoryMock); pdfManagerMock, idFactoryMock);
var data = annotation.data; var data = annotation.data;
expect(data.annotationType).toEqual(AnnotationType.LINK); expect(data.annotationType).toEqual(AnnotationType.LINK);
@ -679,7 +677,7 @@ describe('annotation', function() {
{ ref: annotationRef, data: annotationDict, } { ref: annotationRef, data: annotationDict, }
]); ]);
var annotation = annotationFactory.create(xref, annotationRef, var annotation = AnnotationFactory.create(xref, annotationRef,
pdfManagerMock, idFactoryMock); pdfManagerMock, idFactoryMock);
var data = annotation.data; var data = annotation.data;
expect(data.annotationType).toEqual(AnnotationType.LINK); expect(data.annotationType).toEqual(AnnotationType.LINK);
@ -709,7 +707,7 @@ describe('annotation', function() {
{ ref: annotationRef, data: annotationDict, } { ref: annotationRef, data: annotationDict, }
]); ]);
let annotation = annotationFactory.create(xref, annotationRef, let annotation = AnnotationFactory.create(xref, annotationRef,
pdfManagerMock, idFactoryMock); pdfManagerMock, idFactoryMock);
let data = annotation.data; let data = annotation.data;
expect(data.annotationType).toEqual(AnnotationType.LINK); expect(data.annotationType).toEqual(AnnotationType.LINK);
@ -742,7 +740,7 @@ describe('annotation', function() {
{ ref: widgetRef, data: widgetDict, } { ref: widgetRef, data: widgetDict, }
]); ]);
var annotation = annotationFactory.create(xref, widgetRef, var annotation = AnnotationFactory.create(xref, widgetRef,
pdfManagerMock, idFactoryMock); pdfManagerMock, idFactoryMock);
var data = annotation.data; var data = annotation.data;
expect(data.annotationType).toEqual(AnnotationType.WIDGET); expect(data.annotationType).toEqual(AnnotationType.WIDGET);
@ -759,7 +757,7 @@ describe('annotation', function() {
{ ref: widgetRef, data: widgetDict, } { ref: widgetRef, data: widgetDict, }
]); ]);
var annotation = annotationFactory.create(xref, widgetRef, var annotation = AnnotationFactory.create(xref, widgetRef,
pdfManagerMock, idFactoryMock); pdfManagerMock, idFactoryMock);
var data = annotation.data; var data = annotation.data;
expect(data.annotationType).toEqual(AnnotationType.WIDGET); expect(data.annotationType).toEqual(AnnotationType.WIDGET);
@ -783,7 +781,7 @@ describe('annotation', function() {
{ ref: widgetRef, data: widgetDict, } { ref: widgetRef, data: widgetDict, }
]); ]);
var annotation = annotationFactory.create(xref, widgetRef, var annotation = AnnotationFactory.create(xref, widgetRef,
pdfManagerMock, idFactoryMock); pdfManagerMock, idFactoryMock);
var data = annotation.data; var data = annotation.data;
expect(data.annotationType).toEqual(AnnotationType.WIDGET); expect(data.annotationType).toEqual(AnnotationType.WIDGET);
@ -805,7 +803,7 @@ describe('annotation', function() {
{ ref: widgetRef, data: widgetDict, } { ref: widgetRef, data: widgetDict, }
]); ]);
var annotation = annotationFactory.create(xref, widgetRef, var annotation = AnnotationFactory.create(xref, widgetRef,
pdfManagerMock, idFactoryMock); pdfManagerMock, idFactoryMock);
var data = annotation.data; var data = annotation.data;
expect(data.annotationType).toEqual(AnnotationType.WIDGET); expect(data.annotationType).toEqual(AnnotationType.WIDGET);
@ -837,7 +835,7 @@ describe('annotation', function() {
{ ref: textWidgetRef, data: textWidgetDict, } { ref: textWidgetRef, data: textWidgetDict, }
]); ]);
var annotation = annotationFactory.create(xref, textWidgetRef, var annotation = AnnotationFactory.create(xref, textWidgetRef,
pdfManagerMock, idFactoryMock); pdfManagerMock, idFactoryMock);
var data = annotation.data; var data = annotation.data;
expect(data.annotationType).toEqual(AnnotationType.WIDGET); expect(data.annotationType).toEqual(AnnotationType.WIDGET);
@ -860,7 +858,7 @@ describe('annotation', function() {
{ ref: textWidgetRef, data: textWidgetDict, } { ref: textWidgetRef, data: textWidgetDict, }
]); ]);
var annotation = annotationFactory.create(xref, textWidgetRef, var annotation = AnnotationFactory.create(xref, textWidgetRef,
pdfManagerMock, idFactoryMock); pdfManagerMock, idFactoryMock);
var data = annotation.data; var data = annotation.data;
expect(data.annotationType).toEqual(AnnotationType.WIDGET); expect(data.annotationType).toEqual(AnnotationType.WIDGET);
@ -884,7 +882,7 @@ describe('annotation', function() {
{ ref: textWidgetRef, data: textWidgetDict, } { ref: textWidgetRef, data: textWidgetDict, }
]); ]);
var annotation = annotationFactory.create(xref, textWidgetRef, var annotation = AnnotationFactory.create(xref, textWidgetRef,
pdfManagerMock, idFactoryMock); pdfManagerMock, idFactoryMock);
var data = annotation.data; var data = annotation.data;
expect(data.annotationType).toEqual(AnnotationType.WIDGET); expect(data.annotationType).toEqual(AnnotationType.WIDGET);
@ -903,7 +901,7 @@ describe('annotation', function() {
{ ref: textWidgetRef, data: textWidgetDict, } { ref: textWidgetRef, data: textWidgetDict, }
]); ]);
var annotation = annotationFactory.create(xref, textWidgetRef, var annotation = AnnotationFactory.create(xref, textWidgetRef,
pdfManagerMock, idFactoryMock); pdfManagerMock, idFactoryMock);
var data = annotation.data; var data = annotation.data;
expect(data.annotationType).toEqual(AnnotationType.WIDGET); expect(data.annotationType).toEqual(AnnotationType.WIDGET);
@ -920,7 +918,7 @@ describe('annotation', function() {
{ ref: textWidgetRef, data: textWidgetDict, } { ref: textWidgetRef, data: textWidgetDict, }
]); ]);
var annotation = annotationFactory.create(xref, textWidgetRef, var annotation = AnnotationFactory.create(xref, textWidgetRef,
pdfManagerMock, idFactoryMock); pdfManagerMock, idFactoryMock);
var data = annotation.data; var data = annotation.data;
expect(data.annotationType).toEqual(AnnotationType.WIDGET); expect(data.annotationType).toEqual(AnnotationType.WIDGET);
@ -948,7 +946,7 @@ describe('annotation', function() {
{ ref: textWidgetRef, data: textWidgetDict, } { ref: textWidgetRef, data: textWidgetDict, }
]); ]);
var annotation = annotationFactory.create(xref, textWidgetRef, var annotation = AnnotationFactory.create(xref, textWidgetRef,
pdfManagerMock, pdfManagerMock,
idFactoryMock); idFactoryMock);
var data = annotation.data; var data = annotation.data;
@ -989,7 +987,7 @@ describe('annotation', function() {
{ ref: buttonWidgetRef, data: buttonWidgetDict, } { ref: buttonWidgetRef, data: buttonWidgetDict, }
]); ]);
var annotation = annotationFactory.create(xref, buttonWidgetRef, var annotation = AnnotationFactory.create(xref, buttonWidgetRef,
pdfManagerMock, idFactoryMock); pdfManagerMock, idFactoryMock);
var data = annotation.data; var data = annotation.data;
expect(data.annotationType).toEqual(AnnotationType.WIDGET); expect(data.annotationType).toEqual(AnnotationType.WIDGET);
@ -1018,7 +1016,7 @@ describe('annotation', function() {
{ ref: buttonWidgetRef, data: buttonWidgetDict, } { ref: buttonWidgetRef, data: buttonWidgetDict, }
]); ]);
var annotation = annotationFactory.create(xref, buttonWidgetRef, var annotation = AnnotationFactory.create(xref, buttonWidgetRef,
pdfManagerMock, idFactoryMock); pdfManagerMock, idFactoryMock);
var data = annotation.data; var data = annotation.data;
expect(data.annotationType).toEqual(AnnotationType.WIDGET); expect(data.annotationType).toEqual(AnnotationType.WIDGET);
@ -1044,7 +1042,7 @@ describe('annotation', function() {
{ ref: buttonWidgetRef, data: buttonWidgetDict, } { ref: buttonWidgetRef, data: buttonWidgetDict, }
]); ]);
var annotation = annotationFactory.create(xref, buttonWidgetRef, var annotation = AnnotationFactory.create(xref, buttonWidgetRef,
pdfManagerMock, idFactoryMock); pdfManagerMock, idFactoryMock);
var data = annotation.data; var data = annotation.data;
expect(data.annotationType).toEqual(AnnotationType.WIDGET); expect(data.annotationType).toEqual(AnnotationType.WIDGET);
@ -1078,7 +1076,7 @@ describe('annotation', function() {
{ ref: choiceWidgetRef, data: choiceWidgetDict, } { ref: choiceWidgetRef, data: choiceWidgetDict, }
]); ]);
var annotation = annotationFactory.create(xref, choiceWidgetRef, var annotation = AnnotationFactory.create(xref, choiceWidgetRef,
pdfManagerMock, idFactoryMock); pdfManagerMock, idFactoryMock);
var data = annotation.data; var data = annotation.data;
expect(data.annotationType).toEqual(AnnotationType.WIDGET); expect(data.annotationType).toEqual(AnnotationType.WIDGET);
@ -1113,7 +1111,7 @@ describe('annotation', function() {
{ ref: optionOneRef, data: optionOneArr, }, { ref: optionOneRef, data: optionOneArr, },
]); ]);
var annotation = annotationFactory.create(xref, choiceWidgetRef, var annotation = AnnotationFactory.create(xref, choiceWidgetRef,
pdfManagerMock, idFactoryMock); pdfManagerMock, idFactoryMock);
var data = annotation.data; var data = annotation.data;
expect(data.annotationType).toEqual(AnnotationType.WIDGET); expect(data.annotationType).toEqual(AnnotationType.WIDGET);
@ -1145,7 +1143,7 @@ describe('annotation', function() {
{ ref: optionBarRef, data: optionBarStr, } { ref: optionBarRef, data: optionBarStr, }
]); ]);
var annotation = annotationFactory.create(xref, choiceWidgetRef, var annotation = AnnotationFactory.create(xref, choiceWidgetRef,
pdfManagerMock, idFactoryMock); pdfManagerMock, idFactoryMock);
var data = annotation.data; var data = annotation.data;
expect(data.annotationType).toEqual(AnnotationType.WIDGET); expect(data.annotationType).toEqual(AnnotationType.WIDGET);
@ -1173,7 +1171,7 @@ describe('annotation', function() {
{ ref: choiceWidgetRef, data: choiceWidgetDict, }, { ref: choiceWidgetRef, data: choiceWidgetDict, },
]); ]);
var annotation = annotationFactory.create(xref, choiceWidgetRef, var annotation = AnnotationFactory.create(xref, choiceWidgetRef,
pdfManagerMock, idFactoryMock); pdfManagerMock, idFactoryMock);
var data = annotation.data; var data = annotation.data;
expect(data.annotationType).toEqual(AnnotationType.WIDGET); expect(data.annotationType).toEqual(AnnotationType.WIDGET);
@ -1191,7 +1189,7 @@ describe('annotation', function() {
{ ref: choiceWidgetRef, data: choiceWidgetDict, } { ref: choiceWidgetRef, data: choiceWidgetDict, }
]); ]);
var annotation = annotationFactory.create(xref, choiceWidgetRef, var annotation = AnnotationFactory.create(xref, choiceWidgetRef,
pdfManagerMock, idFactoryMock); pdfManagerMock, idFactoryMock);
var data = annotation.data; var data = annotation.data;
expect(data.annotationType).toEqual(AnnotationType.WIDGET); expect(data.annotationType).toEqual(AnnotationType.WIDGET);
@ -1209,7 +1207,7 @@ describe('annotation', function() {
{ ref: choiceWidgetRef, data: choiceWidgetDict, } { ref: choiceWidgetRef, data: choiceWidgetDict, }
]); ]);
var annotation = annotationFactory.create(xref, choiceWidgetRef, var annotation = AnnotationFactory.create(xref, choiceWidgetRef,
pdfManagerMock, idFactoryMock); pdfManagerMock, idFactoryMock);
var data = annotation.data; var data = annotation.data;
expect(data.annotationType).toEqual(AnnotationType.WIDGET); expect(data.annotationType).toEqual(AnnotationType.WIDGET);
@ -1223,7 +1221,7 @@ describe('annotation', function() {
{ ref: choiceWidgetRef, data: choiceWidgetDict, } { ref: choiceWidgetRef, data: choiceWidgetDict, }
]); ]);
var annotation = annotationFactory.create(xref, choiceWidgetRef, var annotation = AnnotationFactory.create(xref, choiceWidgetRef,
pdfManagerMock, idFactoryMock); pdfManagerMock, idFactoryMock);
var data = annotation.data; var data = annotation.data;
expect(data.annotationType).toEqual(AnnotationType.WIDGET); expect(data.annotationType).toEqual(AnnotationType.WIDGET);
@ -1241,7 +1239,7 @@ describe('annotation', function() {
{ ref: choiceWidgetRef, data: choiceWidgetDict, } { ref: choiceWidgetRef, data: choiceWidgetDict, }
]); ]);
var annotation = annotationFactory.create(xref, choiceWidgetRef, var annotation = AnnotationFactory.create(xref, choiceWidgetRef,
pdfManagerMock, idFactoryMock); pdfManagerMock, idFactoryMock);
var data = annotation.data; var data = annotation.data;
expect(data.annotationType).toEqual(AnnotationType.WIDGET); expect(data.annotationType).toEqual(AnnotationType.WIDGET);
@ -1261,7 +1259,7 @@ describe('annotation', function() {
{ ref: choiceWidgetRef, data: choiceWidgetDict, } { ref: choiceWidgetRef, data: choiceWidgetDict, }
]); ]);
var annotation = annotationFactory.create(xref, choiceWidgetRef, var annotation = AnnotationFactory.create(xref, choiceWidgetRef,
pdfManagerMock, idFactoryMock); pdfManagerMock, idFactoryMock);
var data = annotation.data; var data = annotation.data;
expect(data.annotationType).toEqual(AnnotationType.WIDGET); expect(data.annotationType).toEqual(AnnotationType.WIDGET);
@ -1284,7 +1282,7 @@ describe('annotation', function() {
{ ref: lineRef, data: lineDict, } { ref: lineRef, data: lineDict, }
]); ]);
var annotation = annotationFactory.create(xref, lineRef, pdfManagerMock, var annotation = AnnotationFactory.create(xref, lineRef, pdfManagerMock,
idFactoryMock); idFactoryMock);
var data = annotation.data; var data = annotation.data;
expect(data.annotationType).toEqual(AnnotationType.LINE); expect(data.annotationType).toEqual(AnnotationType.LINE);
@ -1337,7 +1335,7 @@ describe('annotation', function() {
fileSpecDict.assignXref(xref); fileSpecDict.assignXref(xref);
fileAttachmentDict.assignXref(xref); fileAttachmentDict.assignXref(xref);
var annotation = annotationFactory.create(xref, fileAttachmentRef, var annotation = AnnotationFactory.create(xref, fileAttachmentRef,
pdfManagerMock, idFactoryMock); pdfManagerMock, idFactoryMock);
var data = annotation.data; var data = annotation.data;
expect(data.annotationType).toEqual(AnnotationType.FILEATTACHMENT); expect(data.annotationType).toEqual(AnnotationType.FILEATTACHMENT);
@ -1366,7 +1364,7 @@ describe('annotation', function() {
{ ref: popupRef, data: popupDict, } { ref: popupRef, data: popupDict, }
]); ]);
var annotation = annotationFactory.create(xref, popupRef, var annotation = AnnotationFactory.create(xref, popupRef,
pdfManagerMock, idFactoryMock); pdfManagerMock, idFactoryMock);
var data = annotation.data; var data = annotation.data;
expect(data.annotationType).toEqual(AnnotationType.POPUP); expect(data.annotationType).toEqual(AnnotationType.POPUP);

Loading…
Cancel
Save