feat(Directive): convert properties to an array

fixes #2013

BREAKING CHANGE:

Before

    @Directive(properties: {
      'sameName': 'sameName',
      'directiveProp': 'elProp | pipe'
    })

After

    @Directive(properties: [
      'sameName',
      'directiveProp: elProp | pipe'
    ])
This commit is contained in:
Victor Berchet
2015-05-26 15:54:10 +02:00
parent 0387221da8
commit d7df853bde
40 changed files with 182 additions and 179 deletions

View File

@ -219,7 +219,7 @@ export function main() {
it('should set directive.bind', inject([AsyncTestCompleter], (async) => {
captureDirective(DirectiveWithBind)
.then((renderDir) => {
expect(renderDir.properties).toEqual(MapWrapper.createFromStringMap({'a': 'b'}));
expect(renderDir.properties).toEqual(['a: b']);
async.done();
});
}));
@ -478,7 +478,7 @@ class DirectiveWithEvents {
class DirectiveWithProperties {
}
@Directive({properties: {'a': 'b'}})
@Directive({properties: ['a: b']})
class DirectiveWithBind {
}

View File

@ -191,7 +191,7 @@ class NoPropertyAccess {
selector: 'on-change',
// TODO: needed because of https://github.com/angular/angular/issues/2120
lifecycle: const [onChange],
properties: const { 'prop': 'prop' }
properties: const ['prop']
)
@View(template: '')
class OnChangeComponent implements OnChange {

View File

@ -1173,14 +1173,14 @@ class DynamicViewport {
}
}
@Directive({selector: '[my-dir]', properties: {'dirProp': 'elprop'}})
@Directive({selector: '[my-dir]', properties: ['dirProp: elprop']})
@Injectable()
class MyDir {
dirProp: string;
constructor() { this.dirProp = ''; }
}
@Component({selector: 'push-cmp', properties: {'prop': 'prop'}, changeDetection: ON_PUSH})
@Component({selector: 'push-cmp', properties: ['prop'], changeDetection: ON_PUSH})
@View({template: '{{field}}'})
@Injectable()
class PushCmp {
@ -1195,7 +1195,7 @@ class PushCmp {
}
}
@Component({selector: 'push-cmp-with-ref', properties: {'prop': 'prop'}, changeDetection: ON_PUSH})
@Component({selector: 'push-cmp-with-ref', properties: ['prop'], changeDetection: ON_PUSH})
@View({template: '{{field}}'})
@Injectable()
class PushCmpWithRef {
@ -1230,7 +1230,7 @@ class MyComp {
}
}
@Component({selector: 'component-with-pipes', properties: {"prop": "prop | double"}})
@Component({selector: 'component-with-pipes', properties: ["prop: prop | double"]})
@View({template: ''})
@Injectable()
class ComponentWithPipes {
@ -1412,7 +1412,7 @@ class DirectiveListeningDomEventNoPrevent {
onEvent(event) { return true; }
}
@Directive({selector: '[id]', properties: {'id': 'id'}})
@Directive({selector: '[id]', properties: ['id']})
@Injectable()
class IdDir {
id: string;
@ -1459,7 +1459,7 @@ class ToolbarPart {
}
}
@Directive({selector: '[toolbar-vc]', properties: {'toolbarVc': 'toolbarVc'}})
@Directive({selector: '[toolbar-vc]', properties: ['toolbarVc']})
@Injectable()
class ToolbarViewContainer {
vc: ViewContainerRef;
@ -1487,7 +1487,7 @@ class ToolbarComponent {
}
}
@Directive({selector: '[two-way]', properties: {value: 'control'}, events: ['control']})
@Directive({selector: '[two-way]', properties: ['value: control'], events: ['control']})
@Injectable()
class DirectiveWithTwoWayBinding {
control: EventEmitter;

View File

@ -87,7 +87,7 @@ export function main() {
});
}
@Directive({selector: '[text]', properties: {'text': 'text'}})
@Directive({selector: '[text]', properties: ['text']})
@Injectable()
class TextDirective {
text: string;