feat(DomElementSchemaRegistry): add support for <ng-content> and <ng-container>

This commit is contained in:
Victor Berchet 2016-06-15 09:57:58 -07:00
parent e484c62a8d
commit b620f4f456
2 changed files with 15 additions and 1 deletions

View File

@ -265,7 +265,11 @@ export class DomElementSchemaRegistry extends ElementSchemaRegistry {
hasProperty(tagName: string, propName: string): boolean { hasProperty(tagName: string, propName: string): boolean {
if (tagName.indexOf('-') !== -1) { if (tagName.indexOf('-') !== -1) {
// can't tell now as we don't know which properties a custom element will get if (tagName === 'ng-container' || tagName === 'ng-content') {
return false;
}
// Can't tell now as we don't know which properties a custom element will get
// once it is instantiated // once it is instantiated
return true; return true;
} else { } else {

View File

@ -72,6 +72,16 @@ export function main() {
expect(registry.securityContext('p', 'formAction')).toBe(SecurityContext.URL); expect(registry.securityContext('p', 'formAction')).toBe(SecurityContext.URL);
}); });
describe('Angular custom elements', () => {
it('should support <ng-container>',
() => { expect(registry.hasProperty('ng-container', 'id')).toBeFalsy(); });
it('should support <ng-content>', () => {
expect(registry.hasProperty('ng-content', 'id')).toBeFalsy();
expect(registry.hasProperty('ng-content', 'select')).toBeFalsy();
});
});
if (browserDetection.isChromeDesktop) { if (browserDetection.isChromeDesktop) {
it('generate a new schema', () => { it('generate a new schema', () => {
let schema = '\n'; let schema = '\n';