2015-06-18 17:47:38 -04:00
|
|
|
import {
|
|
|
|
ddescribe,
|
|
|
|
describe,
|
|
|
|
it,
|
|
|
|
iit,
|
|
|
|
xit,
|
|
|
|
expect,
|
|
|
|
beforeEach,
|
|
|
|
afterEach,
|
|
|
|
SpyProtoChangeDetector
|
|
|
|
} from 'angular2/test_lib';
|
2015-01-21 15:05:52 -05:00
|
|
|
|
2015-05-26 20:12:38 -04:00
|
|
|
import {
|
|
|
|
PreGeneratedChangeDetection,
|
|
|
|
ChangeDetectorDefinition,
|
|
|
|
DynamicProtoChangeDetector
|
|
|
|
} from 'angular2/change_detection';
|
2015-05-13 16:25:18 -04: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(() => {
|
2015-06-18 17:47:38 -04:00
|
|
|
proto = new SpyProtoChangeDetector();
|
2015-05-13 16:25:18 -04:00
|
|
|
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", () => {
|
2015-05-29 19:34:51 -04:00
|
|
|
var map = {'id': (registry, def) => proto};
|
2015-05-13 16:25:18 -04:00
|
|
|
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
|
|
|
});
|
|
|
|
}
|