@@ -104,7 +104,7 @@ describe('DsDynamicOneboxComponent test suite', () => {
104104
105105 let scheduler : TestScheduler ;
106106 let testComp : TestComponent ;
107- let oneboxComponent : DsDynamicOneboxComponent | any ;
107+ let oneboxComponent : DsDynamicOneboxComponent ;
108108 let testFixture : ComponentFixture < TestComponent > ;
109109 let debugElement : DebugElement ;
110110 let oneboxCompFixture : ComponentFixture < DsDynamicOneboxComponent > ;
@@ -571,65 +571,65 @@ describe('DsDynamicOneboxComponent test suite', () => {
571571 } ) ;
572572 } ) ;
573573
574- describe ( 'test metadata enrichment' , ( ) => {
575- beforeEach ( ( ) => {
576- oneboxCompFixture = TestBed . createComponent ( DsDynamicOneboxComponent ) ;
577- debugElement = oneboxCompFixture . debugElement ;
578- oneboxComponent = oneboxCompFixture . componentInstance ;
579- oneboxComponent . currentValue = new FormFieldMetadataValueObject ( 'test' , null , null , null , 'testDisplay' ) ;
580- oneboxComponent . model = new DynamicOneboxModel ( ONEBOX_TEST_MODEL_CONFIG ) ;
574+ describe ( 'test metadata enrichment' , ( ) => {
575+ beforeEach ( ( ) => {
576+ oneboxCompFixture = TestBed . createComponent ( DsDynamicOneboxComponent ) ;
577+ debugElement = oneboxCompFixture . debugElement ;
578+ oneboxComponent = oneboxCompFixture . componentInstance ;
579+ oneboxComponent . currentValue = new FormFieldMetadataValueObject ( 'test' , null , null , null , 'testDisplay' ) ;
580+ oneboxComponent . model = new DynamicOneboxModel ( ONEBOX_TEST_MODEL_CONFIG ) ;
581581
582- spyOn ( oneboxComponent , 'onSelectItem' ) . and . returnValue ( undefined ) ;
583- spyOn ( oneboxComponent , 'toggleOtherInfoSelection' ) . and . returnValue ( undefined ) ;
584- } ) ;
582+ spyOn ( oneboxComponent , 'onSelectItem' ) . and . returnValue ( undefined ) ;
583+ spyOn ( oneboxComponent , 'toggleOtherInfoSelection' ) . and . returnValue ( undefined ) ;
584+ } ) ;
585585
586586
587- it ( 'should return null if value is empty' , ( ) => {
588- expect ( oneboxComponent . getOtherInformationValue ( '' , 'some-key' ) ) . toBeNull ( ) ;
589- } ) ;
587+ it ( 'should return null if value is empty' , ( ) => {
588+ expect ( oneboxComponent . getOtherInformationValue ( '' , 'some-key' ) ) . toBeNull ( ) ;
589+ } ) ;
590590
591- it ( 'should return null if key is "alternative-names"' , ( ) => {
592- expect ( oneboxComponent . getOtherInformationValue ( 'some-value' , 'alternative-names' ) ) . toBeNull ( ) ;
593- } ) ;
591+ it ( 'should return null if key is "alternative-names"' , ( ) => {
592+ expect ( oneboxComponent . getOtherInformationValue ( 'some-value' , 'alternative-names' ) ) . toBeNull ( ) ;
593+ } ) ;
594594
595- it ( 'should return single FormFieldMetadataValueObject if no "|||" in value' , ( ) => {
596- const result = oneboxComponent . getOtherInformationValue ( 'value::authority' , 'some-key' ) ;
597- expect ( result . length ) . toBe ( 1 ) ;
598- expect ( result [ 0 ] ) . toEqual ( jasmine . any ( FormFieldMetadataValueObject ) ) ;
599- expect ( result [ 0 ] . value ) . toBe ( 'value' ) ;
600- expect ( result [ 0 ] . authority ) . toBe ( 'authority' ) ;
601- } ) ;
595+ it ( 'should return single FormFieldMetadataValueObject if no "|||" in value' , ( ) => {
596+ const result = oneboxComponent . getOtherInformationValue ( 'value::authority' , 'some-key' ) ;
597+ expect ( result . length ) . toBe ( 1 ) ;
598+ expect ( result [ 0 ] ) . toEqual ( jasmine . any ( FormFieldMetadataValueObject ) ) ;
599+ expect ( result [ 0 ] . value ) . toBe ( 'value' ) ;
600+ expect ( result [ 0 ] . authority ) . toBe ( 'authority' ) ;
601+ } ) ;
602602
603- it ( 'should handle multiple values with multiValueOnGenerator true' , ( ) => {
604- oneboxComponent . multiValueOnGenerator = true ;
605- oneboxComponent . otherInfoValue = 'someValue' ;
606- const result = oneboxComponent . getOtherInformationValue ( 'val1::auth1|||val2::auth2' , 'some-key' ) ;
607- expect ( result . length ) . toBe ( 2 ) ;
608- expect ( result [ 0 ] . value ) . toBe ( 'val1' ) ;
609- expect ( result [ 0 ] . authority ) . toBe ( 'auth1' ) ;
610- expect ( result [ 1 ] . value ) . toBe ( 'val2' ) ;
611- expect ( result [ 1 ] . authority ) . toBe ( 'auth2' ) ;
612- } ) ;
603+ it ( 'should handle multiple values with multiValueOnGenerator true' , ( ) => {
604+ oneboxComponent . multiValueOnGenerator = true ;
605+ ( oneboxComponent as any ) . otherInfoValue = 'someValue' ;
606+ const result = oneboxComponent . getOtherInformationValue ( 'val1::auth1|||val2::auth2' , 'some-key' ) ;
607+ expect ( result . length ) . toBe ( 2 ) ;
608+ expect ( result [ 0 ] . value ) . toBe ( 'val1' ) ;
609+ expect ( result [ 0 ] . authority ) . toBe ( 'auth1' ) ;
610+ expect ( result [ 1 ] . value ) . toBe ( 'val2' ) ;
611+ expect ( result [ 1 ] . authority ) . toBe ( 'auth2' ) ;
612+ } ) ;
613613
614- it ( 'should handle multiple values with multiValueOnGenerator false' , ( ) => {
615- oneboxComponent . multiValueOnGenerator = false ;
616- oneboxComponent . otherInfoValue = 'val1' ;
617- oneboxComponent . otherInfoValuesUnformatted = [ 'val1::auth1' ] ;
618- const result = oneboxComponent . getOtherInformationValue ( 'val1::auth1|||val2::auth2' , 'data-key' ) ;
619- expect ( result . length ) . toBe ( 1 ) ;
620- expect ( result [ 0 ] . value ) . toBe ( 'val1' ) ;
621- expect ( result [ 0 ] . authority ) . toBe ( 'auth1' ) ;
622- expect ( result [ 0 ] . otherInformation [ 'data-key' ] ) . toBe ( 'val1::auth1|||val2::auth2' ) ;
623- } ) ;
614+ it ( 'should handle multiple values with multiValueOnGenerator false' , ( ) => {
615+ oneboxComponent . multiValueOnGenerator = false ;
616+ ( oneboxComponent as any ) . otherInfoValue = 'val1' ;
617+ oneboxComponent . otherInfoValuesUnformatted = [ 'val1::auth1' ] ;
618+ const result = oneboxComponent . getOtherInformationValue ( 'val1::auth1|||val2::auth2' , 'data-key' ) ;
619+ expect ( result . length ) . toBe ( 1 ) ;
620+ expect ( result [ 0 ] . value ) . toBe ( 'val1' ) ;
621+ expect ( result [ 0 ] . authority ) . toBe ( 'auth1' ) ;
622+ expect ( result [ 0 ] . otherInformation [ 'data-key' ] ) . toBe ( 'val1::auth1|||val2::auth2' ) ;
623+ } ) ;
624624
625- it ( 'should handle value without "::"' , ( ) => {
626- const result = oneboxComponent . getOtherInformationValue ( 'simpleValue' , 'some-key' ) ;
627- expect ( result . length ) . toBe ( 1 ) ;
628- expect ( result [ 0 ] . value ) . toBe ( 'simpleValue' ) ;
629- expect ( result [ 0 ] . authority ) . toBeNull ( ) ;
630- } ) ;
625+ it ( 'should handle value without "::"' , ( ) => {
626+ const result = oneboxComponent . getOtherInformationValue ( 'simpleValue' , 'some-key' ) ;
627+ expect ( result . length ) . toBe ( 1 ) ;
628+ expect ( result [ 0 ] . value ) . toBe ( 'simpleValue' ) ;
629+ expect ( result [ 0 ] . authority ) . toBeNull ( ) ;
630+ } ) ;
631631
632- } ) ;
632+ } ) ;
633633 } ) ;
634634} ) ;
635635
0 commit comments