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:
commit
6ff1fe4ea9
3 changed files with 61 additions and 3 deletions
|
@ -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 () {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue