ci: re-format sources (#14413)

PR Close #14413
This commit is contained in:
Alex Eagle 2017-02-10 16:29:30 -08:00 committed by Miško Hevery
parent adc54302cb
commit 5279d06e88
2 changed files with 15 additions and 25 deletions

View File

@ -6,14 +6,14 @@
* found in the LICENSE file at https://angular.io/license * found in the LICENSE file at https://angular.io/license
*/ */
import {LocationChangeEvent, LocationChangeListener, PlatformLocation} from '@angular/common';
import {Injectable} from '@angular/core';
import {Subject} from 'rxjs/Subject';
import * as url from 'url'; import * as url from 'url';
import {Injectable} from '@angular/core';
import {LocationChangeEvent, LocationChangeListener, PlatformLocation} from '@angular/common';
import {getDOM} from './private_import_platform-browser';
import {scheduleMicroTask} from './facade/lang'; import {scheduleMicroTask} from './facade/lang';
import {getDOM} from './private_import_platform-browser';
import {Subject} from 'rxjs/Subject';
/** /**
@ -27,26 +27,20 @@ export class ServerPlatformLocation implements PlatformLocation {
private _hash: string = ''; private _hash: string = '';
private _hashUpdate = new Subject<LocationChangeEvent>(); private _hashUpdate = new Subject<LocationChangeEvent>();
getBaseHrefFromDOM(): string { getBaseHrefFromDOM(): string { return getDOM().getBaseHref(); }
return getDOM().getBaseHref();
}
onPopState(fn: LocationChangeListener): void { onPopState(fn: LocationChangeListener): void {
// No-op: a state stack is not implemented, so // No-op: a state stack is not implemented, so
// no events will ever come. // no events will ever come.
} }
onHashChange(fn: LocationChangeListener): void { onHashChange(fn: LocationChangeListener): void { this._hashUpdate.subscribe(fn); }
this._hashUpdate.subscribe(fn);
}
get pathname(): string { return this._path; } get pathname(): string { return this._path; }
get search(): string { return this._search; } get search(): string { return this._search; }
get hash(): string { return this._hash; } get hash(): string { return this._hash; }
get url(): string { get url(): string { return `${this.pathname}${this.search}${this.hash}`; }
return `${this.pathname}${this.search}${this.hash}`;
}
private setHash(value: string, oldUrl: string) { private setHash(value: string, oldUrl: string) {
if (this._hash === value) { if (this._hash === value) {
@ -55,8 +49,8 @@ export class ServerPlatformLocation implements PlatformLocation {
} }
this._hash = value; this._hash = value;
const newUrl = this.url; const newUrl = this.url;
scheduleMicroTask(() => this._hashUpdate.next( scheduleMicroTask(
{type: 'hashchange', oldUrl, newUrl} as LocationChangeEvent)); () => this._hashUpdate.next({ type: 'hashchange', oldUrl, newUrl } as LocationChangeEvent));
} }
replaceState(state: any, title: string, newUrl: string): void { replaceState(state: any, title: string, newUrl: string): void {
@ -71,11 +65,7 @@ export class ServerPlatformLocation implements PlatformLocation {
this.replaceState(state, title, newUrl); this.replaceState(state, title, newUrl);
} }
forward(): void { forward(): void { throw new Error('Not implemented'); }
throw new Error('Not implemented');
}
back(): void { back(): void { throw new Error('Not implemented'); }
throw new Error('Not implemented');
}
} }

View File

@ -6,8 +6,8 @@
* found in the LICENSE file at https://angular.io/license * found in the LICENSE file at https://angular.io/license
*/ */
import {Component, NgModule, destroyPlatform} from '@angular/core';
import {PlatformLocation} from '@angular/common'; import {PlatformLocation} from '@angular/common';
import {Component, NgModule, destroyPlatform} from '@angular/core';
import {async} from '@angular/core/testing'; import {async} from '@angular/core/testing';
import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter'; import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter';
import {ServerModule, platformDynamicServer} from '@angular/platform-server'; import {ServerModule, platformDynamicServer} from '@angular/platform-server';
@ -43,7 +43,7 @@ export function main() {
expect(getDOM().getText(body)).toEqual('Works!'); expect(getDOM().getText(body)).toEqual('Works!');
}); });
})); }));
describe('PlatformLocation', () => { describe('PlatformLocation', () => {
it('is injectable', () => { it('is injectable', () => {
const body = writeBody('<app></app>'); const body = writeBody('<app></app>');