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

Merge pull request 'OZG-6301-bugfix' (#742) from OZG-6301-bugfix into master

parents 99ad672c 23d9e3d3
No related branches found
No related tags found
No related merge requests found
......@@ -87,6 +87,20 @@ describe('SearchOrganisationsEinheitContainerComponent', () => {
});
});
describe('onKeyDownHandler', () => {
it('should prevent default behavior for enter key', () => {
const keyboardEvent: KeyboardEvent = {
...new KeyboardEvent('enter'),
key: 'Enter',
preventDefault: jest.fn(),
};
component.onKeyDownHandler(keyboardEvent);
expect(keyboardEvent.preventDefault).toHaveBeenCalled();
});
});
describe('search organisationsEinheit component', () => {
beforeEach(() => {
component.organisationsEinheitStateListResource$ = of(organisationsEinheitStateListResource);
......@@ -175,7 +189,7 @@ describe('SearchOrganisationsEinheitContainerComponent', () => {
it('should close dialog', () => {
component.selectSearchResult(organisationsEinheitResource);
expect(dialogRefMock.close).toHaveBeenCalledWith();
expect(dialogRefMock.close).toHaveBeenCalled();
});
});
......
......@@ -4,7 +4,7 @@ import {
} from '@alfa-client/collaboration-shared';
import { StateResource } from '@alfa-client/tech-shared';
import { DialogRef } from '@angular/cdk/dialog';
import { Component, OnInit } from '@angular/core';
import { Component, HostListener, OnInit } from '@angular/core';
import {
OrganisationsEinheitListResource,
OrganisationsEinheitResource,
......@@ -31,6 +31,10 @@ export class SearchOrganisationsEinheitContainerComponent implements OnInit {
this.organisationsEinheitStateListResource$ = this.service.getSearchResultList();
}
@HostListener('document:keydown', ['$event']) onKeyDownHandler(e: KeyboardEvent) {
if (e.key === 'Enter') e.preventDefault();
}
public search(searchBy: string): void {
this.service.search(searchBy);
}
......
......@@ -94,7 +94,7 @@ describe('SearchOrganisationsEinheitFormComponent', () => {
const instantSearchResult: InstantSearchResult<OrganisationsEinheitResource> =
component.mapToInstantantSearchResult(organisationsEinheitResource);
const expectedDescription: string = `${organisationsEinheitResource.anschrift.strasse} ${organisationsEinheitResource.anschrift.plz} ${organisationsEinheitResource.anschrift.ort}`;
const expectedDescription: string = `${organisationsEinheitResource.anschrift.strasse} ${organisationsEinheitResource.anschrift.hausnummer}, ${organisationsEinheitResource.anschrift.plz} ${organisationsEinheitResource.anschrift.ort}`;
expect(instantSearchResult.description).toBe(expectedDescription);
});
......
......@@ -34,7 +34,7 @@ export class SearchOrganisationsEinheitFormComponent {
): InstantSearchResult<OrganisationsEinheitResource> {
return <any>{
title: organisationsEinheit.name,
description: `${organisationsEinheit.anschrift.strasse} ${organisationsEinheit.anschrift.plz} ${organisationsEinheit.anschrift.ort}`,
description: `${organisationsEinheit.anschrift.strasse} ${organisationsEinheit.anschrift.hausnummer}, ${organisationsEinheit.anschrift.plz} ${organisationsEinheit.anschrift.ort}`,
data: organisationsEinheit,
};
}
......
......@@ -47,7 +47,7 @@ import { InstantSearchQuery, InstantSearchResult } from './instant-search.model'
<ods-aria-live-region [text]="ariaLiveText" />
<ods-search-result-layer
*ngIf="results.length && areResultsVisible"
class="absolute z-50 mt-3 w-full"
containerClass="absolute z-50 mt-3 max-h-[calc(50vh)] w-full overflow-y-auto"
id="results"
>
<ods-search-result-header
......
import { CommonModule } from '@angular/common';
import { Component } from '@angular/core';
import { Component, Input } from '@angular/core';
@Component({
selector: 'ods-search-result-layer',
standalone: true,
imports: [CommonModule],
template: `<div class="rounded-lg border border-primary-600/50 bg-background-50 shadow-lg">
template: `<div
[ngClass]="[
'rounded-lg border border-primary-600/50 bg-background-50 shadow-lg',
containerClass,
]"
>
<ng-content select="[header]" />
<ul role="list">
<ng-content />
</ul>
</div>`,
})
export class SearchResultLayerComponent {}
export class SearchResultLayerComponent {
@Input() containerClass: string = '';
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment