refactor(compiler): remove Viewport directives, use Decorator instead
BREAKING_CHANGE: - The special type of `Viewport` directives is removed in favor of a more general `Decorator` directive - `ViewContainerRef` now no more has a default `ProtoViewRef` but requires an explicit one when creating views. Closes #1536
This commit is contained in:
@@ -17,8 +17,6 @@ export function main() {
|
||||
annotatedDirectives = [
|
||||
someComponent,
|
||||
someComponent2,
|
||||
someViewport,
|
||||
someViewport2,
|
||||
someDecorator,
|
||||
someDecoratorIgnoringChildren,
|
||||
decoratorWithMultipleAttrs,
|
||||
@@ -153,27 +151,6 @@ export function main() {
|
||||
expect(eventBinding.source.source).toEqual('doItGlobal()');
|
||||
});
|
||||
|
||||
//TODO: assertions should be enabled when running tests: https://github.com/angular/angular/issues/1340
|
||||
describe('viewport directives', () => {
|
||||
it('should not allow multiple viewport directives on the same element', () => {
|
||||
expect( () => {
|
||||
process(
|
||||
el('<template some-vp some-vp2></template>')
|
||||
);
|
||||
}).toThrowError('Only one viewport directive is allowed per element - check '
|
||||
+ (assertionsEnabled() ? '<template some-vp some-vp2>' : 'null'));
|
||||
});
|
||||
|
||||
it('should not allow viewport directives on non <template> elements', () => {
|
||||
expect( () => {
|
||||
process(
|
||||
el('<div some-vp></div>')
|
||||
);
|
||||
}).toThrowError('Viewport directives need to be placed on <template> elements or elements with template attribute - check '
|
||||
+ (assertionsEnabled() ? '<div some-vp>' : 'null'));
|
||||
});
|
||||
});
|
||||
|
||||
//TODO: assertions should be enabled when running tests: https://github.com/angular/angular/issues/1340
|
||||
describe('component directives', () => {
|
||||
it('should save the component id', () => {
|
||||
@@ -231,18 +208,6 @@ var someComponent2 = new DirectiveMetadata({
|
||||
type: DirectiveMetadata.COMPONENT_TYPE
|
||||
});
|
||||
|
||||
var someViewport = new DirectiveMetadata({
|
||||
selector: '[some-vp]',
|
||||
id: 'someViewport',
|
||||
type: DirectiveMetadata.VIEWPORT_TYPE
|
||||
});
|
||||
|
||||
var someViewport2 = new DirectiveMetadata({
|
||||
selector: '[some-vp2]',
|
||||
id: 'someViewport2',
|
||||
type: DirectiveMetadata.VIEWPORT_TYPE
|
||||
});
|
||||
|
||||
var someDecorator = new DirectiveMetadata({
|
||||
selector: '[some-decor]',
|
||||
type: DirectiveMetadata.DECORATOR_TYPE
|
||||
|
||||
+2
-2
@@ -43,7 +43,7 @@ export function main() {
|
||||
['properties', MapWrapper.createFromPairs([['propKey', 'propVal']])],
|
||||
['readAttributes', ['readTest1', 'readTest2']],
|
||||
['selector', 'testSelector'],
|
||||
['type', DirectiveMetadata.VIEWPORT_TYPE]
|
||||
['type', DirectiveMetadata.DECORATOR_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.VIEWPORT_TYPE);
|
||||
expect(meta.type).toEqual(DirectiveMetadata.DECORATOR_TYPE);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -405,7 +405,7 @@ var multipleContentTagsComponent = new DirectiveMetadata({
|
||||
var manualViewportDirective = new DirectiveMetadata({
|
||||
selector: '[manual]',
|
||||
id: 'manual',
|
||||
type: DirectiveMetadata.VIEWPORT_TYPE
|
||||
type: DirectiveMetadata.DECORATOR_TYPE
|
||||
});
|
||||
|
||||
var outerWithIndirectNestedComponent = new DirectiveMetadata({
|
||||
@@ -441,7 +441,7 @@ var conditionalContentComponent = new DirectiveMetadata({
|
||||
var autoViewportDirective = new DirectiveMetadata({
|
||||
selector: '[auto]',
|
||||
id: '[auto]',
|
||||
type: DirectiveMetadata.VIEWPORT_TYPE
|
||||
type: DirectiveMetadata.DECORATOR_TYPE
|
||||
});
|
||||
|
||||
var tabGroupComponent = new DirectiveMetadata({
|
||||
|
||||
Reference in New Issue
Block a user