@@ -9,12 +9,9 @@ import {
99} from '@angular/forms' ;
1010import {
1111 DISABLED_MATCHER_PROVIDER ,
12- DynamicFormControlRelation ,
1312 DynamicFormRelationService ,
1413 HIDDEN_MATCHER ,
1514 HIDDEN_MATCHER_PROVIDER ,
16- MATCH_VISIBLE ,
17- OR_OPERATOR ,
1815 REQUIRED_MATCHER_PROVIDER ,
1916} from '@ng-dynamic-forms/core' ;
2017
@@ -85,7 +82,7 @@ describe('DSDynamicTypeBindRelationService test suite', () => {
8582 } ) ;
8683 it ( 'Should get 1 related form models for mock relation model data' , ( ) => {
8784 const testModel = mockInputWithTypeBindModel ;
88- testModel . typeBindRelations = getTypeBindRelations ( [ 'boundType' ] ) ;
85+ testModel . typeBindRelations = DsDynamicTypeBindRelationService . getTypeBindRelations ( [ 'boundType' ] , 'dc.type' ) ;
8986 const relatedModels = service . getRelatedFormModel ( testModel ) ;
9087 expect ( relatedModels ) . toHaveSize ( 1 ) ;
9188 } ) ;
@@ -94,7 +91,7 @@ describe('DSDynamicTypeBindRelationService test suite', () => {
9491 describe ( 'Test matchesCondition method' , ( ) => {
9592 it ( 'Should receive one subscription to dc.type type binding"' , ( ) => {
9693 const testModel = mockInputWithTypeBindModel ;
97- testModel . typeBindRelations = getTypeBindRelations ( [ 'boundType' ] ) ;
94+ testModel . typeBindRelations = DsDynamicTypeBindRelationService . getTypeBindRelations ( [ 'boundType' ] , 'dc.type' ) ;
9895 const dcTypeControl = new UntypedFormControl ( ) ;
9996 dcTypeControl . setValue ( 'boundType' ) ;
10097 let subscriptions = service . subscribeRelations ( testModel , dcTypeControl ) ;
@@ -103,7 +100,7 @@ describe('DSDynamicTypeBindRelationService test suite', () => {
103100
104101 it ( 'Expect hasMatch to be true (ie. this should be hidden)' , ( ) => {
105102 const testModel = mockInputWithTypeBindModel ;
106- testModel . typeBindRelations = getTypeBindRelations ( [ 'boundType' ] ) ;
103+ testModel . typeBindRelations = DsDynamicTypeBindRelationService . getTypeBindRelations ( [ 'boundType' ] , 'dc.type' ) ;
107104 const dcTypeControl = new UntypedFormControl ( ) ;
108105 dcTypeControl . setValue ( 'boundType' ) ;
109106 testModel . typeBindRelations [ 0 ] . when [ 0 ] . value = 'anotherType' ;
@@ -118,7 +115,7 @@ describe('DSDynamicTypeBindRelationService test suite', () => {
118115
119116 it ( 'Expect hasMatch to be false (ie. this should NOT be hidden)' , ( ) => {
120117 const testModel = mockInputWithTypeBindModel ;
121- testModel . typeBindRelations = getTypeBindRelations ( [ 'boundType' ] ) ;
118+ testModel . typeBindRelations = DsDynamicTypeBindRelationService . getTypeBindRelations ( [ 'boundType' ] , 'dc.type' ) ;
122119 const dcTypeControl = new UntypedFormControl ( ) ;
123120 dcTypeControl . setValue ( 'boundType' ) ;
124121 testModel . typeBindRelations [ 0 ] . when [ 0 ] . value = 'boundType' ;
@@ -134,18 +131,3 @@ describe('DSDynamicTypeBindRelationService test suite', () => {
134131 } ) ;
135132
136133} ) ;
137-
138- function getTypeBindRelations ( configuredTypeBindValues : string [ ] ) : DynamicFormControlRelation [ ] {
139- const bindValues = [ ] ;
140- configuredTypeBindValues . forEach ( ( value ) => {
141- bindValues . push ( {
142- id : 'dc.type' ,
143- value : value ,
144- } ) ;
145- } ) ;
146- return [ {
147- match : MATCH_VISIBLE ,
148- operator : OR_OPERATOR ,
149- when : bindValues ,
150- } ] ;
151- }
0 commit comments