2015-05-13 16:01:31 -04:00
|
|
|
import {ddescribe, describe, it, iit, xit, expect, beforeEach, afterEach} from 'angular2/test_lib';
|
2015-01-21 15:05:52 -05:00
|
|
|
|
2015-05-13 16:25:18 -04:00
|
|
|
import {PreGeneratedChangeDetection, ChangeDetectorDefinition, ProtoChangeDetector, DynamicProtoChangeDetector} from 'angular2/change_detection';
|
|
|
|
|
|
|
|
class DummyChangeDetector extends ProtoChangeDetector {}
|
2015-01-21 15:05:52 -05:00
|
|
|
|
2015-01-14 16:51:16 -05:00
|
|
|
export function main() {
|
2015-05-13 16:01:31 -04:00
|
|
|
describe("PreGeneratedChangeDetection", () => {
|
2015-05-13 16:25:18 -04:00
|
|
|
var proto;
|
|
|
|
var def;
|
|
|
|
|
|
|
|
beforeEach(() => {
|
|
|
|
proto = new DummyChangeDetector();
|
|
|
|
def = new ChangeDetectorDefinition('id', null, [], [], []);
|
|
|
|
});
|
2015-05-13 16:01:31 -04:00
|
|
|
|
2015-05-13 16:25:18 -04:00
|
|
|
it("should return a proto change detector when one is available", () => {
|
|
|
|
var map = {'id' : (registry) => proto};
|
|
|
|
var cd = new PreGeneratedChangeDetection(null, map);
|
|
|
|
|
|
|
|
expect(cd.createProtoChangeDetector(def)).toBe(proto)
|
|
|
|
});
|
2015-05-13 16:01:31 -04:00
|
|
|
|
2015-05-13 16:25:18 -04:00
|
|
|
it("should delegate to dynamic change detection otherwise", () => {
|
|
|
|
var cd = new PreGeneratedChangeDetection(null, {});
|
|
|
|
expect(cd.createProtoChangeDetector(def)).toBeAnInstanceOf(DynamicProtoChangeDetector);
|
2015-05-13 16:01:31 -04:00
|
|
|
});
|
2015-01-14 16:51:16 -05:00
|
|
|
});
|
|
|
|
}
|