Interactive forms: unit test for radio buttons without a field value
This commit is contained in:
parent
4e181e59ef
commit
9f05a5a211
@ -988,7 +988,7 @@ describe('annotation', function() {
|
||||
expect(data.radioButton).toEqual(false);
|
||||
});
|
||||
|
||||
it('should handle radio buttons', function() {
|
||||
it('should handle radio buttons with a field value', function() {
|
||||
var parentDict = new Dict();
|
||||
parentDict.set('V', Name.get('1'));
|
||||
|
||||
@ -1017,6 +1017,32 @@ describe('annotation', function() {
|
||||
expect(data.fieldValue).toEqual('1');
|
||||
expect(data.buttonValue).toEqual('2');
|
||||
});
|
||||
|
||||
it('should handle radio buttons without a field value', function() {
|
||||
var normalAppearanceStateDict = new Dict();
|
||||
normalAppearanceStateDict.set('2', null);
|
||||
|
||||
var appearanceStatesDict = new Dict();
|
||||
appearanceStatesDict.set('N', normalAppearanceStateDict);
|
||||
|
||||
buttonWidgetDict.set('Ff', AnnotationFieldFlag.RADIO);
|
||||
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(false);
|
||||
expect(data.radioButton).toEqual(true);
|
||||
expect(data.fieldValue).toEqual(null);
|
||||
expect(data.buttonValue).toEqual('2');
|
||||
});
|
||||
});
|
||||
|
||||
describe('ChoiceWidgetAnnotation', function() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user