From f24cb17365fe9212c71bb64872fa3faf73f5b798 Mon Sep 17 00:00:00 2001 From: mauriziovitale84 Date: Wed, 20 Apr 2016 10:22:09 +0100 Subject: [PATCH] #17 Moved login component in login folder --- demo-shell-ng2/app/app.component.ts | 2 +- .../{ => login}/login.component.css | 0 .../{ => login}/login.component.html | 0 .../app/components/{ => login}/login.ts | 4 ++-- .../app/services/authentication.spec.ts | 23 ++++--------------- 5 files changed, 8 insertions(+), 21 deletions(-) rename demo-shell-ng2/app/components/{ => login}/login.component.css (100%) rename demo-shell-ng2/app/components/{ => login}/login.component.html (100%) rename demo-shell-ng2/app/components/{ => login}/login.ts (92%) diff --git a/demo-shell-ng2/app/app.component.ts b/demo-shell-ng2/app/app.component.ts index 977fe99f8f..1be28bfa2e 100644 --- a/demo-shell-ng2/app/app.component.ts +++ b/demo-shell-ng2/app/app.component.ts @@ -1,6 +1,6 @@ import {Component} from 'angular2/core'; import {Router, RouteConfig, ROUTER_DIRECTIVES} from 'angular2/router'; -import {Login} from './components/login'; +import {Login} from './components/login/login'; import {Authentication} from './services/authentication'; import {AuthRouterOutlet} from './components/AuthRouterOutlet'; import {HomeView} from './components/home.view'; diff --git a/demo-shell-ng2/app/components/login.component.css b/demo-shell-ng2/app/components/login/login.component.css similarity index 100% rename from demo-shell-ng2/app/components/login.component.css rename to demo-shell-ng2/app/components/login/login.component.css diff --git a/demo-shell-ng2/app/components/login.component.html b/demo-shell-ng2/app/components/login/login.component.html similarity index 100% rename from demo-shell-ng2/app/components/login.component.html rename to demo-shell-ng2/app/components/login/login.component.html diff --git a/demo-shell-ng2/app/components/login.ts b/demo-shell-ng2/app/components/login/login.ts similarity index 92% rename from demo-shell-ng2/app/components/login.ts rename to demo-shell-ng2/app/components/login/login.ts index efbadb7808..6a58cab23b 100644 --- a/demo-shell-ng2/app/components/login.ts +++ b/demo-shell-ng2/app/components/login/login.ts @@ -1,11 +1,11 @@ import {Component} from 'angular2/core'; import {Router, ROUTER_DIRECTIVES} from 'angular2/router'; import {FORM_DIRECTIVES, ControlGroup, FormBuilder, Validators} from 'angular2/common'; -import {Authentication} from '../services/authentication'; +import {Authentication} from '../../services/authentication'; @Component({ selector: 'login', - moduleId: 'app/components/login', + moduleId: 'app/components/login/login', directives: [ROUTER_DIRECTIVES, FORM_DIRECTIVES], templateUrl: 'login.component.html', styleUrls: ['login.component.css'], diff --git a/demo-shell-ng2/app/services/authentication.spec.ts b/demo-shell-ng2/app/services/authentication.spec.ts index 55f422feff..9587edbe73 100644 --- a/demo-shell-ng2/app/services/authentication.spec.ts +++ b/demo-shell-ng2/app/services/authentication.spec.ts @@ -1,17 +1,8 @@ -import { - it, - inject, - injectAsync, - describe, - beforeEachProviders, - TestComponentBuilder -} from 'angular2/testing'; - +import {it, inject, injectAsync, describe, beforeEachProviders, TestComponentBuilder} from 'angular2/testing'; import {provide, Injector} from 'angular2/core'; import {Http, HTTP_PROVIDERS, XHRBackend, Response, ResponseOptions} from 'angular2/http'; import {MockBackend} from 'angular2/http/testing'; - -import {Authentication} from "app/services/authentication"; +import {Authentication} from 'app/services/authentication'; describe('Authentication', () => { let injector, @@ -23,16 +14,12 @@ describe('Authentication', () => { beforeEach(() => { injector = Injector.resolveAndCreate([ HTTP_PROVIDERS, - // this next value should NOT be provided, but when it is, - // we lose the ability to correlate the backend calls - // to the test Is there a way to detect this has been - // done and reject it out-of-hand? - MockBackend, // this is clearly wrong... + MockBackend, provide(XHRBackend, {useClass: MockBackend}), Authentication ]); - var store = {}; + let store = {}; spyOn(localStorage, 'getItem').and.callFake(function (key) { return store[key]; @@ -47,7 +34,7 @@ describe('Authentication', () => { delete store[key]; }); spyOn(localStorage, 'key').and.callFake(function (i) { - var keys = Object.keys(store); + let keys = Object.keys(store); return keys[i] || null; });