فهرست منبع

Remove default templates, create empty calculator component

Harry de Boer 5 سال پیش
والد
کامیت
728d06b67b

+ 4 - 1
README.md

@@ -28,4 +28,7 @@ Navigate to `http://localhost:8080/numbers/5/add/15` in a browser and observe th
 
 
 ## Frontend
 ## Frontend
 
 
-TODO
+### Compiling and running
+
+Navigate to the `frontend` directory and run `ng serve`
+To access the UI navigate to `http://localhost:4200/` with a browser. 

+ 0 - 27
frontend/README.md

@@ -1,27 +0,0 @@
-# Frontend
-
-This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 11.0.3.
-
-## Development server
-
-Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.
-
-## Code scaffolding
-
-Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`.
-
-## Build
-
-Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `--prod` flag for a production build.
-
-## Running unit tests
-
-Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).
-
-## Running end-to-end tests
-
-Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/).
-
-## Further help
-
-To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page.

+ 1 - 1
frontend/e2e/src/app.e2e-spec.ts

@@ -10,7 +10,7 @@ describe('workspace-project App', () => {
 
 
   it('should display welcome message', async () => {
   it('should display welcome message', async () => {
     await page.navigateTo();
     await page.navigateTo();
-    expect(await page.getTitleText()).toEqual('frontend app is running!');
+    expect(await page.getTitleText()).toEqual('Simple Calculator');
   });
   });
 
 
   afterEach(async () => {
   afterEach(async () => {

+ 1 - 1
frontend/e2e/src/app.po.ts

@@ -6,6 +6,6 @@ export class AppPage {
   }
   }
 
 
   async getTitleText(): Promise<string> {
   async getTitleText(): Promise<string> {
-    return element(by.css('app-root .content span')).getText();
+    return element(by.css('app-root .header h1')).getText();
   }
   }
 }
 }

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 2 - 479
frontend/src/app/app.component.html


+ 3 - 3
frontend/src/app/app.component.spec.ts

@@ -16,16 +16,16 @@ describe('AppComponent', () => {
     expect(app).toBeTruthy();
     expect(app).toBeTruthy();
   });
   });
 
 
-  it(`should have as title 'frontend'`, () => {
+  it(`should have as title 'Simple Calculator'`, () => {
     const fixture = TestBed.createComponent(AppComponent);
     const fixture = TestBed.createComponent(AppComponent);
     const app = fixture.componentInstance;
     const app = fixture.componentInstance;
-    expect(app.title).toEqual('frontend');
+    expect(app.title).toEqual('Simple Calculator');
   });
   });
 
 
   it('should render title', () => {
   it('should render title', () => {
     const fixture = TestBed.createComponent(AppComponent);
     const fixture = TestBed.createComponent(AppComponent);
     fixture.detectChanges();
     fixture.detectChanges();
     const compiled = fixture.nativeElement;
     const compiled = fixture.nativeElement;
-    expect(compiled.querySelector('.content span').textContent).toContain('frontend app is running!');
+    expect(compiled.querySelector('div.header h1').textContent).toContain('Simple Calculator');
   });
   });
 });
 });

+ 1 - 1
frontend/src/app/app.component.ts

@@ -6,5 +6,5 @@ import { Component } from '@angular/core';
   styleUrls: ['./app.component.css']
   styleUrls: ['./app.component.css']
 })
 })
 export class AppComponent {
 export class AppComponent {
-  title = 'frontend';
+  title = 'Simple Calculator';
 }
 }

+ 3 - 1
frontend/src/app/app.module.ts

@@ -2,10 +2,12 @@ import { BrowserModule } from '@angular/platform-browser';
 import { NgModule } from '@angular/core';
 import { NgModule } from '@angular/core';
 
 
 import { AppComponent } from './app.component';
 import { AppComponent } from './app.component';
+import { CalculatorComponent } from './calculator/calculator.component';
 
 
 @NgModule({
 @NgModule({
   declarations: [
   declarations: [
-    AppComponent
+    AppComponent,
+    CalculatorComponent
   ],
   ],
   imports: [
   imports: [
     BrowserModule
     BrowserModule

+ 0 - 0
frontend/src/app/calculator/calculator.component.css


+ 1 - 0
frontend/src/app/calculator/calculator.component.html

@@ -0,0 +1 @@
+<p>calculator works!</p>

+ 25 - 0
frontend/src/app/calculator/calculator.component.spec.ts

@@ -0,0 +1,25 @@
+import { ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { CalculatorComponent } from './calculator.component';
+
+describe('CalculatorComponent', () => {
+  let component: CalculatorComponent;
+  let fixture: ComponentFixture<CalculatorComponent>;
+
+  beforeEach(async () => {
+    await TestBed.configureTestingModule({
+      declarations: [ CalculatorComponent ]
+    })
+    .compileComponents();
+  });
+
+  beforeEach(() => {
+    fixture = TestBed.createComponent(CalculatorComponent);
+    component = fixture.componentInstance;
+    fixture.detectChanges();
+  });
+
+  it('should create', () => {
+    expect(component).toBeTruthy();
+  });
+});

+ 15 - 0
frontend/src/app/calculator/calculator.component.ts

@@ -0,0 +1,15 @@
+import { Component, OnInit } from '@angular/core';
+
+@Component({
+  selector: 'app-calculator',
+  templateUrl: './calculator.component.html',
+  styleUrls: ['./calculator.component.css']
+})
+export class CalculatorComponent implements OnInit {
+
+  constructor() { }
+
+  ngOnInit(): void {
+  }
+
+}

+ 1 - 1
frontend/src/index.html

@@ -2,7 +2,7 @@
 <html lang="en">
 <html lang="en">
 <head>
 <head>
   <meta charset="utf-8">
   <meta charset="utf-8">
-  <title>Frontend</title>
+  <title>Simple Calculator</title>
   <base href="/">
   <base href="/">
   <meta name="viewport" content="width=device-width, initial-scale=1">
   <meta name="viewport" content="width=device-width, initial-scale=1">
   <link rel="icon" type="image/x-icon" href="favicon.ico">
   <link rel="icon" type="image/x-icon" href="favicon.ico">

برخی فایل ها در این مقایسه diff نمایش داده نمی شوند زیرا تعداد فایل ها بسیار زیاد است