当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript MapWrapper.createFromPairs方法代码示例

本文整理汇总了TypeScript中angular2/src/facade/collection.MapWrapper.createFromPairs方法的典型用法代码示例。如果您正苦于以下问题:TypeScript MapWrapper.createFromPairs方法的具体用法?TypeScript MapWrapper.createFromPairs怎么用?TypeScript MapWrapper.createFromPairs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在angular2/src/facade/collection.MapWrapper的用法示例。


在下文中一共展示了MapWrapper.createFromPairs方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: it

 it('mapToDirectiveMetadata', () => {
   var map = MapWrapper.createFromPairs([
     ['compileChildren', false],
     ['hostListeners', MapWrapper.createFromPairs([['testKey', 'testVal']])],
     ['hostProperties', MapWrapper.createFromPairs([['hostPropKey', 'hostPropVal']])],
     ['hostActions', MapWrapper.createFromPairs([['hostActionKey', 'hostActionVal']])],
     ['id', 'testId'],
     ['properties', MapWrapper.createFromPairs([['propKey', 'propVal']])],
     ['readAttributes', ['readTest1', 'readTest2']],
     ['selector', 'testSelector'],
     ['type', DirectiveMetadata.DIRECTIVE_TYPE]
   ]);
   var meta = directiveMetadataFromMap(map);
   expect(meta.compileChildren).toEqual(false);
   expect(meta.hostListeners).toEqual(MapWrapper.createFromPairs([['testKey', 'testVal']]));
   expect(meta.hostProperties)
       .toEqual(MapWrapper.createFromPairs([['hostPropKey', 'hostPropVal']]));
   expect(meta.hostActions)
       .toEqual(MapWrapper.createFromPairs([['hostActionKey', 'hostActionVal']]));
   expect(meta.id).toEqual('testId');
   expect(meta.properties).toEqual(MapWrapper.createFromPairs([['propKey', 'propVal']]));
   expect(meta.readAttributes).toEqual(['readTest1', 'readTest2']);
   expect(meta.selector).toEqual('testSelector');
   expect(meta.type).toEqual(DirectiveMetadata.DIRECTIVE_TYPE);
 });
开发者ID:188799958,项目名称:angular,代码行数:25,代码来源:convert_spec.ts

示例2: 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']]));
      });
开发者ID:lavinjj,项目名称:angular,代码行数:15,代码来源:api_spec.ts

示例3: it

 it('mapToDirectiveMetadata', () => {
   var map = MapWrapper.createFromPairs([
     ['compileChildren', false],
     ['hostProperties', MapWrapper.createFromPairs([['PKey', 'testVal']])],
     ['hostListeners', MapWrapper.createFromPairs([['LKey', 'testVal']])],
     ['hostActions', MapWrapper.createFromPairs([['AcKey', 'testVal']])],
     ['hostAttributes', MapWrapper.createFromPairs([['AtKey', 'testVal']])],
     ['id', 'testId'],
     ['properties', ['propKey: propVal']],
     ['readAttributes', ['readTest1', 'readTest2']],
     ['selector', 'testSelector'],
     ['type', RenderDirectiveMetadata.DIRECTIVE_TYPE],
     ['exportAs', 'aaa'],
     ['callOnDestroy', true],
     ['callOnCheck', true],
     ['callOnInit', true],
     ['callOnChange', true],
     ['callOnAllChangesDone', true],
     ['events', ['onFoo', 'onBar']],
     ['changeDetection', 'CHECK_ONCE']
   ]);
   var meta = directiveMetadataFromMap(map);
   expect(meta.compileChildren).toEqual(false);
   expect(meta.hostProperties).toEqual(MapWrapper.createFromPairs([['PKey', 'testVal']]));
   expect(meta.hostListeners).toEqual(MapWrapper.createFromPairs([['LKey', 'testVal']]));
   expect(meta.hostActions).toEqual(MapWrapper.createFromPairs([['AcKey', 'testVal']]));
   expect(meta.hostAttributes).toEqual(MapWrapper.createFromPairs([['AtKey', 'testVal']]));
   expect(meta.id).toEqual('testId');
   expect(meta.properties).toEqual(['propKey: propVal']);
   expect(meta.readAttributes).toEqual(['readTest1', 'readTest2']);
   expect(meta.selector).toEqual('testSelector');
   expect(meta.type).toEqual(RenderDirectiveMetadata.DIRECTIVE_TYPE);
   expect(meta.exportAs).toEqual('aaa');
   expect(meta.callOnDestroy).toEqual(true);
   expect(meta.callOnCheck).toEqual(true);
   expect(meta.callOnInit).toEqual(true);
   expect(meta.callOnChange).toEqual(true);
   expect(meta.callOnAllChangesDone).toEqual(true);
   expect(meta.events).toEqual(['onFoo', 'onBar']);
   expect(meta.changeDetection).toEqual('CHECK_ONCE');
 });
开发者ID:lavinjj,项目名称:angular,代码行数:41,代码来源:convert_spec.ts

示例4: it

 it('directiveMetadataToMap', () => {
   var someComponent = new DirectiveMetadata({
     compileChildren: false,
     hostListeners: MapWrapper.createFromPairs([['LKey', 'LVal']]),
     hostProperties: MapWrapper.createFromPairs([['PKey', 'PVal']]),
     hostActions: MapWrapper.createFromPairs([['AcKey', 'AcVal']]),
     hostAttributes: MapWrapper.createFromPairs([['AtKey', 'AtVal']]),
     id: 'someComponent',
     properties: ['propKey: propVal'],
     readAttributes: ['read1', 'read2'],
     selector: 'some-comp',
     type: DirectiveMetadata.COMPONENT_TYPE,
     exportAs: 'aaa',
     callOnDestroy: true,
     callOnChange: true,
     callOnCheck: true,
     callOnInit: true,
     callOnAllChangesDone: true,
     events: ['onFoo', 'onBar'],
     changeDetection: 'CHECK_ONCE'
   });
   var map = directiveMetadataToMap(someComponent);
   expect(MapWrapper.get(map, 'compileChildren')).toEqual(false);
   expect(MapWrapper.get(map, 'hostListeners'))
       .toEqual(MapWrapper.createFromPairs([['LKey', 'LVal']]));
   expect(MapWrapper.get(map, 'hostProperties'))
       .toEqual(MapWrapper.createFromPairs([['PKey', 'PVal']]));
   expect(MapWrapper.get(map, 'hostActions'))
       .toEqual(MapWrapper.createFromPairs([['AcKey', 'AcVal']]));
   expect(MapWrapper.get(map, 'hostAttributes'))
       .toEqual(MapWrapper.createFromPairs([['AtKey', 'AtVal']]));
   expect(MapWrapper.get(map, 'id')).toEqual('someComponent');
   expect(MapWrapper.get(map, 'properties')).toEqual(['propKey: propVal']);
   expect(MapWrapper.get(map, 'readAttributes')).toEqual(['read1', 'read2']);
   expect(MapWrapper.get(map, 'selector')).toEqual('some-comp');
   expect(MapWrapper.get(map, 'type')).toEqual(DirectiveMetadata.COMPONENT_TYPE);
   expect(MapWrapper.get(map, 'callOnDestroy')).toEqual(true);
   expect(MapWrapper.get(map, 'callOnCheck')).toEqual(true);
   expect(MapWrapper.get(map, 'callOnChange')).toEqual(true);
   expect(MapWrapper.get(map, 'callOnInit')).toEqual(true);
   expect(MapWrapper.get(map, 'callOnAllChangesDone')).toEqual(true);
   expect(MapWrapper.get(map, 'exportAs')).toEqual('aaa');
   expect(MapWrapper.get(map, 'events')).toEqual(['onFoo', 'onBar']);
   expect(MapWrapper.get(map, 'changeDetection')).toEqual('CHECK_ONCE');
 });
开发者ID:AsherBarak,项目名称:angular,代码行数:45,代码来源:convert_spec.ts

示例5: it

 it("should fall back to a regular field read when the locals map" + "does not have the requested field", () => {
   var locals = new Locals(null, MapWrapper.createFromPairs([["key", "value"]]));
   expect(executeWatch('name', 'name', new Person("Jim"), locals)).toEqual(['name=Jim']);
 });
开发者ID:gdi2290,项目名称:sample-Angular2,代码行数:4,代码来源:change_detection_spec.ts

示例6: beforeEach

 beforeEach(() => {
   locals = new Locals(null, MapWrapper.createFromPairs([['key', 'value'], ['nullKey', null]]));
 });
开发者ID:LordBinary,项目名称:angular,代码行数:3,代码来源:locals_spec.ts


注:本文中的angular2/src/facade/collection.MapWrapper.createFromPairs方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。