feat(change_detector): add a way to inspect records and record ranges

This commit is contained in:
vsavkin
2014-12-16 16:45:08 -08:00
parent df21c3c77d
commit 1d03c2af5d
5 changed files with 123 additions and 11 deletions

View File

@ -9,7 +9,8 @@ import {
ChangeDetector,
ProtoRecordRange,
RecordRange,
ProtoRecord
ProtoRecord,
RECORD_TYPE_CONST
} from 'change_detection/change_detector';
import {Record} from 'change_detection/record';
@ -337,5 +338,26 @@ export function main() {
]);
});
});
describe("inspect", () => {
it("should return the description of the record", () => {
var proto = new ProtoRecord(null, RECORD_TYPE_CONST, 1, 0, "name", null, "group", "expression");
var record = new Record(null, proto, null);
var i = record.inspect();
expect(i.description).toContain("const, name, enabled");
});
it("should return the description of the records in the range", () => {
var proto = new ProtoRecord(null, RECORD_TYPE_CONST, 1, 0, "name", null, "group", "expression");
var record = new Record(null, proto, null);
var range = new RecordRange(null, null);
range.addRecord(record);
var i = range.inspect();;
expect(i.length).toEqual(1);
expect(i[0]).toContain("const, name, enabled");
});
});
});
}