本文整理汇总了TypeScript中angular2/src/render/api.RenderDirectiveMetadata类的典型用法代码示例。如果您正苦于以下问题:TypeScript RenderDirectiveMetadata类的具体用法?TypeScript RenderDirectiveMetadata怎么用?TypeScript RenderDirectiveMetadata使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了RenderDirectiveMetadata类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: expect
expect(() => {
createDirectiveVariableBindings(new RenderElementBinder({variableBindings: new Map()}), [
directiveBinding({metadata: RenderDirectiveMetadata.create({exportAs: 'exportName'})}),
directiveBinding(
{metadata: RenderDirectiveMetadata.create({exportAs: 'exportName'})})
]);
}).not.toThrow();
示例2: it
it("should calculate directive variable bindings", () => {
var dvbs = createDirectiveVariableBindings(
new RenderElementBinder({
variableBindings:
MapWrapper.createFromStringMap<string>({"exportName": "templateName"})
}),
[
directiveBinding(
{metadata: RenderDirectiveMetadata.create({exportAs: 'exportName'})}),
directiveBinding(
{metadata: RenderDirectiveMetadata.create({exportAs: 'otherName'})})
]);
expect(dvbs).toEqual(MapWrapper.createFromStringMap<number>({"templateName": 0}));
});
示例3: it
it('should parse host configuration', () => {
var md = RenderDirectiveMetadata.create({
host: MapWrapper.createFromPairs([
['(event)', 'eventVal'],
['[prop]', 'propVal'],
['@action', 'actionVal'],
['attr', 'attrVal']
])
});
expect(md.hostListeners).toEqual(MapWrapper.createFromPairs([['event', 'eventVal']]));
expect(md.hostProperties).toEqual(MapWrapper.createFromPairs([['prop', 'propVal']]));
expect(md.hostActions).toEqual(MapWrapper.createFromPairs([['action', 'actionVal']]));
expect(md.hostAttributes).toEqual(MapWrapper.createFromPairs([['attr', 'attrVal']]));
});
示例4: process
process(el('<some-comp></some-comp>'), null, [someComponent, someComponentDup]);
}).toThrowError(new RegExp('Only one component directive is allowed per element'));
});
it('should sort the directives and store the component as the first directive', () => {
var results = process(el('<some-comp some-decor></some-comp>'));
expect(annotatedDirectives[results[0].directives[0].directiveIndex].id)
.toEqual('someComponent');
expect(annotatedDirectives[results[0].directives[1].directiveIndex].id)
.toEqual('someDirective');
});
});
});
}
var someComponent = RenderDirectiveMetadata.create(
{selector: 'some-comp', id: 'someComponent', type: RenderDirectiveMetadata.COMPONENT_TYPE});
var someComponentDup = RenderDirectiveMetadata.create(
{selector: 'some-comp', id: 'someComponentDup', type: RenderDirectiveMetadata.COMPONENT_TYPE});
var someComponent2 = RenderDirectiveMetadata.create(
{selector: 'some-comp2', id: 'someComponent2', type: RenderDirectiveMetadata.COMPONENT_TYPE});
var someDirective = RenderDirectiveMetadata.create(
{selector: '[some-decor]', id: 'someDirective', type: RenderDirectiveMetadata.DIRECTIVE_TYPE});
var someDirectiveIgnoringChildren = RenderDirectiveMetadata.create({
selector: '[some-decor-ignoring-children]',
compileChildren: false,
type: RenderDirectiveMetadata.DIRECTIVE_TYPE