2016-04-28 20:50:03 -04:00
|
|
|
import {isPresent} from '../src/facade/lang';
|
|
|
|
import {ElementSchemaRegistry} from '../index';
|
2015-09-14 18:59:09 -04:00
|
|
|
|
|
|
|
export class MockSchemaRegistry implements ElementSchemaRegistry {
|
2016-04-12 12:40:37 -04:00
|
|
|
constructor(public existingProperties: {[key: string]: boolean},
|
|
|
|
public attrPropMapping: {[key: string]: string}) {}
|
2016-04-28 20:50:03 -04:00
|
|
|
|
2015-09-14 18:59:09 -04:00
|
|
|
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;
|
|
|
|
}
|
2015-10-02 12:30:36 -04:00
|
|
|
}
|