angular-docs-cn/modules/angular2/test/compiler/schema_registry_mock.ts
Alex Rickabaugh 60727c4d2b revert(format): Revert "chore(format): update to latest formatter"
This reverts commit 03627aa84d90f7f1d8d62f160997b783fdf9eaa4.
2016-04-12 09:41:01 -07:00

17 lines
661 B
TypeScript

import {ElementSchemaRegistry} from 'angular2/src/compiler/schema/element_schema_registry';
import {isPresent} from 'angular2/src/facade/lang';
export class MockSchemaRegistry implements ElementSchemaRegistry {
constructor(public existingProperties: {[key: string]: boolean},
public attrPropMapping: {[key: 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;
}
}