feat(Directive): Have a single Directive.host which mimics HTML
fixes #2268 BREAKING CHANGE: Before @Directive({ hostListeners: {'event': 'statement'}, hostProperties: {'expression': 'hostProp'}, hostAttributes: {'attr': 'value'}, hostActions: {'action': 'statement'} }) After @Directive({ host: { '(event)': 'statement', '[hostProp]': 'expression' // k & v swapped 'attr': 'value', '@action': 'statement' } })
This commit is contained in:

committed by
Tobias Bosch

parent
47b6b05017
commit
f3b49378e4
26
modules/angular2/test/render/api_spec.ts
Normal file
26
modules/angular2/test/render/api_spec.ts
Normal file
@ -0,0 +1,26 @@
|
||||
import {DirectiveMetadata} from 'angular2/src/render/api';
|
||||
|
||||
import {MapWrapper} from 'angular2/src/facade/collection';
|
||||
import {ddescribe, describe, expect, it} from 'angular2/test_lib';
|
||||
|
||||
export function main() {
|
||||
describe('Metadata', () => {
|
||||
describe('host', () => {
|
||||
it('should parse host configuration', () => {
|
||||
var md = DirectiveMetadata.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']]));
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
Reference in New Issue
Block a user