Skip to content
This repository was archived by the owner on Feb 26, 2024. It is now read-only.
Closed

Cw3 #472

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions C:\nppdf32Log\debuglog.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
NPP_GetValue is called
NPP_GetValue is called
NPP_GetValue is called
NPP_GetValue is called
NPP_GetValue is called
NPP_GetValue is called
NPP_GetValue is called
NPP_GetValue is called
NPP_GetValue is called
NPP_GetValue is called
NPP_GetValue is called
NPP_GetValue is called
NPP_GetValue is called
NPP_GetValue is called
NPP_GetValue is called
NPP_GetValue is called
NPP_GetValue is called
NPP_GetValue is called
23 changes: 22 additions & 1 deletion e2e/app.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { browser, element, by } from 'protractor';

describe('QuickStart E2E Tests', function () {

let expectedMsg = 'Hello Angular';
let expectedMsg = 'Price list NBP';

beforeEach(function () {
browser.get('');
Expand All @@ -12,4 +12,25 @@ describe('QuickStart E2E Tests', function () {
expect(element(by.css('h1')).getText()).toEqual(expectedMsg);
});

it('should navigate by default to home tab ', function () {
expect(element(by.css('h2')).getText()).toEqual('Home');
expect(browser.getCurrentUrl()).toMatch( new RegExp('\\bhome'));
});

it('should navigate to gold price tab ', function () {
element(by.xpath('/html/body/my-app/nav/a[2]')).click();

expect(element(by.css('h1')).getText()).toEqual(expectedMsg);
expect(element(by.css('h2')).getText()).toEqual('Gold Prices');
expect(browser.getCurrentUrl()).toMatch( new RegExp('\\bgoldprice'));
});

it('should navigate to table A prices tab ', function () {
element(by.xpath('/html/body/my-app/nav/a[3]')).click();

expect(element(by.css('h2')).getText()).toEqual('Table A prices');
expect(browser.getCurrentUrl()).toMatch( new RegExp('\\btablea'));
});
});


23 changes: 23 additions & 0 deletions e2e/gold-price-tab.e2e-spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@

import { browser, element, by } from 'protractor';

describe('Gold price tab E2E Tests', function () {

beforeEach(function () {
browser.get('/goldprice');
});

it('should display current gold price ', function () {
element(by.id('divGoldPriceToday')).getText()
.then(t => expect(t.length).not.toEqual(0));
});

it('should display gold price by date', function () {
element(by.id('inputDate')).sendKeys('03-03-2015');
element(by.id('buttonCheckPriceByDate')).click();

expect(element(by.id('divGoldPriceByDay')).getText()).toEqual('144.43');
});
});


23 changes: 23 additions & 0 deletions e2e/table-a-tab.e2e-spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@

import { browser, element, by } from 'protractor';

describe('Table a tab E2E Tests', function () {
beforeEach(function () {
browser.get('/tablea');
});

it('should display biggest currency ', function () {
element(by.id('divTheBiggestCurrencyCode')).getText()
.then(t => expect(t.length).not.toEqual(0));
element(by.id('divTheBiggestCurrencyCurrency')).getText()
.then(t => expect(t.length).not.toEqual(0));
element(by.id('divTheBiggestCurrencyMid')).getText()
.then(t => expect(t.length).not.toEqual(0));
});

it('should display list of currency ', function () {
expect(element.all(by.repeater('rate of rates')).getSize()).not.toEqual(0);
});
});


4 changes: 2 additions & 2 deletions karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ module.exports = function(config) {

plugins: [
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-firefox-launcher'),
require('karma-jasmine-html-reporter')
],

Expand Down Expand Up @@ -91,7 +91,7 @@ module.exports = function(config) {
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['Chrome'],
browsers: ['Firefox'],
singleRun: false
})
}
18 changes: 8 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,32 +32,30 @@
"@angular/platform-browser": "~4.0.0",
"@angular/platform-browser-dynamic": "~4.0.0",
"@angular/router": "~4.0.0",

"angular-in-memory-web-api": "~0.3.0",
"systemjs": "0.19.40",
"core-js": "^2.4.1",
"rxjs": "5.0.1",
"zone.js": "^0.8.4"
},
"devDependencies": {
"concurrently": "^3.2.0",
"lite-server": "^2.2.2",
"typescript": "~2.1.0",

"@types/jasmine": "2.5.36",
"@types/node": "^6.0.46",
"canonical-path": "0.0.2",
"tslint": "^3.15.1",
"lodash": "^4.16.4",
"concurrently": "^3.2.0",
"jasmine-core": "~2.4.1",
"karma": "^1.3.0",
"karma-chrome-launcher": "^2.0.0",
"karma-cli": "^1.0.1",
"karma-firefox-launcher": "^1.0.1",
"karma-jasmine": "^1.0.2",
"karma-jasmine-html-reporter": "^0.2.2",
"lite-server": "^2.2.2",
"lodash": "^4.16.4",
"protractor": "~4.0.14",
"rimraf": "^2.5.4",

"@types/node": "^6.0.46",
"@types/jasmine": "2.5.36"
"tslint": "^3.15.1",
"typescript": "~2.1.0"
},
"repository": {}
}
21 changes: 21 additions & 0 deletions src/app/app-routing.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import {GoldPriceComponent} from "./goldprice.component";
import {HomeComponent} from "./home.component";
import {TableAComponent} from "./table-a.component";


const routes: Routes = [
{ path: '', redirectTo: '/home', pathMatch: 'full' },
{ path: 'goldprice', component: GoldPriceComponent },
{ path: 'home', component: HomeComponent },
{ path: 'tablea', component: TableAComponent },
// { path: 'heroes', component: HeroesComponent }
];


@NgModule({
imports: [ RouterModule.forRoot(routes) ],
exports: [ RouterModule ]
})
export class AppRoutingModule {}
28 changes: 28 additions & 0 deletions src/app/app.component.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
h1 {
font-size: 1.2em;
color: #999;
margin-bottom: 0;
}
h2 {
font-size: 2em;
margin-top: 0;
padding-top: 0;
}
nav a {
padding: 5px 10px;
text-decoration: none;
margin-top: 10px;
display: inline-block;
background-color: #eee;
border-radius: 4px;
}
nav a:visited, a:link {
color: #607D8B;
}
nav a:hover {
color: #039be5;
background-color: #CFD8DC;
}
nav a.active {
color: #039be5;
}
33 changes: 0 additions & 33 deletions src/app/app.component.spec.ts

This file was deleted.

28 changes: 25 additions & 3 deletions src/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,29 @@
import { Component } from '@angular/core';
import {Component, OnInit} from '@angular/core';

import {GoldPriceService} from "./services/gold-price-service.service";

@Component({
selector: 'my-app',
template: `<h1>Hello {{name}}</h1>`,
template: `<h1>Price list NBP</h1>
<nav>
<a routerLink="/home" routerLinkActive="active">Home</a>
<a routerLink="/goldprice" routerLinkActive="active">Gold prices</a>
<a routerLink="/tablea" routerLinkActive="active">Tabela A prices</a>
</nav>
<router-outlet></router-outlet>
`, styleUrls: ['./app.component.css']
})
export class AppComponent { name = 'Angular'; }
export class AppComponent implements OnInit {
goldPrice: Number;

constructor(private goldPriceService: GoldPriceService) { }
ngOnInit(): void {
this.goldPriceService.getTodayGoldPrice()
.subscribe(goldPrice =>
this.updateView(goldPrice));
}

updateView(goldPrice: Number): void {
this.goldPrice = goldPrice;
}
}
23 changes: 20 additions & 3 deletions src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,27 @@ import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';

import { AppComponent } from './app.component';
import {FormsModule} from "@angular/forms";
import {HttpModule} from "@angular/http";
import {AppRoutingModule} from "./app-routing.module";
import {GoldPriceHttpClient} from "./services/gold-price-http-client.service";
import {GoldPriceCalculator} from "./services/gold-price-calculator.service";
import {GoldPriceService} from "./services/gold-price-service.service";
import {GoldPriceComponent} from "./goldprice.component";
import {DateTransformatorService} from "./services/date-transformator.service";
import {HomeComponent} from "./home.component";
import {TableAComponent} from "./table-a.component";
import {TableAService} from "./services/table-a-service.service";
import {TableAHttpClientService} from "./services/table-a-http-client.service";
import {TableACalculatorService} from "./services/table-a-calculator.service";

@NgModule({
imports: [ BrowserModule ],
declarations: [ AppComponent ],
bootstrap: [ AppComponent ]
imports: [ BrowserModule,
FormsModule,
HttpModule,
AppRoutingModule],
declarations: [ AppComponent, GoldPriceComponent, HomeComponent, TableAComponent ],
bootstrap: [ AppComponent ],
providers: [ GoldPriceHttpClient, GoldPriceCalculator, GoldPriceService, DateTransformatorService, TableAService, TableAHttpClientService, TableACalculatorService ]
})
export class AppModule { }
66 changes: 66 additions & 0 deletions src/app/goldprice.component.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
[class*='col-'] {
float: left;
padding-right: 20px;
padding-bottom: 20px;
}
[class*='col-']:last-of-type {
padding-right: 0;
}
a {
text-decoration: none;
}
*, *:after, *:before {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
h3 {
text-align: center; margin-bottom: 0;
}
h4 {
position: relative;
}
.grid {
margin: 0;
}

#divGoldPriceToday, #divGoldPriceByDay{
font-weight:bold;
}

.col-1-4 {
width: 25%;
}
.module {
padding: 20px;
text-align: center;
color: #eee;
max-height: 120px;
min-width: 120px;
background-color: #607D8B;
border-radius: 2px;
}
.module:hover {
background-color: #EEE;
cursor: pointer;
color: #607d8b;
}
.grid-pad {
padding: 10px 0;
}
.grid-pad > [class*='col-']:last-of-type {
padding-right: 20px;
}
@media (max-width: 600px) {
.module {
font-size: 10px;
max-height: 75px; }
}
@media (max-width: 1024px) {
.grid {
margin: 0;
}
.module {
min-width: 60px;
}
}
16 changes: 16 additions & 0 deletions src/app/goldprice.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<h2>Gold Prices</h2>
<div>
<table width="400px">
<tr>
<td>Current gold price</td>
<td><div id="divGoldPriceToday">{{goldPriceToday}}</div></td>
</tr>
<tr>
<td>
<input id="inputDate" type="date" [(ngModel)]="date"/>
<button id="buttonCheckPriceByDate" (click)="valueChangeDate()"> Check gold price </button>
</td>
<td><div id="divGoldPriceByDay">{{goldPriceByDay}}</div></td>
</tr>
</table>
</div>
Loading