Don't try to save something for a button which is neither a checkbox nor a radio
This commit is contained in:
parent
ed47f77527
commit
7e5026dfc5
@ -1505,7 +1505,8 @@ class ButtonWidgetAnnotation extends WidgetAnnotation {
|
||||
return this._saveRadioButton(evaluator, task, annotationStorage);
|
||||
}
|
||||
|
||||
return super.save(evaluator, task, annotationStorage);
|
||||
// Nothing to save
|
||||
return null;
|
||||
}
|
||||
|
||||
async _saveCheckbox(evaluator, task, annotationStorage) {
|
||||
|
@ -2317,6 +2317,29 @@ describe("annotation", function () {
|
||||
done();
|
||||
}, done.fail);
|
||||
});
|
||||
|
||||
it("should save nothing", function (done) {
|
||||
const buttonWidgetRef = Ref.get(124, 0);
|
||||
const xref = new XRefMock([
|
||||
{ ref: buttonWidgetRef, data: buttonWidgetDict },
|
||||
]);
|
||||
const task = new WorkerTask("test save");
|
||||
|
||||
AnnotationFactory.create(
|
||||
xref,
|
||||
buttonWidgetRef,
|
||||
pdfManagerMock,
|
||||
idFactoryMock
|
||||
)
|
||||
.then(annotation => {
|
||||
return annotation.save(partialEvaluator, task, {});
|
||||
})
|
||||
.then(data => {
|
||||
expect(data).toEqual(null);
|
||||
done();
|
||||
})
|
||||
.catch(done.fail);
|
||||
});
|
||||
});
|
||||
|
||||
describe("ChoiceWidgetAnnotation", function () {
|
||||
|
Loading…
Reference in New Issue
Block a user