fixup! feat(ivy): adding support for ngNonBindable attribute

This commit is contained in:
Andrew Kushnir 2018-09-26 14:33:48 -07:00 committed by Alex Rickabaugh
parent c683f74225
commit d7326d81ba
4 changed files with 29 additions and 35 deletions

View File

@ -171,8 +171,7 @@ describe('compiler compliance: bindings', () => {
} }
`; `;
const result = compile(files, angularFiles); const result = compile(files, angularFiles);
expectEmit(result.source, template, expectEmit(result.source, template, 'Incorrect handling of local refs for host element');
'Incorrect handling of local refs for host element');
}); });
it('should not have local refs for nested elements', () => { it('should not have local refs for nested elements', () => {
@ -196,8 +195,7 @@ describe('compiler compliance: bindings', () => {
} }
`; `;
const result = compile(files, angularFiles); const result = compile(files, angularFiles);
expectEmit(result.source, template, expectEmit(result.source, template, 'Incorrect handling of local refs for nested elements');
'Incorrect handling of local refs for nested elements');
}); });
}); });

View File

@ -62,7 +62,8 @@ export class Identifiers {
static setBindingsEnabled: o.ExternalReference = {name: 'ɵsetBindingsEnabled', moduleName: CORE}; static setBindingsEnabled: o.ExternalReference = {name: 'ɵsetBindingsEnabled', moduleName: CORE};
static setBindingsDisabled: o.ExternalReference = {name: 'ɵsetBindingsDisabled', moduleName: CORE}; static setBindingsDisabled:
o.ExternalReference = {name: 'ɵsetBindingsDisabled', moduleName: CORE};
static getCurrentView: o.ExternalReference = {name: 'ɵgetCurrentView', moduleName: CORE}; static getCurrentView: o.ExternalReference = {name: 'ɵgetCurrentView', moduleName: CORE};

View File

@ -30,7 +30,7 @@ import {htmlAstToRender3Ast} from '../r3_template_transform';
import {R3QueryMetadata} from './api'; import {R3QueryMetadata} from './api';
import {parseStyle} from './styling'; import {parseStyle} from './styling';
import {CONTEXT_NAME, NON_BINDABLE_ATTR, I18N_ATTR, I18N_ATTR_PREFIX, ID_SEPARATOR, IMPLICIT_REFERENCE, MEANING_SEPARATOR, REFERENCE_PREFIX, RENDER_FLAGS, asLiteral, invalid, isI18NAttribute, mapToExpression, trimTrailingNulls, unsupported} from './util'; import {CONTEXT_NAME, I18N_ATTR, I18N_ATTR_PREFIX, ID_SEPARATOR, IMPLICIT_REFERENCE, MEANING_SEPARATOR, NON_BINDABLE_ATTR, REFERENCE_PREFIX, RENDER_FLAGS, asLiteral, invalid, isI18NAttribute, mapToExpression, trimTrailingNulls, unsupported} from './util';
function mapBindingToInstruction(type: BindingType): o.ExternalReference|undefined { function mapBindingToInstruction(type: BindingType): o.ExternalReference|undefined {
switch (type) { switch (type) {
@ -662,8 +662,7 @@ export class TemplateDefinitionBuilder implements t.Visitor<void>, LocalResolver
// Finish element construction mode. // Finish element construction mode.
if (isNonBindableMode) { if (isNonBindableMode) {
this.creationInstruction( this.creationInstruction(
element.endSourceSpan || element.sourceSpan, element.endSourceSpan || element.sourceSpan, R3.setBindingsEnabled);
R3.setBindingsEnabled);
} }
this.creationInstruction( this.creationInstruction(
element.endSourceSpan || element.sourceSpan, element.endSourceSpan || element.sourceSpan,

View File

@ -7,7 +7,7 @@
*/ */
import {ElementRef, TemplateRef, ViewContainerRef} from '@angular/core'; import {ElementRef, TemplateRef, ViewContainerRef} from '@angular/core';
import {reference, RenderFlags} from '@angular/core/src/render3'; import {RenderFlags, reference} from '@angular/core/src/render3';
import {RendererStyleFlags2, RendererType2} from '../../src/render/api'; import {RendererStyleFlags2, RendererType2} from '../../src/render/api';
import {AttributeMarker, defineComponent, defineDirective} from '../../src/render3/index'; import {AttributeMarker, defineComponent, defineDirective} from '../../src/render3/index';
@ -154,7 +154,7 @@ describe('render3 integration test', () => {
} }
if (rf & RenderFlags.Update) { if (rf & RenderFlags.Update) {
const ref = reference(1) as any; const ref = reference(1) as any;
textBinding(4, interpolation1(" ", ref.id, " ")); textBinding(4, interpolation1(' ', ref.id, ' '));
} }
}, 5, 1); }, 5, 1);
@ -187,9 +187,7 @@ describe('render3 integration test', () => {
let directiveInvoked: boolean = false; let directiveInvoked: boolean = false;
class TestDirective { class TestDirective {
ngOnInit() { ngOnInit() { directiveInvoked = true; }
directiveInvoked = true;
}
static ngDirectiveDef = defineDirective({ static ngDirectiveDef = defineDirective({
type: TestDirective, type: TestDirective,
@ -224,9 +222,7 @@ describe('render3 integration test', () => {
let directiveInvoked: boolean = false; let directiveInvoked: boolean = false;
class TestDirective { class TestDirective {
ngOnInit() { ngOnInit() { directiveInvoked = true; }
directiveInvoked = true;
}
static ngDirectiveDef = defineDirective({ static ngDirectiveDef = defineDirective({
type: TestDirective, type: TestDirective,