File tree 3 files changed +39
-1
lines changed
packages/bygger-backend/src/migration
3 files changed +39
-1
lines changed Original file line number Diff line number Diff line change 3
3
componentWithAdvancedConditionalToRadio ,
4
4
componentWithSimpleConditionalToRadio ,
5
5
formWithSimpleConditionalToRadio ,
6
+ originalOtherDocumentationAttachmentComponent ,
6
7
originalTextFieldComponent ,
7
8
} from './testData' ;
8
9
@@ -70,6 +71,18 @@ describe('filterUtils', () => {
70
71
) . toBe ( false ) ;
71
72
} ) ;
72
73
74
+ it ( 'handles nested properties with three levels' , ( ) => {
75
+ expect (
76
+ targetMatchesFilters ( originalOtherDocumentationAttachmentComponent , [
77
+ {
78
+ key : 'attachmentValues.leggerVedNaa.enabled' ,
79
+ value : null ,
80
+ operator : 'exists' ,
81
+ } ,
82
+ ] ) ,
83
+ ) . toBe ( true ) ;
84
+ } ) ;
85
+
73
86
describe ( 'With operators' , ( ) => {
74
87
const typeEqTextfield = { key : 'type' , value : 'textfield' } ;
75
88
const typeEqRadio = { key : 'type' , value : 'radio' } ;
Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ function parseFiltersFromParam(filtersFromParam: object): Filter[] {
21
21
}
22
22
23
23
function getPropertyFromTarget ( comp : any , properties : string [ ] ) : string | undefined {
24
- if ( properties . length > 1 ) {
24
+ if ( properties . length > 1 && comp [ properties [ 0 ] ] ) {
25
25
return getPropertyFromTarget ( comp [ properties [ 0 ] ] , properties . slice ( 1 ) ) ;
26
26
}
27
27
return comp && comp [ properties [ 0 ] ] ;
Original file line number Diff line number Diff line change @@ -61,6 +61,30 @@ const originalFodselsnummerComponent = {
61
61
tableView : true ,
62
62
} ;
63
63
64
+ const originalOtherDocumentationAttachmentComponent : Component = {
65
+ key : 'annenDokumentasjon' ,
66
+ type : 'attachment' ,
67
+ input : true ,
68
+ label : 'Annen dokumentasjon' ,
69
+ validate : {
70
+ required : true ,
71
+ } ,
72
+ properties : {
73
+ vedleggskode : 'N6' ,
74
+ vedleggstittel : 'Annet' ,
75
+ } ,
76
+ description : 'Har du noen annen dokumentasjon du ønsker å legge ved?' ,
77
+ attachmentType : 'other' ,
78
+ attachmentValues : {
79
+ nei : {
80
+ enabled : true ,
81
+ } ,
82
+ leggerVedNaa : {
83
+ enabled : true ,
84
+ } ,
85
+ } ,
86
+ } ;
87
+
64
88
const originalForm : NavFormType = {
65
89
path : 'testform' ,
66
90
components : [ originalFodselsnummerComponent , originalTextFieldComponent ] ,
@@ -189,6 +213,7 @@ export {
189
213
formWithSimpleConditionalToRadio ,
190
214
originalFodselsnummerComponent ,
191
215
originalForm ,
216
+ originalOtherDocumentationAttachmentComponent ,
192
217
originalPanelComponent ,
193
218
originalSkjemaGruppeComponent ,
194
219
originalTextFieldComponent ,
You can’t perform that action at this time.
0 commit comments