diff --git a/src/app/app.component.html b/src/app/app.component.html index 0680b43..47b6c9b 100644 --- a/src/app/app.component.html +++ b/src/app/app.component.html @@ -1 +1,2 @@ + diff --git a/src/app/app.component.spec.ts b/src/app/app.component.spec.ts deleted file mode 100644 index d2baafb..0000000 --- a/src/app/app.component.spec.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { TestBed } from '@angular/core/testing'; -import { RouterTestingModule } from '@angular/router/testing'; -import { AppComponent } from './app.component'; - -describe('AppComponent', () => { - beforeEach(async () => { - await TestBed.configureTestingModule({ - imports: [ - RouterTestingModule - ], - declarations: [ - AppComponent - ], - }).compileComponents(); - }); - - it('should create the app', () => { - const fixture = TestBed.createComponent(AppComponent); - const app = fixture.componentInstance; - expect(app).toBeTruthy(); - }); - - it(`should have as title 'm-152'`, () => { - const fixture = TestBed.createComponent(AppComponent); - const app = fixture.componentInstance; - expect(app.title).toEqual('m-152'); - }); - - it('should render title', () => { - const fixture = TestBed.createComponent(AppComponent); - fixture.detectChanges(); - const compiled = fixture.nativeElement as HTMLElement; - expect(compiled.querySelector('.content span')?.textContent).toContain('m-152 app is running!'); - }); -}); diff --git a/src/app/detail/detail.component.spec.ts b/src/app/detail/detail.component.spec.ts deleted file mode 100644 index 06d5c7e..0000000 --- a/src/app/detail/detail.component.spec.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing'; - -import { DetailComponent } from './detail.component'; - -describe('DetailComponent', () => { - let component: DetailComponent; - let fixture: ComponentFixture; - - beforeEach(async () => { - await TestBed.configureTestingModule({ - declarations: [ DetailComponent ] - }) - .compileComponents(); - - fixture = TestBed.createComponent(DetailComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/app/home/home.component.html b/src/app/home/home.component.html index c0cb16a..03e0e23 100644 --- a/src/app/home/home.component.html +++ b/src/app/home/home.component.html @@ -1,3 +1,4 @@
+ diff --git a/src/app/home/home.component.spec.ts b/src/app/home/home.component.spec.ts deleted file mode 100644 index 5075be7..0000000 --- a/src/app/home/home.component.spec.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing'; - -import { HomeComponent } from './home.component'; - -describe('HomeComponent', () => { - let component: HomeComponent; - let fixture: ComponentFixture; - - beforeEach(async () => { - await TestBed.configureTestingModule({ - declarations: [ HomeComponent ] - }) - .compileComponents(); - - fixture = TestBed.createComponent(HomeComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/app/home/home.component.ts b/src/app/home/home.component.ts index 120d63d..e78472b 100644 --- a/src/app/home/home.component.ts +++ b/src/app/home/home.component.ts @@ -6,7 +6,13 @@ import {Component, OnInit} from '@angular/core'; styleUrls: ['./home.component.css'] }) export class HomeComponent implements OnInit { + latitude: number | undefined; + longitude: number | undefined; ngOnInit(): void { + navigator.geolocation.getCurrentPosition(position => { + this.latitude = position.coords.latitude; + this.longitude = position.coords.longitude; + }) } } diff --git a/src/app/list/list.component.spec.ts b/src/app/list/list.component.spec.ts deleted file mode 100644 index 54ae348..0000000 --- a/src/app/list/list.component.spec.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing'; - -import { ListComponent } from './list.component'; - -describe('ListComponent', () => { - let component: ListComponent; - let fixture: ComponentFixture; - - beforeEach(async () => { - await TestBed.configureTestingModule({ - declarations: [ ListComponent ] - }) - .compileComponents(); - - fixture = TestBed.createComponent(ListComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/app/service/translate.service.ts b/src/app/service/translate.service.ts new file mode 100644 index 0000000..274d26a --- /dev/null +++ b/src/app/service/translate.service.ts @@ -0,0 +1,21 @@ +import { Injectable } from '@angular/core'; +import { Translate } from '@google-cloud/translate/build/src/v2'; + + +@Injectable({ + providedIn: 'root' +}) +export class TranslateService { + + private translate: Translate; + + constructor() { + this.translate = new Translate({projectId: 'Modulo-152'}); + } + + async translateText(text: string, target: string): Promise { + const [translation] = await this.translate.translate(text, target); + return translation; + } + +}