diff --git a/components/accordion/accordion-group.component.ts b/components/accordion/accordion-group.component.ts index b7cd3d6942..e33abc7635 100644 --- a/components/accordion/accordion-group.component.ts +++ b/components/accordion/accordion-group.component.ts @@ -1,9 +1,11 @@ -import {Component, OnInit, OnDestroy, Input, HostBinding, Inject} from 'angular2/core'; +import { + Component, OnInit, OnDestroy, Input, HostBinding, Inject +} from 'angular2/core'; import {NgClass} from 'angular2/common'; - import {Collapse} from '../collapse'; import {Accordion} from './accordion.component'; +/* tslint:disable:component-selector-name */ @Component({ selector: 'accordion-group, accordion-panel', directives: [Collapse, NgClass], @@ -31,7 +33,8 @@ export class AccordionPanel implements OnInit, OnDestroy { @Input() public isDisabled:boolean; @HostBinding('class.panel-open') - @Input() public get isOpen():boolean { + @Input() + public get isOpen():boolean { return this._isOpen; } @@ -43,20 +46,22 @@ export class AccordionPanel implements OnInit, OnDestroy { } private _isOpen:boolean; + private accordion:Accordion; - constructor(@Inject(Accordion) private accordion:Accordion) { + public constructor(@Inject(Accordion) accordion:Accordion) { + this.accordion = accordion; } - ngOnInit() { + public ngOnInit():any { this.panelClass = this.panelClass || 'panel-default'; this.accordion.addGroup(this); } - ngOnDestroy() { + public ngOnDestroy():any { this.accordion.removeGroup(this); } - public toggleOpen(event:MouseEvent) { + public toggleOpen(event:MouseEvent):any { event.preventDefault(); if (!this.isDisabled) { this.isOpen = !this.isOpen; diff --git a/components/accordion/accordion.component.ts b/components/accordion/accordion.component.ts index f954df207b..84b9db4bd5 100644 --- a/components/accordion/accordion.component.ts +++ b/components/accordion/accordion.component.ts @@ -1,5 +1,4 @@ import {Component, Input, HostBinding} from 'angular2/core'; - import {AccordionPanel} from './accordion-group.component'; // todo: support template url @@ -10,15 +9,17 @@ import {AccordionPanel} from './accordion-group.component'; export class Accordion { @Input() public closeOthers:boolean; + /* tslint:disable:no-unused-variable */ @HostBinding('class.panel-group') - private addClass = true; + private addClass:boolean = true; + /* tslint:enable:no-unused-variable */ - constructor() { + public constructor() { } private groups:Array = []; - public closeOtherPanels(openGroup:AccordionPanel) { + public closeOtherPanels(openGroup:AccordionPanel):void { if (!this.closeOthers) { return; } @@ -30,11 +31,11 @@ export class Accordion { }); } - public addGroup(group:AccordionPanel) { + public addGroup(group:AccordionPanel):void { this.groups.push(group); } - public removeGroup(group:AccordionPanel) { + public removeGroup(group:AccordionPanel):void { let index = this.groups.indexOf(group); if (index !== -1) { this.groups.splice(index, 1); diff --git a/components/alert/alert.component.spec.ts b/components/alert/alert.component.spec.ts index db77845c32..f70475a526 100644 --- a/components/alert/alert.component.spec.ts +++ b/components/alert/alert.component.spec.ts @@ -1,11 +1,4 @@ -import { - it, - inject, - injectAsync, - beforeEachProviders, - TestComponentBuilder -} from 'angular2/testing'; - +import {it, inject, beforeEachProviders} from 'angular2/testing'; import {Alert} from './alert.component'; describe('Alert', () => { @@ -14,6 +7,7 @@ describe('Alert', () => { ]); it('should have default type', inject([Alert], (alert:Alert) => { - expect(alert.type).toEqual('warning'); + expect(alert.type) + .toEqual('warning'); })); }); diff --git a/components/alert/alert.component.ts b/components/alert/alert.component.ts index a3579d0fd9..31164e1170 100644 --- a/components/alert/alert.component.ts +++ b/components/alert/alert.component.ts @@ -1,5 +1,5 @@ -import { Component, OnInit, Input, Output, EventEmitter } from 'angular2/core'; -import { NgIf, NgClass } from 'angular2/common'; +import {Component, OnInit, Input, Output, EventEmitter} from 'angular2/core'; +import {NgIf, NgClass} from 'angular2/common'; const ALERT_TEMPLATE = `