1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-20 15:18:08 +02:00

[api-minor] Include export value for checkboxes

This commit is contained in:
bion 2018-07-06 17:51:10 -07:00
parent 66ffdc4c5b
commit c31ddf7edc
2 changed files with 50 additions and 5 deletions

View file

@ -979,7 +979,34 @@ describe('annotation', function() {
buttonWidgetDict = null;
});
it('should handle checkboxes', function() {
it('should handle checkboxes with export value', function() {
buttonWidgetDict.set('V', Name.get('1'));
var appearanceStatesDict = new Dict();
var exportValueOptionsDict = new Dict();
exportValueOptionsDict.set('Off', 0);
exportValueOptionsDict.set('Checked', 1);
appearanceStatesDict.set('D', exportValueOptionsDict);
buttonWidgetDict.set('AP', appearanceStatesDict);
var buttonWidgetRef = new Ref(124, 0);
var xref = new XRefMock([
{ ref: buttonWidgetRef, data: buttonWidgetDict, }
]);
var annotation = AnnotationFactory.create(xref, buttonWidgetRef,
pdfManagerMock, idFactoryMock);
var data = annotation.data;
expect(data.annotationType).toEqual(AnnotationType.WIDGET);
expect(data.checkBox).toEqual(true);
expect(data.fieldValue).toEqual('1');
expect(data.radioButton).toEqual(false);
expect(data.exportValue).toEqual('Checked');
});
it('should handle checkboxes without export value', function() {
buttonWidgetDict.set('V', Name.get('1'));
var buttonWidgetRef = new Ref(124, 0);