Browse Source

Merge pull request #8828 from timvandermeij/es6-annotations

Improve the annotation code by converting to ES6 syntax and removing duplicate code
Tim van der Meij 8 years ago committed by GitHub
parent
commit
a4cc85fc5f
  1. 4
      package.json
  2. 1237
      src/core/annotation.js
  3. 3
      src/core/document.js
  4. 1712
      src/display/annotation_layer.js
  5. 90
      test/unit/annotation_spec.js

4
package.json

@ -31,8 +31,8 @@
"typogr": "^0.6.6", "typogr": "^0.6.6",
"uglify-es": "^3.0.28", "uglify-es": "^3.0.28",
"vinyl-fs": "^2.4.4", "vinyl-fs": "^2.4.4",
"webpack": "^2.2.1", "webpack": "^3.5.5",
"webpack-stream": "^3.2.0", "webpack-stream": "^4.0.0",
"wintersmith": "^2.0.0", "wintersmith": "^2.0.0",
"yargs": "^3.14.0" "yargs": "^3.14.0"
}, },

1237
src/core/annotation.js

File diff suppressed because it is too large Load Diff

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) {

1712
src/display/annotation_layer.js

File diff suppressed because it is too large Load Diff

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