@@ -28,6 +28,7 @@ import {
2828 mockDynamicFormLayoutService ,
2929 mockDynamicFormValidationService ,
3030} from '@dspace/core/testing/dynamic-form-mock-services' ;
31+ import { SearchServiceStub } from '@dspace/core/testing/search-service.stub' ;
3132import { createTestComponent } from '@dspace/core/testing/utils.test' ;
3233import { VocabularyServiceStub } from '@dspace/core/testing/vocabulary-service.stub' ;
3334import { createSuccessfulRemoteDataObject$ } from '@dspace/core/utilities/remote-data.utils' ;
@@ -44,6 +45,7 @@ import { TranslateModule } from '@ngx-translate/core';
4445import { getTestScheduler } from 'jasmine-marbles' ;
4546import { of } from 'rxjs' ;
4647import { TestScheduler } from 'rxjs/testing' ;
48+ import { SearchService } from 'src/app/shared/search/search.service' ;
4749
4850import { ObjNgFor } from '../../../../../utils/object-ngfor.pipe' ;
4951import { AuthorityConfidenceStateDirective } from '../../../../directives/authority-confidence-state.directive' ;
@@ -97,6 +99,7 @@ describe('DsDynamicOneboxComponent test suite', () => {
9799 let testFixture : ComponentFixture < TestComponent > ;
98100 let oneboxCompFixture : ComponentFixture < DsDynamicOneboxComponent > ;
99101 let vocabularyServiceStub : any ;
102+ let searchServiceStub : any ;
100103 let modalService : any ;
101104 let html ;
102105 let modal ;
@@ -137,6 +140,7 @@ describe('DsDynamicOneboxComponent test suite', () => {
137140 // waitForAsync beforeEach
138141 beforeEach ( ( ) => {
139142 vocabularyServiceStub = new VocabularyServiceStub ( ) ;
143+ searchServiceStub = new SearchServiceStub ( ) ;
140144
141145 modal = jasmine . createSpyObj ( 'modal' ,
142146 {
@@ -164,6 +168,7 @@ describe('DsDynamicOneboxComponent test suite', () => {
164168 ChangeDetectorRef ,
165169 DsDynamicOneboxComponent ,
166170 { provide : VocabularyService , useValue : vocabularyServiceStub } ,
171+ { provide : SearchService , useValue : searchServiceStub } ,
167172 { provide : DynamicFormLayoutService , useValue : mockDynamicFormLayoutService } ,
168173 { provide : DynamicFormValidationService , useValue : mockDynamicFormValidationService } ,
169174 { provide : NgbModal , useValue : modal } ,
@@ -259,14 +264,14 @@ describe('DsDynamicOneboxComponent test suite', () => {
259264
260265 it ( 'should emit blur Event onBlur when popup is closed' , ( ) => {
261266 spyOn ( oneboxComponent . blur , 'emit' ) ;
262- spyOn ( oneboxComponent . instance , 'isPopupOpen' ) . and . returnValue ( false ) ;
267+ spyOn ( oneboxComponent . typeahead , 'isPopupOpen' ) . and . returnValue ( false ) ;
263268 oneboxComponent . onBlur ( new Event ( 'blur' ) ) ;
264269 expect ( oneboxComponent . blur . emit ) . toHaveBeenCalled ( ) ;
265270 } ) ;
266271
267272 it ( 'should not emit blur Event onBlur when popup is opened' , ( ) => {
268273 spyOn ( oneboxComponent . blur , 'emit' ) ;
269- spyOn ( oneboxComponent . instance , 'isPopupOpen' ) . and . returnValue ( true ) ;
274+ spyOn ( oneboxComponent . typeahead , 'isPopupOpen' ) . and . returnValue ( true ) ;
270275 const input = oneboxCompFixture . debugElement . query ( By . css ( 'input' ) ) ;
271276
272277 input . nativeElement . blur ( ) ;
@@ -278,7 +283,7 @@ describe('DsDynamicOneboxComponent test suite', () => {
278283 oneboxCompFixture . detectChanges ( ) ;
279284 spyOn ( oneboxComponent . blur , 'emit' ) ;
280285 spyOn ( oneboxComponent . change , 'emit' ) ;
281- spyOn ( oneboxComponent . instance , 'isPopupOpen' ) . and . returnValue ( false ) ;
286+ spyOn ( oneboxComponent . typeahead , 'isPopupOpen' ) . and . returnValue ( false ) ;
282287 oneboxComponent . onBlur ( new Event ( 'blur' ) ) ;
283288 expect ( oneboxComponent . change . emit ) . toHaveBeenCalled ( ) ;
284289 expect ( oneboxComponent . blur . emit ) . toHaveBeenCalled ( ) ;
@@ -291,7 +296,7 @@ describe('DsDynamicOneboxComponent test suite', () => {
291296 oneboxCompFixture . detectChanges ( ) ;
292297 spyOn ( oneboxComponent . blur , 'emit' ) ;
293298 spyOn ( oneboxComponent . change , 'emit' ) ;
294- spyOn ( oneboxComponent . instance , 'isPopupOpen' ) . and . returnValue ( false ) ;
299+ spyOn ( oneboxComponent . typeahead , 'isPopupOpen' ) . and . returnValue ( false ) ;
295300 oneboxComponent . onBlur ( new Event ( 'blur' ) ) ;
296301 expect ( oneboxComponent . change . emit ) . not . toHaveBeenCalled ( ) ;
297302 expect ( oneboxComponent . blur . emit ) . toHaveBeenCalled ( ) ;
@@ -304,7 +309,7 @@ describe('DsDynamicOneboxComponent test suite', () => {
304309 oneboxCompFixture . detectChanges ( ) ;
305310 spyOn ( oneboxComponent . blur , 'emit' ) ;
306311 spyOn ( oneboxComponent . change , 'emit' ) ;
307- spyOn ( oneboxComponent . instance , 'isPopupOpen' ) . and . returnValue ( false ) ;
312+ spyOn ( oneboxComponent . typeahead , 'isPopupOpen' ) . and . returnValue ( false ) ;
308313 oneboxComponent . onBlur ( new Event ( 'blur' ) ) ;
309314 expect ( oneboxComponent . change . emit ) . not . toHaveBeenCalled ( ) ;
310315 expect ( oneboxComponent . blur . emit ) . toHaveBeenCalled ( ) ;
0 commit comments