1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-21 23:58:07 +02:00

Merge pull request #12333 from calixteman/tooltip

Add tooltip if any in annotations layer
This commit is contained in:
Tim van der Meij 2020-10-03 19:50:39 +02:00 committed by GitHub
commit 6ff1fe4ea9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 61 additions and 3 deletions

View file

@ -2520,6 +2520,49 @@ describe("annotation", function () {
})
.catch(done.fail);
});
it("should handle push buttons", function (done) {
const buttonWidgetRef = Ref.get(124, 0);
buttonWidgetDict.set("Ff", AnnotationFieldFlag.PUSHBUTTON);
buttonWidgetDict.set("A", "whatever");
const xref = new XRefMock([
{ ref: buttonWidgetRef, data: buttonWidgetDict },
]);
AnnotationFactory.create(
xref,
buttonWidgetRef,
pdfManagerMock,
idFactoryMock
).then(({ data }) => {
expect(data.annotationType).toEqual(AnnotationType.WIDGET);
expect(data.pushButton).toEqual(true);
done();
}, done.fail);
});
it("should handle push buttons that act as a tooltip only", function (done) {
const buttonWidgetRef = Ref.get(124, 0);
buttonWidgetDict.set("Ff", AnnotationFieldFlag.PUSHBUTTON);
buttonWidgetDict.set("TU", "An alternative text");
const xref = new XRefMock([
{ ref: buttonWidgetRef, data: buttonWidgetDict },
]);
AnnotationFactory.create(
xref,
buttonWidgetRef,
pdfManagerMock,
idFactoryMock
).then(({ data }) => {
expect(data.annotationType).toEqual(AnnotationType.WIDGET);
expect(data.pushButton).toEqual(true);
expect(data.alternativeText).toEqual("An alternative text");
done();
}, done.fail);
});
});
describe("ChoiceWidgetAnnotation", function () {