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

OZG-6676 OZG-7029 Apply code review improvements

parent 929c247a
Branches
Tags
No related merge requests found
......@@ -215,21 +215,21 @@ describe('SearchZustaendigeStelleDialogComponent', () => {
});
});
describe('isButtonElement', () => {
it('should return true', () => {
describe('isNotButtonElement', () => {
it('should return false', () => {
const element: Element = { tagName: 'BUTTON' } as Element;
const result: boolean = component.isButtonElement(element);
const result: boolean = component.isNotButtonElement(element);
expect(result).toBe(true);
expect(result).toBe(false);
});
it('should return true', () => {
const element: Element = { tagName: 'INPUT' } as Element;
const result: boolean = component.isButtonElement(element);
const result: boolean = component.isNotButtonElement(element);
expect(result).toBe(false);
expect(result).toBe(true);
});
});
});
......@@ -26,7 +26,7 @@ export class SearchZustaendigeStelleDialogComponent<T extends Resource> implemen
@HostListener('document:keydown', ['$event'])
onKeyDownHandler(e: KeyboardEvent) {
if (e.key === 'Enter' && !this.isButtonElement(e.target as Element)) {
if (e.key === 'Enter' && this.isNotButtonElement(e.target as Element)) {
e.preventDefault();
}
}
......@@ -50,7 +50,7 @@ export class SearchZustaendigeStelleDialogComponent<T extends Resource> implemen
this.dialogRef.close();
}
public isButtonElement(e: Element): boolean {
return e.tagName === 'BUTTON';
public isNotButtonElement(e: Element): boolean {
return e.tagName !== 'BUTTON';
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment