Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
tahaipek committed Sep 25, 2016
0 parents commit 7189e16
Show file tree
Hide file tree
Showing 45 changed files with 1,271 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .editorconfig
@@ -0,0 +1,14 @@
# Editor configuration, see http://editorconfig.org
root = true

[*]
charset = utf-8
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
max_line_length = 0
trim_trailing_whitespace = false
33 changes: 33 additions & 0 deletions .gitignore
@@ -0,0 +1,33 @@
# See http://help.github.com/ignore-files/ for more about ignoring files.

# compiled output
/dist
/tmp

# dependencies
/node_modules
/bower_components

# IDEs and editors
/.idea
.project
.classpath
*.launch
.settings/

# misc
/.sass-cache
/connect.lock
/coverage/*
/libpeerconnection.log
npm-debug.log
testem.log
/typings

# e2e
/e2e/*.js
/e2e/*.map

#System Files
.DS_Store
Thumbs.db
44 changes: 44 additions & 0 deletions angular-cli.json
@@ -0,0 +1,44 @@
{
"project": {
"version": "1.0.0-beta.15",
"name": "angular2-university-domain-list"
},
"apps": [
{
"root": "src",
"outDir": "dist",
"assets": "assets",
"index": "index.html",
"main": "main.ts",
"test": "test.ts",
"tsconfig": "tsconfig.json",
"prefix": "app",
"mobile": false,
"styles": [
"styles.css"
],
"scripts": [],
"environments": {
"source": "environments/environment.ts",
"dev": "environments/environment.ts",
"prod": "environments/environment.prod.ts"
}
}
],
"addons": [],
"packages": [],
"e2e": {
"protractor": {
"config": "./protractor.conf.js"
}
},
"test": {
"karma": {
"config": "./karma.conf.js"
}
},
"defaults": {
"styleExt": "css",
"prefixInterfaces": false
}
}
14 changes: 14 additions & 0 deletions e2e/app.e2e-spec.ts
@@ -0,0 +1,14 @@
import { Angular2UniversityDomainListPage } from './app.po';

describe('angular2-university-domain-list App', function() {
let page: Angular2UniversityDomainListPage;

beforeEach(() => {
page = new Angular2UniversityDomainListPage();
});

it('should display message saying app works', () => {
page.navigateTo();
expect(page.getParagraphText()).toEqual('app works!');
});
});
11 changes: 11 additions & 0 deletions e2e/app.po.ts
@@ -0,0 +1,11 @@
import { browser, element, by } from 'protractor/globals';

export class Angular2UniversityDomainListPage {
navigateTo() {
return browser.get('/');
}

getParagraphText() {
return element(by.css('app-root h1')).getText();
}
}
16 changes: 16 additions & 0 deletions e2e/tsconfig.json
@@ -0,0 +1,16 @@
{
"compileOnSave": false,
"compilerOptions": {
"declaration": false,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"module": "commonjs",
"moduleResolution": "node",
"outDir": "../dist/out-tsc-e2e",
"sourceMap": true,
"target": "es5",
"typeRoots": [
"../node_modules/@types"
]
}
}
38 changes: 38 additions & 0 deletions karma.conf.js
@@ -0,0 +1,38 @@
// Karma configuration file, see link for more information
// https://karma-runner.github.io/0.13/config/configuration-file.html

module.exports = function (config) {
config.set({
basePath: '',
frameworks: ['jasmine', 'angular-cli'],
plugins: [
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-remap-istanbul'),
require('angular-cli/plugins/karma')
],
files: [
{ pattern: './src/test.ts', watched: false }
],
preprocessors: {
'./src/test.ts': ['angular-cli']
},
remapIstanbulReporter: {
reports: {
html: 'coverage',
lcovonly: './coverage/coverage.lcov'
}
},
angularCli: {
config: './angular-cli.json',
environment: 'dev'
},
reporters: ['progress', 'karma-remap-istanbul'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['Chrome'],
singleRun: false
});
};
61 changes: 61 additions & 0 deletions package.json
@@ -0,0 +1,61 @@
{
"name": "angular2-university-domain-list",
"author": "Taha İPEK",
"version": "0.0.1",
"license": "MIT",
"angular-cli": {},
"scripts": {
"start": "ng serve",
"lint": "tslint \"src/**/*.ts\"",
"test": "ng test",
"pree2e": "webdriver-manager update",
"e2e": "protractor"
},
"private": true,
"dependencies": {
"@angular/common": "2.0.0",
"@angular/compiler": "2.0.0",
"@angular/core": "2.0.0",
"@angular/forms": "2.0.0",
"@angular/http": "2.0.0",
"@angular/platform-browser": "2.0.0",
"@angular/platform-browser-dynamic": "2.0.0",
"@angular/router": "3.0.0",
"core-js": "^2.4.1",
"rxjs": "5.0.0-beta.12",
"ts-helpers": "^1.1.1",
"zone.js": "^0.6.23"
},
"devDependencies": {
"@types/jasmine": "^2.2.30",
"angular-cli": "1.0.0-beta.15",
"codelyzer": "~0.0.26",
"jasmine-core": "2.4.1",
"jasmine-spec-reporter": "2.5.0",
"karma": "1.2.0",
"karma-chrome-launcher": "^2.0.0",
"karma-cli": "^1.0.1",
"karma-jasmine": "^1.0.2",
"karma-remap-istanbul": "^0.2.1",
"protractor": "4.0.5",
"ts-node": "1.2.1",
"tslint": "3.13.0",
"typescript": "2.0.2"
},
"description": "This project was generated with [angular-cli](https://github.com/angular/angular-cli) version 1.0.0-beta.15.",
"main": "karma.conf.js",
"repository": {
"type": "git",
"url": "https://github.com/tahaipek/angular2-university-domains-list.git"
},
"keywords": [
"angular2",
"ng",
"cli",
"jsx"
],
"bugs": {
"url": "https://github.com/tahaipek/angular2-university-domains-list/issues"
},
"homepage": "https://github.com/tahaipek/angular2-university-domains-list#readme"
}
32 changes: 32 additions & 0 deletions protractor.conf.js
@@ -0,0 +1,32 @@
// Protractor configuration file, see link for more information
// https://github.com/angular/protractor/blob/master/docs/referenceConf.js

/*global jasmine */
var SpecReporter = require('jasmine-spec-reporter');

exports.config = {
allScriptsTimeout: 11000,
specs: [
'./e2e/**/*.e2e-spec.ts'
],
capabilities: {
'browserName': 'chrome'
},
directConnect: true,
baseUrl: 'http://localhost:4200/',
framework: 'jasmine',
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 30000,
print: function() {}
},
useAllAngular2AppRoots: true,
beforeLaunch: function() {
require('ts-node').register({
project: 'e2e'
});
},
onPrepare: function() {
jasmine.getEnv().addReporter(new SpecReporter());
}
};
16 changes: 16 additions & 0 deletions src/api/university-api.service.spec.ts
@@ -0,0 +1,16 @@
/* tslint:disable:no-unused-variable */

import { TestBed, async, inject } from '@angular/core/testing';
import { UniversityApiService } from './university-api.service';

describe('Service: UniversityApi', () => {
beforeEach(() => {
TestBed.configureTestingModule({
providers: [UniversityApiService]
});
});

it('should ...', inject([UniversityApiService], (service: UniversityApiService) => {
expect(service).toBeTruthy();
}));
});
32 changes: 32 additions & 0 deletions src/api/university-api.service.ts
@@ -0,0 +1,32 @@
import { Injectable } from '@angular/core';
import { Http } from '@angular/http';
import { Observable } from 'rxjs/Observable';
import 'rxjs/add/operator/map';
import { University } from '../model/model.university';

@Injectable()
export class UniversityApiService {
baseUrl: string;

constructor(private http: Http) {
this.baseUrl = 'http://universities.hipolabs.com/search';
}

getUniversity(): Observable<University[]> {
return this.http.get(`${this.baseUrl}?`).map(response => response.json());
}

getUniversityByFilter(name: string, country: string): Observable<University[]> {
let url = this.baseUrl + '?';
if (name) {
url += 'name=' + name + '&';
}

if (country) {
url += 'country=' + country;
}
console.log(url);
return this.http.get(url).map(response => response.json());
}

}
Empty file added src/app/app.component.css
Empty file.
9 changes: 9 additions & 0 deletions src/app/app.component.html
@@ -0,0 +1,9 @@
<app-header></app-header>

<div id="wrapper" class="container">
<h4 class="card-title">{{title}}<small *ngIf="counter"> / Total Record:{{counter}} </small></h4>
<app-searchform [(universities)]="universities"></app-searchform>

<app-university-item [(universities)]="universities"></app-university-item>

</div>
33 changes: 33 additions & 0 deletions src/app/app.component.spec.ts
@@ -0,0 +1,33 @@
/* tslint:disable:no-unused-variable */

import { TestBed, async } from '@angular/core/testing';
import { AppComponent } from './app.component';

describe('App: Angular2UniversityDomainList', () => {
beforeEach(() => {
TestBed.configureTestingModule({
declarations: [
AppComponent
],
});
});

it('should create the app', async(() => {
let fixture = TestBed.createComponent(AppComponent);
let app = fixture.debugElement.componentInstance;
expect(app).toBeTruthy();
}));

it(`should have as title 'app works!'`, async(() => {
let fixture = TestBed.createComponent(AppComponent);
let app = fixture.debugElement.componentInstance;
expect(app.title).toEqual('app works!');
}));

it('should render title in a h1 tag', async(() => {
let fixture = TestBed.createComponent(AppComponent);
fixture.detectChanges();
let compiled = fixture.debugElement.nativeElement;
expect(compiled.querySelector('h1').textContent).toContain('app works!');
}));
});

0 comments on commit 7189e16

Please sign in to comment.