mirror of
https://github.com/GNS3/gns3-web-ui.git
synced 2025-02-20 17:52:46 +00:00
Merge pull request #308 from GNS3/Adding-new-project-on-enter
Adding new project on enter
This commit is contained in:
commit
3cf7492452
@ -3,6 +3,7 @@
|
||||
<mat-form-field class="file-name-form-field">
|
||||
<input
|
||||
matInput
|
||||
(keydown)="onKeyDown($event)"
|
||||
type="text"
|
||||
formControlName="projectName"
|
||||
[ngClass]="{ 'is-invalid': form.projectName?.errors }"
|
||||
|
@ -141,4 +141,13 @@ describe('AddBlankProjectDialogComponent', () => {
|
||||
expect(toaster.success).toHaveBeenCalled();
|
||||
expect(router.navigate).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should call adding on enter', () => {
|
||||
component.projectNameForm.controls['projectName'].setValue('validName');
|
||||
spyOn(component, 'onAddClick');
|
||||
|
||||
component.onKeyDown({key: 'Enter'});
|
||||
|
||||
expect(component.onAddClick).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
@ -71,6 +71,12 @@ export class AddBlankProjectDialogComponent implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
onKeyDown(event) {
|
||||
if (event.key === "Enter") {
|
||||
this.onAddClick();
|
||||
}
|
||||
}
|
||||
|
||||
openConfirmationDialog(existingProject: Project) {
|
||||
const dialogRef = this.dialog.open(ConfirmationDialogComponent, {
|
||||
width: '300px',
|
||||
|
Loading…
x
Reference in New Issue
Block a user