style(lint): re-format modules/@angular
This commit is contained in:
@ -21,7 +21,10 @@ export class HasCustomDecorator {
|
||||
}
|
||||
|
||||
// Verify that custom decorators have metadata collected, eg Ionic
|
||||
export function Page(c: any): (f: Function) => void {return c;}
|
||||
export function Page(c: any): (f: Function) => void {
|
||||
return c;
|
||||
}
|
||||
|
||||
@Page({template: 'Ionic template'})
|
||||
export class AnIonicPage {}
|
||||
export class AnIonicPage {
|
||||
}
|
||||
|
@ -1,17 +1,15 @@
|
||||
import {AUTO_STYLE, Component, trigger, state, animate, transition, style} from '@angular/core';
|
||||
import {AUTO_STYLE, Component, animate, state, style, transition, trigger} from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: "animate-cmp",
|
||||
animations: [
|
||||
trigger('openClose', [
|
||||
state("*", style({ height: AUTO_STYLE, color: 'black', borderColor: 'black' })),
|
||||
state('closed, void',
|
||||
style({ height:"0px", color: "maroon", borderColor: "maroon" })),
|
||||
state('open',
|
||||
style({ height: AUTO_STYLE, borderColor:"green", color:"green" })),
|
||||
transition("* => *", animate(500))
|
||||
])
|
||||
],
|
||||
selector: 'animate-cmp',
|
||||
animations: [trigger(
|
||||
'openClose',
|
||||
[
|
||||
state('*', style({height: AUTO_STYLE, color: 'black', borderColor: 'black'})),
|
||||
state('closed, void', style({height: '0px', color: 'maroon', borderColor: 'maroon'})),
|
||||
state('open', style({height: AUTO_STYLE, borderColor: 'green', color: 'green'})),
|
||||
transition('* => *', animate(500))
|
||||
])],
|
||||
template: `
|
||||
<button (click)="setAsOpen()">Open</button>
|
||||
<button (click)="setAsClosed()">Closed</button>
|
||||
@ -23,17 +21,9 @@ import {AUTO_STYLE, Component, trigger, state, animate, transition, style} from
|
||||
`
|
||||
})
|
||||
export class AnimateCmp {
|
||||
stateExpression:string;
|
||||
constructor() {
|
||||
this.setAsClosed();
|
||||
}
|
||||
setAsSomethingElse() {
|
||||
this.stateExpression = 'something';
|
||||
}
|
||||
setAsOpen() {
|
||||
this.stateExpression = 'open';
|
||||
}
|
||||
setAsClosed() {
|
||||
this.stateExpression = 'closed';
|
||||
}
|
||||
stateExpression: string;
|
||||
constructor() { this.setAsClosed(); }
|
||||
setAsSomethingElse() { this.stateExpression = 'something'; }
|
||||
setAsOpen() { this.stateExpression = 'open'; }
|
||||
setAsClosed() { this.stateExpression = 'closed'; }
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
import {FORM_DIRECTIVES, NgFor, NgIf} from '@angular/common';
|
||||
import {Component, Inject} from '@angular/core';
|
||||
import {FORM_DIRECTIVES, NgIf, NgFor} from '@angular/common';
|
||||
|
||||
import {MyComp} from './a/multiple_components';
|
||||
|
||||
@Component({
|
||||
|
@ -1,7 +1,8 @@
|
||||
import {coreBootstrap, ReflectiveInjector} from '@angular/core';
|
||||
import {browserPlatform, BROWSER_APP_PROVIDERS} from '@angular/platform-browser';
|
||||
import {BasicNgFactory} from './basic.ngfactory';
|
||||
import {ReflectiveInjector, coreBootstrap} from '@angular/core';
|
||||
import {BROWSER_APP_PROVIDERS, browserPlatform} from '@angular/platform-browser';
|
||||
|
||||
import {Basic} from './basic';
|
||||
import {BasicNgFactory} from './basic.ngfactory';
|
||||
|
||||
const appInjector =
|
||||
ReflectiveInjector.resolveAndCreate(BROWSER_APP_PROVIDERS, browserPlatform().injector);
|
||||
|
@ -1,5 +1,5 @@
|
||||
import {Component, Inject, OpaqueToken} from '@angular/core';
|
||||
import * as common from '@angular/common';
|
||||
import {Component, Inject, OpaqueToken} from '@angular/core';
|
||||
|
||||
export const SOME_OPAQUE_TOKEN = new OpaqueToken('opaqueToken');
|
||||
|
||||
|
@ -1,9 +1,6 @@
|
||||
import {Component} from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'comp-with-proj',
|
||||
template: '<ng-content></ng-content>'
|
||||
})
|
||||
@Component({selector: 'comp-with-proj', template: '<ng-content></ng-content>'})
|
||||
export class CompWithProjection {
|
||||
}
|
||||
|
||||
@ -12,4 +9,5 @@ export class CompWithProjection {
|
||||
template: '<comp-with-proj><span greeting="Hello world!"></span></comp-with-proj>',
|
||||
directives: [CompWithProjection]
|
||||
})
|
||||
export class MainComp {}
|
||||
export class MainComp {
|
||||
}
|
||||
|
@ -7,16 +7,16 @@ import {AnimateCmpNgFactory} from '../src/animate.ngfactory';
|
||||
import {AUTO_STYLE, ReflectiveInjector, DebugElement, getDebugNode} from '@angular/core';
|
||||
import {browserPlatform, BROWSER_APP_PROVIDERS} from '@angular/platform-browser';
|
||||
|
||||
describe("template codegen output", () => {
|
||||
describe('template codegen output', () => {
|
||||
function findTargetElement(elm: DebugElement): DebugElement {
|
||||
// the open-close-container is a child of the main container
|
||||
// if the template changes then please update the location below
|
||||
return elm.children[4];
|
||||
}
|
||||
|
||||
it("should apply the animate states to the element", (done) => {
|
||||
const appInjector = ReflectiveInjector.resolveAndCreate(BROWSER_APP_PROVIDERS,
|
||||
browserPlatform().injector);
|
||||
it('should apply the animate states to the element', (done) => {
|
||||
const appInjector =
|
||||
ReflectiveInjector.resolveAndCreate(BROWSER_APP_PROVIDERS, browserPlatform().injector);
|
||||
var comp = AnimateCmpNgFactory.create(appInjector);
|
||||
var debugElement = <DebugElement>getDebugNode(comp.location.nativeElement);
|
||||
|
||||
@ -34,7 +34,7 @@ describe("template codegen output", () => {
|
||||
comp.changeDetectorRef.detectChanges();
|
||||
|
||||
setTimeout(() => {
|
||||
expect(targetDebugElement.styles['height']).toEqual("0px");
|
||||
expect(targetDebugElement.styles['height']).toEqual('0px');
|
||||
expect(targetDebugElement.styles['borderColor']).toEqual('maroon');
|
||||
expect(targetDebugElement.styles['color']).toEqual('maroon');
|
||||
done();
|
||||
@ -42,9 +42,9 @@ describe("template codegen output", () => {
|
||||
}, 0);
|
||||
});
|
||||
|
||||
it("should apply the default animate state to the element", (done) => {
|
||||
const appInjector = ReflectiveInjector.resolveAndCreate(BROWSER_APP_PROVIDERS,
|
||||
browserPlatform().injector);
|
||||
it('should apply the default animate state to the element', (done) => {
|
||||
const appInjector =
|
||||
ReflectiveInjector.resolveAndCreate(BROWSER_APP_PROVIDERS, browserPlatform().injector);
|
||||
var comp = AnimateCmpNgFactory.create(appInjector);
|
||||
var debugElement = <DebugElement>getDebugNode(comp.location.nativeElement);
|
||||
|
||||
|
@ -13,16 +13,16 @@ import {MyComp} from '../src/a/multiple_components';
|
||||
import {ReflectiveInjector, DebugElement, getDebugNode} from '@angular/core';
|
||||
import {browserPlatform, BROWSER_APP_PROVIDERS} from '@angular/platform-browser';
|
||||
|
||||
describe("template codegen output", () => {
|
||||
describe('template codegen output', () => {
|
||||
const outDir = 'src';
|
||||
|
||||
it("should lower Decorators without reflect-metadata", () => {
|
||||
it('should lower Decorators without reflect-metadata', () => {
|
||||
const jsOutput = path.join(outDir, 'basic.js');
|
||||
expect(fs.existsSync(jsOutput)).toBeTruthy();
|
||||
expect(fs.readFileSync(jsOutput, {encoding: 'utf-8'})).not.toContain('Reflect.decorate');
|
||||
});
|
||||
|
||||
it("should produce metadata.json outputs", () => {
|
||||
it('should produce metadata.json outputs', () => {
|
||||
const metadataOutput = path.join(outDir, 'basic.metadata.json');
|
||||
expect(fs.existsSync(metadataOutput)).toBeTruthy();
|
||||
const output = fs.readFileSync(metadataOutput, {encoding: 'utf-8'});
|
||||
@ -30,22 +30,22 @@ describe("template codegen output", () => {
|
||||
expect(output).toContain('"module":"@angular/core","name":"Component"');
|
||||
});
|
||||
|
||||
it("should write .d.ts files", () => {
|
||||
it('should write .d.ts files', () => {
|
||||
const dtsOutput = path.join(outDir, 'basic.d.ts');
|
||||
expect(fs.existsSync(dtsOutput)).toBeTruthy();
|
||||
expect(fs.readFileSync(dtsOutput, {encoding: 'utf-8'})).toContain('Basic');
|
||||
});
|
||||
|
||||
it("should be able to create the basic component", () => {
|
||||
const appInjector = ReflectiveInjector.resolveAndCreate(BROWSER_APP_PROVIDERS,
|
||||
browserPlatform().injector);
|
||||
it('should be able to create the basic component', () => {
|
||||
const appInjector =
|
||||
ReflectiveInjector.resolveAndCreate(BROWSER_APP_PROVIDERS, browserPlatform().injector);
|
||||
var comp = BasicNgFactory.create(appInjector);
|
||||
expect(comp.instance).toBeTruthy();
|
||||
});
|
||||
|
||||
it("should support ngIf", () => {
|
||||
const appInjector = ReflectiveInjector.resolveAndCreate(BROWSER_APP_PROVIDERS,
|
||||
browserPlatform().injector);
|
||||
it('should support ngIf', () => {
|
||||
const appInjector =
|
||||
ReflectiveInjector.resolveAndCreate(BROWSER_APP_PROVIDERS, browserPlatform().injector);
|
||||
var comp = BasicNgFactory.create(appInjector);
|
||||
var debugElement = <DebugElement>getDebugNode(comp.location.nativeElement);
|
||||
expect(debugElement.children.length).toBe(2);
|
||||
@ -56,9 +56,9 @@ describe("template codegen output", () => {
|
||||
expect(debugElement.children[2].injector.get(MyComp)).toBeTruthy();
|
||||
});
|
||||
|
||||
it("should support ngFor", () => {
|
||||
const appInjector = ReflectiveInjector.resolveAndCreate(BROWSER_APP_PROVIDERS,
|
||||
browserPlatform().injector);
|
||||
it('should support ngFor', () => {
|
||||
const appInjector =
|
||||
ReflectiveInjector.resolveAndCreate(BROWSER_APP_PROVIDERS, browserPlatform().injector);
|
||||
var comp = BasicNgFactory.create(appInjector);
|
||||
var debugElement = <DebugElement>getDebugNode(comp.location.nativeElement);
|
||||
expect(debugElement.children.length).toBe(2);
|
||||
|
@ -10,10 +10,10 @@ let serializer = require('@angular/compiler/src/i18n/xmb_serializer.js');
|
||||
import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
|
||||
describe("template i18n extraction output", () => {
|
||||
describe('template i18n extraction output', () => {
|
||||
const outDir = '';
|
||||
|
||||
it("should extract i18n messages", () => {
|
||||
it('should extract i18n messages', () => {
|
||||
const xmbOutput = path.join(outDir, 'messages.xmb');
|
||||
expect(fs.existsSync(xmbOutput)).toBeTruthy();
|
||||
const xmb = fs.readFileSync(xmbOutput, {encoding: 'utf-8'});
|
||||
|
@ -1,11 +1,13 @@
|
||||
import {MainCompNgFactory} from '../src/projection.ngfactory';
|
||||
import {CompWithProjection} from '../src/projection';
|
||||
import {ReflectiveInjector, DebugElement, getDebugNode} from '@angular/core';
|
||||
import {browserPlatform, BROWSER_APP_PROVIDERS, By} from '@angular/platform-browser';
|
||||
import {DebugElement, ReflectiveInjector, getDebugNode} from '@angular/core';
|
||||
import {BROWSER_APP_PROVIDERS, By, browserPlatform} from '@angular/platform-browser';
|
||||
|
||||
describe("content projection", () => {
|
||||
it("should support basic content projection", () => {
|
||||
const appInjector = ReflectiveInjector.resolveAndCreate(BROWSER_APP_PROVIDERS, browserPlatform().injector);
|
||||
import {CompWithProjection} from '../src/projection';
|
||||
import {MainCompNgFactory} from '../src/projection.ngfactory';
|
||||
|
||||
describe('content projection', () => {
|
||||
it('should support basic content projection', () => {
|
||||
const appInjector =
|
||||
ReflectiveInjector.resolveAndCreate(BROWSER_APP_PROVIDERS, browserPlatform().injector);
|
||||
var mainComp = MainCompNgFactory.create(appInjector);
|
||||
|
||||
var debugElement = <DebugElement>getDebugNode(mainComp.location.nativeElement);
|
||||
|
Reference in New Issue
Block a user