refactor(compiler): rename decorator directives into directive
BREAKING CHANGE: Previously, `Directive` was the abstract base class of several directives. Now, `Directive` is the former `Decorator`, and `Component` inherits from it.
This commit is contained in:
+2
-2
@@ -12,7 +12,7 @@ import {
|
||||
} from 'angular2/test_lib';
|
||||
import {bootstrap} from 'angular2/src/core/application';
|
||||
import {appDocumentToken, appElementToken} from 'angular2/src/core/application_tokens';
|
||||
import {Component, Decorator} from 'angular2/src/core/annotations_impl/annotations';
|
||||
import {Component, Directive} from 'angular2/src/core/annotations_impl/annotations';
|
||||
import {DOM} from 'angular2/src/dom/dom_adapter';
|
||||
import {ListWrapper} from 'angular2/src/facade/collection';
|
||||
import {PromiseWrapper} from 'angular2/src/facade/async';
|
||||
@@ -68,7 +68,7 @@ class HelloRootCmp4 {
|
||||
@Component({selector: 'hello-app'})
|
||||
class HelloRootMissingTemplate { }
|
||||
|
||||
@Decorator({selector: 'hello-app'})
|
||||
@Directive({selector: 'hello-app'})
|
||||
class HelloRootDirectiveIsNotCmp { }
|
||||
|
||||
export function main() {
|
||||
|
||||
+17
-17
@@ -21,7 +21,7 @@ import {Compiler, CompilerCache} from 'angular2/src/core/compiler/compiler';
|
||||
import {AppProtoView} from 'angular2/src/core/compiler/view';
|
||||
import {ElementBinder} from 'angular2/src/core/compiler/element_binder';
|
||||
import {DirectiveMetadataReader} from 'angular2/src/core/compiler/directive_metadata_reader';
|
||||
import {Component, Decorator} from 'angular2/src/core/annotations_impl/annotations';
|
||||
import {Component, Directive} from 'angular2/src/core/annotations_impl/annotations';
|
||||
import {Attribute} from 'angular2/src/core/annotations_impl/di';
|
||||
import {View} from 'angular2/src/core/annotations_impl/view';
|
||||
import {internalProtoView} from 'angular2/src/core/compiler/view_ref';
|
||||
@@ -151,8 +151,8 @@ export function main() {
|
||||
}));
|
||||
|
||||
it('should fill directive.type for decorator directives', inject([AsyncTestCompleter], (async) => {
|
||||
captureDirective(SomeDecoratorDirective).then( (renderDir) => {
|
||||
expect(renderDir.type).toEqual(renderApi.DirectiveMetadata.DECORATOR_TYPE);
|
||||
captureDirective(SomeDirective).then( (renderDir) => {
|
||||
expect(renderDir.type).toEqual(renderApi.DirectiveMetadata.DIRECTIVE_TYPE);
|
||||
async.done();
|
||||
});
|
||||
}));
|
||||
@@ -165,14 +165,14 @@ export function main() {
|
||||
}));
|
||||
|
||||
it('should set directive.compileChildren to true for decorator directives', inject([AsyncTestCompleter], (async) => {
|
||||
captureDirective(SomeDecoratorDirective).then( (renderDir) => {
|
||||
captureDirective(SomeDirective).then( (renderDir) => {
|
||||
expect(renderDir.compileChildren).toEqual(true);
|
||||
async.done();
|
||||
});
|
||||
}));
|
||||
|
||||
it('should set directive.compileChildren to false for decorator directives', inject([AsyncTestCompleter], (async) => {
|
||||
captureDirective(IgnoreChildrenDecoratorDirective).then( (renderDir) => {
|
||||
captureDirective(IgnoreChildrenDirective).then( (renderDir) => {
|
||||
expect(renderDir.compileChildren).toEqual(false);
|
||||
async.done();
|
||||
});
|
||||
@@ -241,14 +241,14 @@ export function main() {
|
||||
tplResolver.setView(MainComponent,
|
||||
new View({
|
||||
template: '<div></div>',
|
||||
directives: [SomeDecoratorDirective]
|
||||
directives: [SomeDirective]
|
||||
})
|
||||
);
|
||||
var compiler = createCompiler([createRenderProtoView()], [createProtoView()]);
|
||||
compiler.compile(MainComponent).then( (_) => {
|
||||
var request = protoViewFactory.requests[0];
|
||||
var binding = request[2][0];
|
||||
expect(binding.key.token).toBe(SomeDecoratorDirective);
|
||||
expect(binding.key.token).toBe(SomeDirective);
|
||||
async.done();
|
||||
});
|
||||
}));
|
||||
@@ -420,8 +420,8 @@ export function main() {
|
||||
it('should throw for non component types', () => {
|
||||
var compiler = createCompiler([], []);
|
||||
expect(
|
||||
() => compiler.compile(SomeDecoratorDirective)
|
||||
).toThrowError(`Could not load '${stringify(SomeDecoratorDirective)}' because it is not a component.`);
|
||||
() => compiler.compile(SomeDirective)
|
||||
).toThrowError(`Could not load '${stringify(SomeDirective)}' because it is not a component.`);
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -493,30 +493,30 @@ class RecursiveComponent {}
|
||||
@Component()
|
||||
class SomeDynamicComponentDirective {}
|
||||
|
||||
@Decorator()
|
||||
class SomeDecoratorDirective {}
|
||||
@Directive()
|
||||
class SomeDirective {}
|
||||
|
||||
@Decorator({
|
||||
@Directive({
|
||||
compileChildren: false
|
||||
})
|
||||
class IgnoreChildrenDecoratorDirective {}
|
||||
class IgnoreChildrenDirective {}
|
||||
|
||||
@Decorator({
|
||||
@Directive({
|
||||
hostListeners: {'someEvent': 'someAction'}
|
||||
})
|
||||
class DirectiveWithEvents {}
|
||||
|
||||
@Decorator({
|
||||
@Directive({
|
||||
hostProperties: {'someField': 'someProp'}
|
||||
})
|
||||
class DirectiveWithProperties {}
|
||||
|
||||
@Decorator({
|
||||
@Directive({
|
||||
properties: {'a': 'b'}
|
||||
})
|
||||
class DirectiveWithBind {}
|
||||
|
||||
@Decorator()
|
||||
@Directive()
|
||||
class DirectiveWithAttributes {
|
||||
constructor(@Attribute('someAttr') someAttr:string) {}
|
||||
}
|
||||
|
||||
@@ -2,15 +2,15 @@ import {isPresent} from 'angular2/src/facade/lang';
|
||||
import {ListWrapper} from 'angular2/src/facade/collection';
|
||||
import {ddescribe, describe, it, iit, expect, beforeEach} from 'angular2/test_lib';
|
||||
import {DirectiveMetadataReader} from 'angular2/src/core/compiler/directive_metadata_reader';
|
||||
import {Decorator, Component} from 'angular2/src/core/annotations_impl/annotations';
|
||||
import {Directive, Component} from 'angular2/src/core/annotations_impl/annotations';
|
||||
import {DirectiveMetadata} from 'angular2/src/core/compiler/directive_metadata';
|
||||
import {Injectable, Injector} from 'angular2/di';
|
||||
|
||||
@Injectable()
|
||||
class SomeInjectable {}
|
||||
|
||||
@Decorator({selector: 'someDecorator'})
|
||||
class SomeDecorator {}
|
||||
@Directive({selector: 'someDirective'})
|
||||
class SomeDirective {}
|
||||
|
||||
@Component({selector: 'someComponent', injectables: [SomeInjectable]})
|
||||
class SomeComponent {}
|
||||
@@ -26,10 +26,10 @@ export function main() {
|
||||
reader = new DirectiveMetadataReader();
|
||||
});
|
||||
|
||||
it('should read out the Decorator annotation', () => {
|
||||
var directiveMetadata = reader.read(SomeDecorator);
|
||||
it('should read out the Directive annotation', () => {
|
||||
var directiveMetadata = reader.read(SomeDirective);
|
||||
expect(directiveMetadata).toEqual(
|
||||
new DirectiveMetadata(SomeDecorator, new Decorator({selector: 'someDecorator'}), null));
|
||||
new DirectiveMetadata(SomeDirective, new Directive({selector: 'someDirective'}), null));
|
||||
});
|
||||
|
||||
it('should read out the Component annotation', () => {
|
||||
|
||||
@@ -16,7 +16,7 @@ import {
|
||||
|
||||
import {TestBed} from 'angular2/src/test_lib/test_bed';
|
||||
|
||||
import {Decorator, Component} from 'angular2/src/core/annotations_impl/annotations';
|
||||
import {Component} from 'angular2/src/core/annotations_impl/annotations';
|
||||
import {View} from 'angular2/src/core/annotations_impl/view';
|
||||
import {DynamicComponentLoader} from 'angular2/src/core/compiler/dynamic_component_loader';
|
||||
import {ElementRef} from 'angular2/src/core/compiler/element_ref';
|
||||
|
||||
+39
-39
@@ -24,7 +24,7 @@ import {Injector, bind} from 'angular2/di';
|
||||
import {PipeRegistry, defaultPipeRegistry,
|
||||
ChangeDetection, DynamicChangeDetection, Pipe, ChangeDetectorRef, ON_PUSH} from 'angular2/change_detection';
|
||||
|
||||
import {Decorator, Component} from 'angular2/src/core/annotations_impl/annotations';
|
||||
import {Directive, Component} from 'angular2/src/core/annotations_impl/annotations';
|
||||
import {View} from 'angular2/src/core/annotations_impl/view';
|
||||
import {Parent, Ancestor} from 'angular2/src/core/annotations_impl/visibility';
|
||||
import {Attribute} from 'angular2/src/core/annotations_impl/di';
|
||||
@@ -548,15 +548,15 @@ export function main() {
|
||||
it('should support events via EventEmitter', inject([TestBed, AsyncTestCompleter], (tb, async) => {
|
||||
tb.overrideView(MyComp, new View({
|
||||
template: '<div emitter listener></div>',
|
||||
directives: [DecoratorEmitingEvent, DecoratorListeningEvent]
|
||||
directives: [DirectiveEmitingEvent, DirectiveListeningEvent]
|
||||
}));
|
||||
|
||||
tb.createView(MyComp, {context: ctx}).then((view) => {
|
||||
|
||||
var injector = view.rawView.elementInjectors[0];
|
||||
|
||||
var emitter = injector.get(DecoratorEmitingEvent);
|
||||
var listener = injector.get(DecoratorListeningEvent);
|
||||
var emitter = injector.get(DirectiveEmitingEvent);
|
||||
var listener = injector.get(DirectiveListeningEvent);
|
||||
|
||||
expect(listener.msg).toEqual('');
|
||||
|
||||
@@ -572,14 +572,14 @@ export function main() {
|
||||
it('should support render events', inject([TestBed, AsyncTestCompleter], (tb, async) => {
|
||||
tb.overrideView(MyComp, new View({
|
||||
template: '<div listener></div>',
|
||||
directives: [DecoratorListeningDomEvent]
|
||||
directives: [DirectiveListeningDomEvent]
|
||||
}));
|
||||
|
||||
tb.createView(MyComp, {context: ctx}).then((view) => {
|
||||
|
||||
var injector = view.rawView.elementInjectors[0];
|
||||
|
||||
var listener = injector.get(DecoratorListeningDomEvent);
|
||||
var listener = injector.get(DirectiveListeningDomEvent);
|
||||
|
||||
dispatchEvent(view.rootNodes[0], 'domEvent');
|
||||
|
||||
@@ -592,22 +592,22 @@ export function main() {
|
||||
it('should support render global events', inject([TestBed, AsyncTestCompleter], (tb, async) => {
|
||||
tb.overrideView(MyComp, new View({
|
||||
template: '<div listener></div>',
|
||||
directives: [DecoratorListeningDomEvent]
|
||||
directives: [DirectiveListeningDomEvent]
|
||||
}));
|
||||
|
||||
tb.createView(MyComp, {context: ctx}).then((view) => {
|
||||
var injector = view.rawView.elementInjectors[0];
|
||||
|
||||
var listener = injector.get(DecoratorListeningDomEvent);
|
||||
var listener = injector.get(DirectiveListeningDomEvent);
|
||||
dispatchEvent(DOM.getGlobalEventTarget("window"), 'domEvent');
|
||||
expect(listener.eventType).toEqual('window_domEvent');
|
||||
|
||||
listener = injector.get(DecoratorListeningDomEvent);
|
||||
listener = injector.get(DirectiveListeningDomEvent);
|
||||
dispatchEvent(DOM.getGlobalEventTarget("document"), 'domEvent');
|
||||
expect(listener.eventType).toEqual('document_domEvent');
|
||||
|
||||
view.destroy();
|
||||
listener = injector.get(DecoratorListeningDomEvent);
|
||||
listener = injector.get(DirectiveListeningDomEvent);
|
||||
dispatchEvent(DOM.getGlobalEventTarget("body"), 'domEvent');
|
||||
expect(listener.eventType).toEqual('');
|
||||
|
||||
@@ -618,12 +618,12 @@ export function main() {
|
||||
it('should support updating host element via hostProperties', inject([TestBed, AsyncTestCompleter], (tb, async) => {
|
||||
tb.overrideView(MyComp, new View({
|
||||
template: '<div update-host-properties></div>',
|
||||
directives: [DecoratorUpdatingHostProperties]
|
||||
directives: [DirectiveUpdatingHostProperties]
|
||||
}));
|
||||
|
||||
tb.createView(MyComp, {context: ctx}).then((view) => {
|
||||
var injector = view.rawView.elementInjectors[0];
|
||||
var updateHost = injector.get(DecoratorUpdatingHostProperties);
|
||||
var updateHost = injector.get(DirectiveUpdatingHostProperties);
|
||||
|
||||
updateHost.id = "newId";
|
||||
|
||||
@@ -639,7 +639,7 @@ export function main() {
|
||||
it('should support preventing default on render events', inject([TestBed, AsyncTestCompleter], (tb, async) => {
|
||||
tb.overrideView(MyComp, new View({
|
||||
template: '<input type="checkbox" listenerprevent></input><input type="checkbox" listenernoprevent></input>',
|
||||
directives: [DecoratorListeningDomEventPrevent, DecoratorListeningDomEventNoPrevent]
|
||||
directives: [DirectiveListeningDomEventPrevent, DirectiveListeningDomEventNoPrevent]
|
||||
}));
|
||||
|
||||
tb.createView(MyComp, {context: ctx}).then((view) => {
|
||||
@@ -657,7 +657,7 @@ export function main() {
|
||||
it('should support render global events from multiple directives', inject([TestBed, AsyncTestCompleter], (tb, async) => {
|
||||
tb.overrideView(MyComp, new View({
|
||||
template: '<div *if="ctxBoolProp" listener listenerother></div>',
|
||||
directives: [If, DecoratorListeningDomEvent, DecoratorListeningDomEventOther]
|
||||
directives: [If, DirectiveListeningDomEvent, DirectiveListeningDomEventOther]
|
||||
}));
|
||||
|
||||
tb.createView(MyComp, {context: ctx}).then((view) => {
|
||||
@@ -667,8 +667,8 @@ export function main() {
|
||||
|
||||
var subview = view.rawView.viewContainers[0].views[0];
|
||||
var injector = subview.elementInjectors[0];
|
||||
var listener = injector.get(DecoratorListeningDomEvent);
|
||||
var listenerother = injector.get(DecoratorListeningDomEventOther);
|
||||
var listener = injector.get(DirectiveListeningDomEvent);
|
||||
var listenerother = injector.get(DirectiveListeningDomEventOther);
|
||||
dispatchEvent(DOM.getGlobalEventTarget("window"), 'domEvent');
|
||||
expect(listener.eventType).toEqual('window_domEvent');
|
||||
expect(listenerother.eventType).toEqual('other_domEvent');
|
||||
@@ -857,7 +857,7 @@ class SimpleImperativeViewComponent {
|
||||
}
|
||||
|
||||
|
||||
@Decorator({
|
||||
@Directive({
|
||||
selector: 'dynamic-vp'
|
||||
})
|
||||
class DynamicViewport {
|
||||
@@ -871,7 +871,7 @@ class DynamicViewport {
|
||||
}
|
||||
}
|
||||
|
||||
@Decorator({
|
||||
@Directive({
|
||||
selector: '[my-dir]',
|
||||
properties: {'dirProp':'elprop'}
|
||||
})
|
||||
@@ -992,7 +992,7 @@ class ChildCompUsingService {
|
||||
}
|
||||
}
|
||||
|
||||
@Decorator({
|
||||
@Directive({
|
||||
selector: 'some-directive'
|
||||
})
|
||||
class SomeDirective { }
|
||||
@@ -1038,7 +1038,7 @@ class ChildComp2 {
|
||||
}
|
||||
}
|
||||
|
||||
@Decorator({
|
||||
@Directive({
|
||||
selector: '[some-viewport]'
|
||||
})
|
||||
class SomeViewport {
|
||||
@@ -1075,11 +1075,11 @@ class DoublePipeFactory {
|
||||
}
|
||||
}
|
||||
|
||||
@Decorator({
|
||||
@Directive({
|
||||
selector: '[emitter]',
|
||||
events: ['event']
|
||||
})
|
||||
class DecoratorEmitingEvent {
|
||||
class DirectiveEmitingEvent {
|
||||
msg: string;
|
||||
event:EventEmitter;
|
||||
|
||||
@@ -1093,13 +1093,13 @@ class DecoratorEmitingEvent {
|
||||
}
|
||||
}
|
||||
|
||||
@Decorator({
|
||||
@Directive({
|
||||
selector: '[update-host-properties]',
|
||||
hostProperties: {
|
||||
'id' : 'id'
|
||||
}
|
||||
})
|
||||
class DecoratorUpdatingHostProperties {
|
||||
class DirectiveUpdatingHostProperties {
|
||||
id:string;
|
||||
|
||||
constructor() {
|
||||
@@ -1107,11 +1107,11 @@ class DecoratorUpdatingHostProperties {
|
||||
}
|
||||
}
|
||||
|
||||
@Decorator({
|
||||
@Directive({
|
||||
selector: '[listener]',
|
||||
hostListeners: {'event': 'onEvent($event)'}
|
||||
})
|
||||
class DecoratorListeningEvent {
|
||||
class DirectiveListeningEvent {
|
||||
msg: string;
|
||||
|
||||
constructor() {
|
||||
@@ -1123,7 +1123,7 @@ class DecoratorListeningEvent {
|
||||
}
|
||||
}
|
||||
|
||||
@Decorator({
|
||||
@Directive({
|
||||
selector: '[listener]',
|
||||
hostListeners: {
|
||||
'domEvent': 'onEvent($event.type)',
|
||||
@@ -1132,7 +1132,7 @@ class DecoratorListeningEvent {
|
||||
'body:domEvent': 'onBodyEvent($event.type)'
|
||||
}
|
||||
})
|
||||
class DecoratorListeningDomEvent {
|
||||
class DirectiveListeningDomEvent {
|
||||
eventType: string;
|
||||
constructor() {
|
||||
this.eventType = '';
|
||||
@@ -1152,13 +1152,13 @@ class DecoratorListeningDomEvent {
|
||||
}
|
||||
|
||||
var globalCounter = 0;
|
||||
@Decorator({
|
||||
@Directive({
|
||||
selector: '[listenerother]',
|
||||
hostListeners: {
|
||||
'window:domEvent': 'onEvent($event.type)'
|
||||
}
|
||||
})
|
||||
class DecoratorListeningDomEventOther {
|
||||
class DirectiveListeningDomEventOther {
|
||||
eventType: string;
|
||||
counter: int;
|
||||
constructor() {
|
||||
@@ -1170,31 +1170,31 @@ class DecoratorListeningDomEventOther {
|
||||
}
|
||||
}
|
||||
|
||||
@Decorator({
|
||||
@Directive({
|
||||
selector: '[listenerprevent]',
|
||||
hostListeners: {
|
||||
'click': 'onEvent($event)'
|
||||
}
|
||||
})
|
||||
class DecoratorListeningDomEventPrevent {
|
||||
class DirectiveListeningDomEventPrevent {
|
||||
onEvent(event) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Decorator({
|
||||
@Directive({
|
||||
selector: '[listenernoprevent]',
|
||||
hostListeners: {
|
||||
'click': 'onEvent($event)'
|
||||
}
|
||||
})
|
||||
class DecoratorListeningDomEventNoPrevent {
|
||||
class DirectiveListeningDomEventNoPrevent {
|
||||
onEvent(event) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@Decorator({
|
||||
@Directive({
|
||||
selector: '[id]',
|
||||
properties: {'id': 'id'}
|
||||
})
|
||||
@@ -1202,7 +1202,7 @@ class IdDir {
|
||||
id: string;
|
||||
}
|
||||
|
||||
@Decorator({
|
||||
@Directive({
|
||||
selector: '[static]'
|
||||
})
|
||||
class NeedsAttribute {
|
||||
@@ -1216,19 +1216,19 @@ class NeedsAttribute {
|
||||
}
|
||||
}
|
||||
|
||||
@Decorator({
|
||||
@Directive({
|
||||
selector: '[public-api]'
|
||||
})
|
||||
class PublicApi {
|
||||
}
|
||||
|
||||
@Decorator({
|
||||
@Directive({
|
||||
selector: '[private-impl]'
|
||||
})
|
||||
class PrivateImpl extends PublicApi {
|
||||
}
|
||||
|
||||
@Decorator({
|
||||
@Directive({
|
||||
selector: '[needs-public-api]'
|
||||
})
|
||||
class NeedsPublicApi {
|
||||
|
||||
@@ -19,7 +19,7 @@ import {Query} from 'angular2/src/core/annotations_impl/di';
|
||||
|
||||
import {If, For} from 'angular2/angular2';
|
||||
|
||||
import {Component, Decorator} from 'angular2/src/core/annotations_impl/annotations';
|
||||
import {Component, Directive} from 'angular2/src/core/annotations_impl/annotations';
|
||||
import {View} from 'angular2/src/core/annotations_impl/view';
|
||||
|
||||
import {BrowserDomAdapter} from 'angular2/src/dom/browser_adapter';
|
||||
@@ -100,7 +100,7 @@ class NeedsQuery {
|
||||
|
||||
var _constructiontext = 0;
|
||||
|
||||
@Decorator({
|
||||
@Directive({
|
||||
selector: '[text]',
|
||||
properties: {
|
||||
'text': 'text'
|
||||
|
||||
+4
-4
@@ -12,7 +12,7 @@ import {
|
||||
} from 'angular2/test_lib';
|
||||
import {DOM} from 'angular2/src/dom/dom_adapter';
|
||||
|
||||
import {Decorator, Component} from 'angular2/src/core/annotations_impl/annotations';
|
||||
import {Directive, Component} from 'angular2/src/core/annotations_impl/annotations';
|
||||
import {View} from 'angular2/src/core/annotations_impl/view';
|
||||
|
||||
import {ElementRef} from 'angular2/src/core/compiler/element_ref';
|
||||
@@ -55,7 +55,7 @@ export function main() {
|
||||
}
|
||||
|
||||
@Component({selector: 'test-cmp'})
|
||||
@View({directives: [NonBindable, TestDecorator]})
|
||||
@View({directives: [NonBindable, TestDirective]})
|
||||
class TestComponent {
|
||||
text: string;
|
||||
constructor() {
|
||||
@@ -63,10 +63,10 @@ class TestComponent {
|
||||
}
|
||||
}
|
||||
|
||||
@Decorator({
|
||||
@Directive({
|
||||
selector: '[test-dec]'
|
||||
})
|
||||
class TestDecorator {
|
||||
class TestDirective {
|
||||
constructor(el: ElementRef) {
|
||||
DOM.addClass(el.domElement, 'compiled');
|
||||
}
|
||||
|
||||
+2
-2
@@ -16,7 +16,7 @@ import {DOM} from 'angular2/src/dom/dom_adapter';
|
||||
|
||||
import {Inject} from 'angular2/di';
|
||||
|
||||
import {Component, Decorator} from 'angular2/src/core/annotations_impl/annotations';
|
||||
import {Component, Directive} from 'angular2/src/core/annotations_impl/annotations';
|
||||
import {View} from 'angular2/src/core/annotations_impl/view';
|
||||
|
||||
import {TestBed} from 'angular2/src/test_lib/test_bed';
|
||||
@@ -387,7 +387,7 @@ class MyComp {
|
||||
}
|
||||
}
|
||||
|
||||
@Decorator({
|
||||
@Directive({
|
||||
selector:'[wrapped-value]',
|
||||
hostListeners: {
|
||||
'change' : 'handleOnChange($event.target.value)'
|
||||
|
||||
@@ -17,13 +17,13 @@ export function main() {
|
||||
annotatedDirectives = [
|
||||
someComponent,
|
||||
someComponent2,
|
||||
someDecorator,
|
||||
someDecoratorIgnoringChildren,
|
||||
someDirective,
|
||||
someDirectiveIgnoringChildren,
|
||||
decoratorWithMultipleAttrs,
|
||||
someDecoratorWithProps,
|
||||
someDecoratorWithHostProperties,
|
||||
someDecoratorWithEvents,
|
||||
someDecoratorWithGlobalEvents
|
||||
someDirectiveWithProps,
|
||||
someDirectiveWithHostProperties,
|
||||
someDirectiveWithEvents,
|
||||
someDirectiveWithGlobalEvents
|
||||
];
|
||||
parser = new Parser(new Lexer());
|
||||
});
|
||||
@@ -56,7 +56,7 @@ export function main() {
|
||||
it('should detect directives in attributes', () => {
|
||||
var results = process(el('<div some-decor></div>'));
|
||||
expect(results[0].directives[0].directiveIndex).toBe(
|
||||
annotatedDirectives.indexOf(someDecorator)
|
||||
annotatedDirectives.indexOf(someDirective)
|
||||
);
|
||||
});
|
||||
|
||||
@@ -208,25 +208,25 @@ var someComponent2 = new DirectiveMetadata({
|
||||
type: DirectiveMetadata.COMPONENT_TYPE
|
||||
});
|
||||
|
||||
var someDecorator = new DirectiveMetadata({
|
||||
var someDirective = new DirectiveMetadata({
|
||||
selector: '[some-decor]',
|
||||
type: DirectiveMetadata.DECORATOR_TYPE
|
||||
type: DirectiveMetadata.DIRECTIVE_TYPE
|
||||
});
|
||||
|
||||
var someDecoratorIgnoringChildren = new DirectiveMetadata({
|
||||
var someDirectiveIgnoringChildren = new DirectiveMetadata({
|
||||
selector: '[some-decor-ignoring-children]',
|
||||
compileChildren: false,
|
||||
type: DirectiveMetadata.DECORATOR_TYPE
|
||||
type: DirectiveMetadata.DIRECTIVE_TYPE
|
||||
|
||||
});
|
||||
|
||||
var decoratorWithMultipleAttrs = new DirectiveMetadata({
|
||||
selector: 'input[type=text][control]',
|
||||
id: 'decoratorWithMultipleAttrs',
|
||||
type: DirectiveMetadata.DECORATOR_TYPE
|
||||
type: DirectiveMetadata.DIRECTIVE_TYPE
|
||||
});
|
||||
|
||||
var someDecoratorWithProps = new DirectiveMetadata({
|
||||
var someDirectiveWithProps = new DirectiveMetadata({
|
||||
selector: '[some-decor-props]',
|
||||
properties: MapWrapper.createFromStringMap({
|
||||
'dirProp': 'elProp',
|
||||
@@ -235,21 +235,21 @@ var someDecoratorWithProps = new DirectiveMetadata({
|
||||
readAttributes: ['some-attr']
|
||||
});
|
||||
|
||||
var someDecoratorWithHostProperties = new DirectiveMetadata({
|
||||
var someDirectiveWithHostProperties = new DirectiveMetadata({
|
||||
selector: '[some-decor-with-host-props]',
|
||||
hostProperties: MapWrapper.createFromStringMap({
|
||||
'dirProp': 'hostProperty'
|
||||
})
|
||||
});
|
||||
|
||||
var someDecoratorWithEvents = new DirectiveMetadata({
|
||||
var someDirectiveWithEvents = new DirectiveMetadata({
|
||||
selector: '[some-decor-events]',
|
||||
hostListeners: MapWrapper.createFromStringMap({
|
||||
'click': 'doIt()'
|
||||
})
|
||||
});
|
||||
|
||||
var someDecoratorWithGlobalEvents = new DirectiveMetadata({
|
||||
var someDirectiveWithGlobalEvents = new DirectiveMetadata({
|
||||
selector: '[some-decor-globalevents]',
|
||||
hostListeners: MapWrapper.createFromStringMap({
|
||||
'window:resize': 'doItGlobal()'
|
||||
|
||||
+2
-2
@@ -43,7 +43,7 @@ export function main() {
|
||||
['properties', MapWrapper.createFromPairs([['propKey', 'propVal']])],
|
||||
['readAttributes', ['readTest1', 'readTest2']],
|
||||
['selector', 'testSelector'],
|
||||
['type', DirectiveMetadata.DECORATOR_TYPE]
|
||||
['type', DirectiveMetadata.DIRECTIVE_TYPE]
|
||||
]);
|
||||
var meta = directiveMetadataFromMap(map);
|
||||
expect(meta.compileChildren).toEqual(false);
|
||||
@@ -56,7 +56,7 @@ export function main() {
|
||||
MapWrapper.createFromPairs([['propKey', 'propVal']]));
|
||||
expect(meta.readAttributes).toEqual(['readTest1', 'readTest2']);
|
||||
expect(meta.selector).toEqual('testSelector');
|
||||
expect(meta.type).toEqual(DirectiveMetadata.DECORATOR_TYPE);
|
||||
expect(meta.type).toEqual(DirectiveMetadata.DIRECTIVE_TYPE);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -405,7 +405,7 @@ var multipleContentTagsComponent = new DirectiveMetadata({
|
||||
var manualViewportDirective = new DirectiveMetadata({
|
||||
selector: '[manual]',
|
||||
id: 'manual',
|
||||
type: DirectiveMetadata.DECORATOR_TYPE
|
||||
type: DirectiveMetadata.DIRECTIVE_TYPE
|
||||
});
|
||||
|
||||
var outerWithIndirectNestedComponent = new DirectiveMetadata({
|
||||
@@ -441,7 +441,7 @@ var conditionalContentComponent = new DirectiveMetadata({
|
||||
var autoViewportDirective = new DirectiveMetadata({
|
||||
selector: '[auto]',
|
||||
id: '[auto]',
|
||||
type: DirectiveMetadata.DECORATOR_TYPE
|
||||
type: DirectiveMetadata.DIRECTIVE_TYPE
|
||||
});
|
||||
|
||||
var tabGroupComponent = new DirectiveMetadata({
|
||||
|
||||
@@ -12,7 +12,7 @@ void initReflector(reflector) {
|
||||
'factory': () => new ToolTip(),
|
||||
'parameters': const [],
|
||||
'annotations': const [
|
||||
const Decorator(
|
||||
const Directive(
|
||||
selector: '[tool-tip]', properties: const {'text': 'tool-tip'})
|
||||
]
|
||||
});
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@ void initReflector(reflector) {
|
||||
'factory': () => new ToolTip(),
|
||||
'parameters': const [],
|
||||
'annotations': const [
|
||||
const Decorator(
|
||||
const Directive(
|
||||
selector: '[tool-tip]', properties: const {'text': 'tool-tip'})
|
||||
]
|
||||
})
|
||||
|
||||
+1
-1
@@ -11,6 +11,6 @@ void initReflector(reflector) {
|
||||
..registerType(HelloCmp, {
|
||||
'factory': () => new HelloCmp(),
|
||||
'parameters': const [const []],
|
||||
'annotations': const [const Decorator(compileChildren: true)]
|
||||
'annotations': const [const Directive(compileChildren: true)]
|
||||
});
|
||||
}
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@ library examples.hello_world.index_common_dart.ng_deps.dart;
|
||||
|
||||
import 'hello.dart';
|
||||
import 'package:angular2/angular2.dart'
|
||||
show bootstrap, Component, Decorator, View, NgElement;
|
||||
show bootstrap, Component, Directive, View, NgElement;
|
||||
|
||||
var _visited = false;
|
||||
void initReflector(reflector) {
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@ library examples.hello_world.index_common_dart.ng_deps.dart;
|
||||
|
||||
import 'hello.dart';
|
||||
import 'package:angular2/angular2.dart'
|
||||
show bootstrap, Component, Decorator, View, NgElement;
|
||||
show bootstrap, Component, Directive, View, NgElement;
|
||||
|
||||
var _visited = false;
|
||||
void initReflector(reflector) {
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@ library examples.hello_world.index_common_dart.ng_deps.dart;
|
||||
|
||||
import 'hello.dart';
|
||||
import 'package:angular2/angular2.dart'
|
||||
show bootstrap, Component, Decorator, View, NgElement;
|
||||
show bootstrap, Component, Directive, View, NgElement;
|
||||
|
||||
var _visited = false;
|
||||
void initReflector(reflector) {
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@ library examples.hello_world.index_common_dart.ng_deps.dart;
|
||||
|
||||
import 'hello.dart';
|
||||
import 'package:angular2/angular2.dart'
|
||||
show bootstrap, Component, Decorator, View, NgElement;
|
||||
show bootstrap, Component, Directive, View, NgElement;
|
||||
|
||||
var _visited = false;
|
||||
void initReflector(reflector) {
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@ library examples.hello_world.index_common_dart.ng_deps.dart;
|
||||
|
||||
import 'hello.dart';
|
||||
import 'package:angular2/angular2.dart'
|
||||
show bootstrap, Component, Decorator, View, NgElement;
|
||||
show bootstrap, Component, Directive, View, NgElement;
|
||||
|
||||
var _visited = false;
|
||||
void initReflector(reflector) {
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@ library examples.hello_world.index_common_dart.ng_deps.dart;
|
||||
|
||||
import 'hello.dart';
|
||||
import 'package:angular2/angular2.dart'
|
||||
show bootstrap, Component, Decorator, View, NgElement;
|
||||
show bootstrap, Component, Directive, View, NgElement;
|
||||
|
||||
var _visited = false;
|
||||
void initReflector(reflector) {
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@ library examples.hello_world.index_common_dart.ng_deps.dart;
|
||||
|
||||
import 'hello.dart';
|
||||
import 'package:angular2/angular2.dart'
|
||||
show bootstrap, Component, Decorator, View, NgElement;
|
||||
show bootstrap, Component, Directive, View, NgElement;
|
||||
|
||||
var _visited = false;
|
||||
void initReflector(reflector) {
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@ library examples.hello_world.index_common_dart.ng_deps.dart;
|
||||
|
||||
import 'hello.dart';
|
||||
import 'package:angular2/angular2.dart'
|
||||
show bootstrap, Component, Decorator, View, NgElement;
|
||||
show bootstrap, Component, Directive, View, NgElement;
|
||||
|
||||
var _visited = false;
|
||||
void initReflector(reflector) {
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@ library examples.hello_world.index_common_dart.ng_deps.dart;
|
||||
|
||||
import 'hello.dart';
|
||||
import 'package:angular2/angular2.dart'
|
||||
show bootstrap, Component, Decorator, View, NgElement;
|
||||
show bootstrap, Component, Directive, View, NgElement;
|
||||
|
||||
var _visited = false;
|
||||
void initReflector(reflector) {
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@ library examples.hello_world.index_common_dart.ng_deps.dart;
|
||||
|
||||
import 'hello.dart';
|
||||
import 'package:angular2/angular2.dart'
|
||||
show bootstrap, Component, Decorator, View, NgElement;
|
||||
show bootstrap, Component, Directive, View, NgElement;
|
||||
|
||||
var _visited = false;
|
||||
void initReflector(reflector) {
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@ library examples.src.hello_world.index_common_dart;
|
||||
|
||||
import 'hello.dart';
|
||||
import 'package:angular2/angular2.dart'
|
||||
show bootstrap, Component, Decorator, View, NgElement;
|
||||
show bootstrap, Component, Directive, View, NgElement;
|
||||
|
||||
var _visited = false;
|
||||
void initReflector(reflector) {
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@ library examples.src.hello_world.index_common_dart;
|
||||
|
||||
import 'hello.dart';
|
||||
import 'package:angular2/angular2.dart'
|
||||
show bootstrap, Component, Decorator, View, NgElement;
|
||||
show bootstrap, Component, Directive, View, NgElement;
|
||||
|
||||
var _visited = false;
|
||||
void initReflector(reflector) {
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@ library examples.src.hello_world.index_common_dart;
|
||||
|
||||
import 'hello.dart';
|
||||
import 'package:angular2/angular2.dart'
|
||||
show bootstrap, Component, Decorator, View, NgElement;
|
||||
show bootstrap, Component, Directive, View, NgElement;
|
||||
|
||||
var _visited = false;
|
||||
void initReflector(reflector) {
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@ library examples.src.hello_world.index_common_dart;
|
||||
|
||||
import 'hello.dart';
|
||||
import 'package:angular2/angular2.dart'
|
||||
show bootstrap, Component, Decorator, View, NgElement;
|
||||
show bootstrap, Component, Directive, View, NgElement;
|
||||
|
||||
var _visited = false;
|
||||
void initReflector(reflector) {
|
||||
|
||||
Reference in New Issue
Block a user