angular-cn/modules/angular2/test/compiler/schema_registry_mock.ts
Tobias Bosch 457b689bf0 feat(compiler): add TemplateCompiler
TemplateCompiler is the entry point to the new compiler

Related to #3605
Closes #4220
2015-09-17 04:24:15 +00:00

17 lines
739 B
TypeScript

import {ElementSchemaRegistry} from 'angular2/src/core/render/dom/schema/element_schema_registry';
import {StringMap} from 'angular2/src/core/facade/collection';
import {isPresent} from 'angular2/src/core/facade/lang';
export class MockSchemaRegistry implements ElementSchemaRegistry {
constructor(public existingProperties: StringMap<string, boolean>,
public attrPropMapping: StringMap<string, string>) {}
hasProperty(tagName: string, property: string): boolean {
var result = this.existingProperties[property];
return isPresent(result) ? result : true;
}
getMappedPropName(attrName: string): string {
var result = this.attrPropMapping[attrName];
return isPresent(result) ? result : attrName;
}
}