@ -18,48 +18,52 @@ import {
|
||||
|
||||
import {Injectable, bind} from 'angular2/core';
|
||||
import {NgIf} from 'angular2/common';
|
||||
import {Directive, Component, View, ViewMetadata} from 'angular2/core';
|
||||
import {Directive, Component, ViewMetadata} from 'angular2/core';
|
||||
import {PromiseWrapper} from 'angular2/src/facade/promise';
|
||||
import {XHR} from 'angular2/src/compiler/xhr';
|
||||
import {XHRImpl} from 'angular2/src/platform/browser/xhr_impl';
|
||||
|
||||
// Services, and components for the tests.
|
||||
|
||||
@Component({selector: 'child-comp'})
|
||||
@View({template: `<span>Original {{childBinding}}</span>`, directives: []})
|
||||
@Component(
|
||||
{selector: 'child-comp', template: `<span>Original {{childBinding}}</span>`, directives: []})
|
||||
@Injectable()
|
||||
class ChildComp {
|
||||
childBinding: string;
|
||||
constructor() { this.childBinding = 'Child'; }
|
||||
}
|
||||
|
||||
@Component({selector: 'child-comp'})
|
||||
@View({template: `<span>Mock</span>`})
|
||||
@Component({selector: 'child-comp', template: `<span>Mock</span>`})
|
||||
@Injectable()
|
||||
class MockChildComp {
|
||||
}
|
||||
|
||||
@Component({selector: 'parent-comp'})
|
||||
@View({template: `Parent(<child-comp></child-comp>)`, directives: [ChildComp]})
|
||||
@Component({
|
||||
selector: 'parent-comp',
|
||||
template: `Parent(<child-comp></child-comp>)`,
|
||||
directives: [ChildComp]
|
||||
})
|
||||
@Injectable()
|
||||
class ParentComp {
|
||||
}
|
||||
|
||||
@Component({selector: 'my-if-comp'})
|
||||
@View({template: `MyIf(<span *ngIf="showMore">More</span>)`, directives: [NgIf]})
|
||||
@Component({
|
||||
selector: 'my-if-comp',
|
||||
template: `MyIf(<span *ngIf="showMore">More</span>)`,
|
||||
directives: [NgIf]
|
||||
})
|
||||
@Injectable()
|
||||
class MyIfComp {
|
||||
showMore: boolean = false;
|
||||
}
|
||||
|
||||
@Component({selector: 'child-child-comp'})
|
||||
@View({template: `<span>ChildChild</span>`})
|
||||
@Component({selector: 'child-child-comp', template: `<span>ChildChild</span>`})
|
||||
@Injectable()
|
||||
class ChildChildComp {
|
||||
}
|
||||
|
||||
@Component({selector: 'child-comp'})
|
||||
@View({
|
||||
@Component({
|
||||
selector: 'child-comp',
|
||||
template: `<span>Original {{childBinding}}(<child-child-comp></child-child-comp>)</span>`,
|
||||
directives: [ChildChildComp]
|
||||
})
|
||||
@ -69,8 +73,7 @@ class ChildWithChildComp {
|
||||
constructor() { this.childBinding = 'Child'; }
|
||||
}
|
||||
|
||||
@Component({selector: 'child-child-comp'})
|
||||
@View({template: `<span>ChildChild Mock</span>`})
|
||||
@Component({selector: 'child-child-comp', template: `<span>ChildChild Mock</span>`})
|
||||
@Injectable()
|
||||
class MockChildChildComp {
|
||||
}
|
||||
@ -84,25 +87,32 @@ class MockFancyService extends FancyService {
|
||||
value: string = 'mocked out value';
|
||||
}
|
||||
|
||||
@Component({selector: 'my-service-comp', providers: [FancyService]})
|
||||
@View({template: `injected value: {{fancyService.value}}`})
|
||||
@Component({
|
||||
selector: 'my-service-comp',
|
||||
providers: [FancyService],
|
||||
template: `injected value: {{fancyService.value}}`
|
||||
})
|
||||
class TestProvidersComp {
|
||||
constructor(private fancyService: FancyService) {}
|
||||
}
|
||||
|
||||
@Component({selector: 'my-service-comp', viewProviders: [FancyService]})
|
||||
@View({template: `injected value: {{fancyService.value}}`})
|
||||
@Component({
|
||||
selector: 'my-service-comp',
|
||||
viewProviders: [FancyService],
|
||||
template: `injected value: {{fancyService.value}}`
|
||||
})
|
||||
class TestViewProvidersComp {
|
||||
constructor(private fancyService: FancyService) {}
|
||||
}
|
||||
|
||||
@Component({selector: 'external-template-comp'})
|
||||
@View({templateUrl: '/base/modules/angular2/test/testing/static_assets/test.html'})
|
||||
@Component({
|
||||
selector: 'external-template-comp',
|
||||
templateUrl: '/base/modules/angular2/test/testing/static_assets/test.html'
|
||||
})
|
||||
class ExternalTemplateComp {
|
||||
}
|
||||
|
||||
@Component({selector: 'bad-template-comp'})
|
||||
@View({templateUrl: 'non-existant.html'})
|
||||
@Component({selector: 'bad-template-comp', templateUrl: 'non-existant.html'})
|
||||
class BadTemplateUrl {
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user