diff --git a/alfa-client/libs/vorgang-shared-ui/src/lib/vorgang-search-container/vorgang-search/vorgang-search.formservice.spec.ts b/alfa-client/libs/vorgang-shared-ui/src/lib/vorgang-search-container/vorgang-search/vorgang-search.formservice.spec.ts index f84d501a719fb4fe3a75a86a22a2ed92757f2850..e9d054d5197c95f9912ce6b5a787df923694d446 100644 --- a/alfa-client/libs/vorgang-shared-ui/src/lib/vorgang-search-container/vorgang-search/vorgang-search.formservice.spec.ts +++ b/alfa-client/libs/vorgang-shared-ui/src/lib/vorgang-search-container/vorgang-search/vorgang-search.formservice.spec.ts @@ -21,9 +21,6 @@ * Die sprachspezifischen Genehmigungen und Beschränkungen * unter der Lizenz sind dem Lizenztext zu entnehmen. */ -import { FormControl, UntypedFormBuilder } from '@angular/forms'; -import { Params } from '@angular/router'; -import { faker } from '@faker-js/faker'; import { NavigationService } from '@alfa-client/navigation-shared'; import { EMPTY_STRING, encodeUrlForEmbedding } from '@alfa-client/tech-shared'; import { Mock, mock, useFromMock } from '@alfa-client/test-utils'; @@ -32,6 +29,9 @@ import { VorgangListService, VorgangResource, } from '@alfa-client/vorgang-shared'; +import { FormControl, UntypedFormBuilder } from '@angular/forms'; +import { Params } from '@angular/router'; +import { faker } from '@faker-js/faker'; import { ResourceUri, getUrl } from '@ngxp/rest'; import { createVorgangResource } from 'libs/vorgang-shared/test/vorgang'; import { Observable, of } from 'rxjs'; @@ -131,15 +131,6 @@ describe('VorgangSearchFormService', () => { expect(shouldSearch).toBeFalsy(); }); - - it('on searchString is equals lastsearchString', () => { - formService.lastSearchString = VALID_SEARCH_STRING; - formService.isSearchInputNotPristine = jest.fn().mockReturnValue(true); - - const shouldSearch: boolean = formService.shouldSearchForPreview(VALID_SEARCH_STRING); - - expect(shouldSearch).toBeFalsy(); - }); }); describe('should return true', () => { @@ -148,7 +139,7 @@ describe('VorgangSearchFormService', () => { formService.isSearchInputNotPristine = jest.fn().mockReturnValue(true); }); - it('on searchInput is NOT pristine, has minLength and is not lastSearchString', () => { + it('on searchInput is NOT pristine and has minLength', () => { const shouldSearch: boolean = formService.shouldSearchForPreview(VALID_SEARCH_STRING); expect(shouldSearch).toBeTruthy(); diff --git a/alfa-client/libs/vorgang-shared-ui/src/lib/vorgang-search-container/vorgang-search/vorgang-search.formservice.ts b/alfa-client/libs/vorgang-shared-ui/src/lib/vorgang-search-container/vorgang-search/vorgang-search.formservice.ts index 3a65e9250ae11831cf30e208f7898e93a78ffeaf..bf88a1381c9a827c61a71dc204f5cbaf820ca63a 100644 --- a/alfa-client/libs/vorgang-shared-ui/src/lib/vorgang-search-container/vorgang-search/vorgang-search.formservice.ts +++ b/alfa-client/libs/vorgang-shared-ui/src/lib/vorgang-search-container/vorgang-search/vorgang-search.formservice.ts @@ -21,9 +21,6 @@ * Die sprachspezifischen Genehmigungen und Beschränkungen * unter der Lizenz sind dem Lizenztext zu entnehmen. */ -import { Injectable, OnDestroy } from '@angular/core'; -import { FormGroup, UntypedFormBuilder, UntypedFormControl } from '@angular/forms'; -import { Params } from '@angular/router'; import { NavigationService } from '@alfa-client/navigation-shared'; import { EMPTY_STRING, @@ -37,7 +34,10 @@ import { VorgangListService, VorgangResource, } from '@alfa-client/vorgang-shared'; -import { isEmpty, isEqual } from 'lodash-es'; +import { Injectable, OnDestroy } from '@angular/core'; +import { FormGroup, UntypedFormBuilder, UntypedFormControl } from '@angular/forms'; +import { Params } from '@angular/router'; +import { isEmpty } from 'lodash-es'; import { Observable, Subscription } from 'rxjs'; import { debounceTime, distinctUntilChanged, first, tap } from 'rxjs/operators'; @@ -100,9 +100,7 @@ export class VorgangSearchFormService implements OnDestroy { shouldSearchForPreview(value: string): boolean { return ( - this.isSearchInputNotPristine() && - hasMinLength(value, this.PREVIEW_SEARCH_STRING_MIN_LENGTH) && - !isEqual(this.lastSearchString, value) + this.isSearchInputNotPristine() && hasMinLength(value, this.PREVIEW_SEARCH_STRING_MIN_LENGTH) ); }