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
No related branches found
No related tags found
No related merge requests found
...@@ -215,21 +215,21 @@ describe('SearchZustaendigeStelleDialogComponent', () => { ...@@ -215,21 +215,21 @@ describe('SearchZustaendigeStelleDialogComponent', () => {
}); });
}); });
describe('isButtonElement', () => { describe('isNotButtonElement', () => {
it('should return true', () => { it('should return false', () => {
const element: Element = { tagName: 'BUTTON' } as Element; 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', () => { it('should return true', () => {
const element: Element = { tagName: 'INPUT' } as Element; 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 ...@@ -26,7 +26,7 @@ export class SearchZustaendigeStelleDialogComponent<T extends Resource> implemen
@HostListener('document:keydown', ['$event']) @HostListener('document:keydown', ['$event'])
onKeyDownHandler(e: KeyboardEvent) { 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(); e.preventDefault();
} }
} }
...@@ -50,7 +50,7 @@ export class SearchZustaendigeStelleDialogComponent<T extends Resource> implemen ...@@ -50,7 +50,7 @@ export class SearchZustaendigeStelleDialogComponent<T extends Resource> implemen
this.dialogRef.close(); this.dialogRef.close();
} }
public isButtonElement(e: Element): boolean { public isNotButtonElement(e: Element): boolean {
return e.tagName === 'BUTTON'; 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