-
Notifications
You must be signed in to change notification settings - Fork 223
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #283 from frg-fossee/develop
Merge develop into master
- Loading branch information
Showing
103 changed files
with
3,755 additions
and
869 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
ArduinoFrontend/src/app/exit-confirm-dialog/exit-confirm-dialog.component.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
.action-div{ | ||
display: flex; | ||
justify-content: space-around; | ||
} |
5 changes: 5 additions & 0 deletions
5
ArduinoFrontend/src/app/exit-confirm-dialog/exit-confirm-dialog.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<h2 mat-dialog-title>Do you want to exit?</h2> | ||
<div mat-dialog-actions class="action-div"> | ||
<button mat-raised-button color="warn" (click)="yesClick()">Yes</button> | ||
<button mat-raised-button color="primary" mat-dialog-close>No</button> | ||
</div> |
30 changes: 30 additions & 0 deletions
30
ArduinoFrontend/src/app/exit-confirm-dialog/exit-confirm-dialog.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; | ||
import { MatDialogModule, MatDialogRef } from '@angular/material'; | ||
|
||
import { ExitConfirmDialogComponent } from './exit-confirm-dialog.component'; | ||
|
||
describe('ExitConfirmDialogComponent', () => { | ||
let component: ExitConfirmDialogComponent; | ||
let fixture: ComponentFixture<ExitConfirmDialogComponent>; | ||
|
||
beforeEach(async(() => { | ||
TestBed.configureTestingModule({ | ||
imports: [MatDialogModule], | ||
declarations: [ExitConfirmDialogComponent], | ||
providers: [ | ||
{ provide: MatDialogRef, useValue: {} }, | ||
] | ||
}) | ||
.compileComponents(); | ||
})); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(ExitConfirmDialogComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
21 changes: 21 additions & 0 deletions
21
ArduinoFrontend/src/app/exit-confirm-dialog/exit-confirm-dialog.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { Component, OnInit } from '@angular/core'; | ||
import { MatDialogRef } from '@angular/material'; | ||
|
||
@Component({ | ||
selector: 'app-exit-confirm-dialog', | ||
templateUrl: './exit-confirm-dialog.component.html', | ||
styleUrls: ['./exit-confirm-dialog.component.css'] | ||
}) | ||
export class ExitConfirmDialogComponent implements OnInit { | ||
|
||
constructor(public dialogRef: MatDialogRef<ExitConfirmDialogComponent>) { } | ||
|
||
ngOnInit() { | ||
} | ||
|
||
// Function to handle if user want to exit | ||
yesClick() { | ||
this.dialogRef.close(true); | ||
} | ||
|
||
} |
3 changes: 3 additions & 0 deletions
3
ArduinoFrontend/src/app/export-jsondialog/export-jsondialog.component.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.full-width{ | ||
width: 100%; | ||
} |
17 changes: 17 additions & 0 deletions
17
ArduinoFrontend/src/app/export-jsondialog/export-jsondialog.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<div mat-dialog-title> | ||
Enter the name of File to be Saved | ||
</div> | ||
<mat-dialog-content> | ||
<br> | ||
<mat-form-field class="full-width"> | ||
<mat-label>File Name</mat-label> | ||
<input matInput [(ngModel)]="fileName"> | ||
</mat-form-field> | ||
|
||
</mat-dialog-content> | ||
<mat-dialog-actions> | ||
|
||
<button mat-raised-button (click)="saveProject()" color="primary">Download Project</button> | ||
<button mat-raised-button mat-dialog-close color="warn">Close</button> | ||
|
||
</mat-dialog-actions> |
70 changes: 70 additions & 0 deletions
70
ArduinoFrontend/src/app/export-jsondialog/export-jsondialog.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
import { TestBed, async, ComponentFixture } from '@angular/core/testing'; | ||
import { FormsModule } from '@angular/forms'; | ||
import { MatDialogModule, MatDialogRef, MatFormFieldModule, MAT_DIALOG_DATA } from '@angular/material'; | ||
import { RouterTestingModule } from '@angular/router/testing'; | ||
import { Workspace } from '../Libs/Workspace'; | ||
import { ExportJSONDialogComponent } from './export-jsondialog.component'; | ||
|
||
describe('ExportJSONDialogComponent', () => { | ||
|
||
let component: ExportJSONDialogComponent; | ||
let fixture: ComponentFixture<ExportJSONDialogComponent>; | ||
|
||
beforeEach(async () => { | ||
TestBed.configureTestingModule({ | ||
imports: [ | ||
RouterTestingModule, | ||
MatFormFieldModule, | ||
FormsModule, | ||
MatDialogModule, | ||
], | ||
declarations: [ | ||
ExportJSONDialogComponent | ||
], | ||
providers: [ | ||
{ provide: MatDialogRef, useValue: {} }, | ||
{ provide: MAT_DIALOG_DATA, useValue: { description: 'this is a desc', title: 'title' } }, | ||
] | ||
}).compileComponents(); | ||
}); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(ExportJSONDialogComponent); | ||
component = fixture.componentInstance; | ||
}); | ||
|
||
it('should create the app', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
|
||
it('Value of fileName variable should be given string', () => { | ||
expect(component.fileName).toBe('title'); | ||
}); | ||
|
||
it('Value of Description variable should be given string', () => { | ||
expect(component.description).toBe('this is a desc'); | ||
}); | ||
|
||
it('should return truthy as workspace is empty', () => { | ||
expect(Workspace.checkIfWorkspaceEmpty()).toBeTruthy(); | ||
}); | ||
|
||
it('should return falsey as workspace is not empty', () => { | ||
component.ngOnInit(); | ||
window['scope'] = { | ||
id: 1620892078891, | ||
canvas: { x: 0, y: 0, scale: 1 }, | ||
project: { | ||
name: 'Untitled', | ||
description: '', | ||
created_at: 1620892078891 | ||
}, | ||
Resistor: [{ x: 483, y: 209, tx: 68, ty: 100, id: 1620892071196, data: { value: 1000, tolerance: 10 } }] | ||
}; | ||
expect(Workspace.checkIfWorkspaceEmpty()).toBeFalsy(); | ||
}); | ||
|
||
it('should return truthy after downloading json file', () => { | ||
expect(Workspace.SaveJson()).toBeTruthy(); | ||
}); | ||
}); |
33 changes: 33 additions & 0 deletions
33
ArduinoFrontend/src/app/export-jsondialog/export-jsondialog.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { Component, Inject, OnInit } from '@angular/core'; | ||
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material'; | ||
import { Workspace } from '../Libs/Workspace'; | ||
|
||
@Component({ | ||
selector: 'app-export-jsondialog', | ||
templateUrl: './export-jsondialog.component.html', | ||
styleUrls: ['./export-jsondialog.component.css'] | ||
}) | ||
export class ExportJSONDialogComponent implements OnInit { | ||
|
||
description: string; | ||
fileName = ''; | ||
|
||
constructor( | ||
public dialogRef: MatDialogRef<ExportJSONDialogComponent>, | ||
@Inject(MAT_DIALOG_DATA) public data) { | ||
this.description = data.description; | ||
this.fileName = data.title; | ||
} | ||
|
||
ngOnInit() { | ||
} | ||
|
||
/** | ||
* Save Project function, Calls Workspace.SaveJson with edited fileName and then closes project | ||
*/ | ||
saveProject() { | ||
Workspace.SaveJson(this.fileName, this.description); | ||
this.dialogRef.close(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.