schema_registry_mock.js
2.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import { SecurityContext } from '@angular/core';
export var MockSchemaRegistry = (function () {
function MockSchemaRegistry(existingProperties, attrPropMapping, existingElements, invalidProperties, invalidAttributes) {
this.existingProperties = existingProperties;
this.attrPropMapping = attrPropMapping;
this.existingElements = existingElements;
this.invalidProperties = invalidProperties;
this.invalidAttributes = invalidAttributes;
}
MockSchemaRegistry.prototype.hasProperty = function (tagName, property, schemas) {
var value = this.existingProperties[property];
return value === void 0 ? true : value;
};
MockSchemaRegistry.prototype.hasElement = function (tagName, schemaMetas) {
var value = this.existingElements[tagName.toLowerCase()];
return value === void 0 ? true : value;
};
MockSchemaRegistry.prototype.allKnownElementNames = function () { return Object.keys(this.existingElements); };
MockSchemaRegistry.prototype.securityContext = function (selector, property, isAttribute) {
return SecurityContext.NONE;
};
MockSchemaRegistry.prototype.getMappedPropName = function (attrName) { return this.attrPropMapping[attrName] || attrName; };
MockSchemaRegistry.prototype.getDefaultComponentElementName = function () { return 'ng-component'; };
MockSchemaRegistry.prototype.validateProperty = function (name) {
if (this.invalidProperties.indexOf(name) > -1) {
return { error: true, msg: "Binding to property '" + name + "' is disallowed for security reasons" };
}
else {
return { error: false };
}
};
MockSchemaRegistry.prototype.validateAttribute = function (name) {
if (this.invalidAttributes.indexOf(name) > -1) {
return {
error: true,
msg: "Binding to attribute '" + name + "' is disallowed for security reasons"
};
}
else {
return { error: false };
}
};
MockSchemaRegistry.prototype.normalizeAnimationStyleProperty = function (propName) { return propName; };
MockSchemaRegistry.prototype.normalizeAnimationStyleValue = function (camelCaseProp, userProvidedProp, val) {
return { error: null, value: val.toString() };
};
return MockSchemaRegistry;
}());
//# sourceMappingURL=schema_registry_mock.js.map