#17 Moved login component in login folder

This commit is contained in:
mauriziovitale84
2016-04-20 10:22:09 +01:00
parent 35403a9124
commit f24cb17365
5 changed files with 8 additions and 21 deletions

View File

@@ -1,6 +1,6 @@
import {Component} from 'angular2/core'; import {Component} from 'angular2/core';
import {Router, RouteConfig, ROUTER_DIRECTIVES} from 'angular2/router'; 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 {Authentication} from './services/authentication';
import {AuthRouterOutlet} from './components/AuthRouterOutlet'; import {AuthRouterOutlet} from './components/AuthRouterOutlet';
import {HomeView} from './components/home.view'; import {HomeView} from './components/home.view';

View File

@@ -1,11 +1,11 @@
import {Component} from 'angular2/core'; import {Component} from 'angular2/core';
import {Router, ROUTER_DIRECTIVES} from 'angular2/router'; import {Router, ROUTER_DIRECTIVES} from 'angular2/router';
import {FORM_DIRECTIVES, ControlGroup, FormBuilder, Validators} from 'angular2/common'; import {FORM_DIRECTIVES, ControlGroup, FormBuilder, Validators} from 'angular2/common';
import {Authentication} from '../services/authentication'; import {Authentication} from '../../services/authentication';
@Component({ @Component({
selector: 'login', selector: 'login',
moduleId: 'app/components/login', moduleId: 'app/components/login/login',
directives: [ROUTER_DIRECTIVES, FORM_DIRECTIVES], directives: [ROUTER_DIRECTIVES, FORM_DIRECTIVES],
templateUrl: 'login.component.html', templateUrl: 'login.component.html',
styleUrls: ['login.component.css'], styleUrls: ['login.component.css'],

View File

@@ -1,17 +1,8 @@
import { import {it, inject, injectAsync, describe, beforeEachProviders, TestComponentBuilder} from 'angular2/testing';
it,
inject,
injectAsync,
describe,
beforeEachProviders,
TestComponentBuilder
} from 'angular2/testing';
import {provide, Injector} from 'angular2/core'; import {provide, Injector} from 'angular2/core';
import {Http, HTTP_PROVIDERS, XHRBackend, Response, ResponseOptions} from 'angular2/http'; import {Http, HTTP_PROVIDERS, XHRBackend, Response, ResponseOptions} from 'angular2/http';
import {MockBackend} from 'angular2/http/testing'; import {MockBackend} from 'angular2/http/testing';
import {Authentication} from 'app/services/authentication';
import {Authentication} from "app/services/authentication";
describe('Authentication', () => { describe('Authentication', () => {
let injector, let injector,
@@ -23,16 +14,12 @@ describe('Authentication', () => {
beforeEach(() => { beforeEach(() => {
injector = Injector.resolveAndCreate([ injector = Injector.resolveAndCreate([
HTTP_PROVIDERS, HTTP_PROVIDERS,
// this next value should NOT be provided, but when it is, MockBackend,
// 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...
provide(XHRBackend, {useClass: MockBackend}), provide(XHRBackend, {useClass: MockBackend}),
Authentication Authentication
]); ]);
var store = {}; let store = {};
spyOn(localStorage, 'getItem').and.callFake(function (key) { spyOn(localStorage, 'getItem').and.callFake(function (key) {
return store[key]; return store[key];
@@ -47,7 +34,7 @@ describe('Authentication', () => {
delete store[key]; delete store[key];
}); });
spyOn(localStorage, 'key').and.callFake(function (i) { spyOn(localStorage, 'key').and.callFake(function (i) {
var keys = Object.keys(store); let keys = Object.keys(store);
return keys[i] || null; return keys[i] || null;
}); });