Skip to content
Snippets Groups Projects
Commit abdf0734 authored by OZGCloud's avatar OZGCloud
Browse files

Merge pull request 'OZG-4711 OZG-6117 Fix search preview' (#673) from...

Merge pull request 'OZG-4711 OZG-6117 Fix search preview' (#673) from OZG-4711-fix-search-preview into master

Reviewed-on: https://git.ozg-sh.de/ozgcloud-app/alfa/pulls/673
parents de450111 6e03e348
No related branches found
No related tags found
No related merge requests found
......@@ -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();
......
......@@ -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)
);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment