2015-11-06 20:34:07 -05:00
|
|
|
import {isBlank} from 'angular2/src/facade/lang';
|
2015-09-08 12:57:51 -04:00
|
|
|
import {Pipes} from 'angular2/src/core/change_detection/pipes';
|
2015-12-02 13:35:51 -05:00
|
|
|
import {EventEmitter} from 'angular2/src/facade/async';
|
2015-09-08 12:57:51 -04:00
|
|
|
import {
|
2015-12-02 13:35:51 -05:00
|
|
|
ChangeDetector,
|
2015-09-08 12:57:51 -04:00
|
|
|
ChangeDispatcher,
|
|
|
|
DirectiveIndex,
|
|
|
|
BindingTarget
|
|
|
|
} from 'angular2/src/core/change_detection/change_detection';
|
|
|
|
|
|
|
|
export class TestDirective {
|
|
|
|
eventLog: string[] = [];
|
|
|
|
dirProp: string;
|
2015-12-02 13:35:51 -05:00
|
|
|
click: EventEmitter<any> = new EventEmitter<any>();
|
2015-09-08 12:57:51 -04:00
|
|
|
|
|
|
|
onEvent(value: string) { this.eventLog.push(value); }
|
|
|
|
}
|
|
|
|
|
|
|
|
export class TestDispatcher implements ChangeDispatcher {
|
|
|
|
log: string[];
|
|
|
|
|
2015-12-02 13:35:51 -05:00
|
|
|
constructor(public directives: any[], public detectors: ChangeDetector[]) { this.clear(); }
|
2015-09-08 12:57:51 -04:00
|
|
|
|
|
|
|
getDirectiveFor(di: DirectiveIndex) { return this.directives[di.directiveIndex]; }
|
|
|
|
|
|
|
|
getDetectorFor(di: DirectiveIndex) { return this.detectors[di.directiveIndex]; }
|
|
|
|
|
|
|
|
clear() { this.log = []; }
|
|
|
|
|
|
|
|
notifyOnBinding(target: BindingTarget, value) {
|
|
|
|
this.log.push(`${target.mode}(${target.name})=${this._asString(value)}`);
|
|
|
|
}
|
|
|
|
|
|
|
|
logBindingUpdate(target, value) {}
|
|
|
|
|
|
|
|
notifyAfterContentChecked() {}
|
|
|
|
notifyAfterViewChecked() {}
|
|
|
|
|
2015-12-02 13:35:51 -05:00
|
|
|
notifyOnDestroy() {}
|
|
|
|
|
|
|
|
getDebugContext(a, b, c) { return null; }
|
2015-09-08 12:57:51 -04:00
|
|
|
|
|
|
|
_asString(value) { return (isBlank(value) ? 'null' : value.toString()); }
|
|
|
|
}
|
|
|
|
|
|
|
|
export class TestPipes implements Pipes {
|
|
|
|
get(type: string) { return null; }
|
|
|
|
}
|