feat(compiler): add full directive metadata and validation logic
With this, the new `TemplateParser` has feature/data parity with the `ProtoViewDto` of the `RenderCompiler`. Part of #3605 Closes #3880
This commit is contained in:
@@ -14,30 +14,26 @@ import {IS_DART} from '../../../../platform';
|
||||
import {
|
||||
DomElementSchemaRegistry
|
||||
} from 'angular2/src/core/render/dom/schema/dom_element_schema_registry';
|
||||
import {DOM} from 'angular2/src/core/dom/dom_adapter';
|
||||
|
||||
export function main() {
|
||||
// DOMElementSchema can only be used on the JS side where we can safely
|
||||
// use reflection for DOM elements
|
||||
if (IS_DART) return;
|
||||
|
||||
var registry;
|
||||
var registry: DomElementSchemaRegistry;
|
||||
|
||||
beforeEach(() => { registry = new DomElementSchemaRegistry(); });
|
||||
|
||||
describe('DOMElementSchema', () => {
|
||||
|
||||
it('should detect properties on regular elements', () => {
|
||||
var divEl = DOM.createElement('div');
|
||||
expect(registry.hasProperty(divEl, 'id')).toBeTruthy();
|
||||
expect(registry.hasProperty(divEl, 'title')).toBeTruthy();
|
||||
expect(registry.hasProperty(divEl, 'unknown')).toBeFalsy();
|
||||
expect(registry.hasProperty('div', 'id')).toBeTruthy();
|
||||
expect(registry.hasProperty('div', 'title')).toBeTruthy();
|
||||
expect(registry.hasProperty('div', 'unknown')).toBeFalsy();
|
||||
});
|
||||
|
||||
it('should return true for custom-like elements', () => {
|
||||
var customLikeEl = DOM.createElement('custom-like');
|
||||
expect(registry.hasProperty(customLikeEl, 'unknown')).toBeTruthy();
|
||||
});
|
||||
it('should return true for custom-like elements',
|
||||
() => { expect(registry.hasProperty('custom-like', 'unknown')).toBeTruthy(); });
|
||||
|
||||
it('should not re-map property names that are not specified in DOM facade',
|
||||
() => { expect(registry.getMappedPropName('readonly')).toEqual('readOnly'); });
|
||||
|
||||
Reference in New Issue
Block a user