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);
expectEmit(result.source, template,
'Incorrect handling of local refs for host element');
expectEmit(result.source, template, 'Incorrect handling of local refs for host element');
});
it('should not have local refs for nested elements', () => {
@ -196,8 +195,7 @@ describe('compiler compliance: bindings', () => {
}
`;
const result = compile(files, angularFiles);
expectEmit(result.source, template,
'Incorrect handling of local refs for nested elements');
expectEmit(result.source, template, '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 setBindingsDisabled: o.ExternalReference = {name: 'ɵsetBindingsDisabled', moduleName: CORE};
static setBindingsDisabled:
o.ExternalReference = {name: 'ɵsetBindingsDisabled', 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 {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 {
switch (type) {
@ -662,8 +662,7 @@ export class TemplateDefinitionBuilder implements t.Visitor<void>, LocalResolver
// Finish element construction mode.
if (isNonBindableMode) {
this.creationInstruction(
element.endSourceSpan || element.sourceSpan,
R3.setBindingsEnabled);
element.endSourceSpan || element.sourceSpan, R3.setBindingsEnabled);
}
this.creationInstruction(
element.endSourceSpan || element.sourceSpan,

View File

@ -7,7 +7,7 @@
*/
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 {AttributeMarker, defineComponent, defineDirective} from '../../src/render3/index';
@ -144,17 +144,17 @@ describe('render3 integration test', () => {
const App = createComponent('app', function(rf: RenderFlags, ctx: any) {
if (rf & RenderFlags.Create) {
elementStart(0, 'b', ['id', 'my-id'], ['myRef', '']);
setBindingsDisabled();
elementStart(2, 'i');
text(3, 'Hello {{ name }}!');
elementEnd();
setBindingsEnabled();
setBindingsDisabled();
elementStart(2, 'i');
text(3, 'Hello {{ name }}!');
elementEnd();
setBindingsEnabled();
elementEnd();
text(4);
}
if (rf & RenderFlags.Update) {
const ref = reference(1) as any;
textBinding(4, interpolation1(" ", ref.id, " "));
textBinding(4, interpolation1(' ', ref.id, ' '));
}
}, 5, 1);
@ -171,10 +171,10 @@ describe('render3 integration test', () => {
const App = createComponent('app', function(rf: RenderFlags, ctx: any) {
if (rf & RenderFlags.Create) {
elementStart(0, 'div');
setBindingsDisabled();
element(1, 'input', ['value', 'one']);
text(2, '{{ myInput.value }}');
setBindingsEnabled();
setBindingsDisabled();
element(1, 'input', ['value', 'one']);
text(2, '{{ myInput.value }}');
setBindingsEnabled();
elementEnd();
}
}, 3, 0);
@ -187,9 +187,7 @@ describe('render3 integration test', () => {
let directiveInvoked: boolean = false;
class TestDirective {
ngOnInit() {
directiveInvoked = true;
}
ngOnInit() { directiveInvoked = true; }
static ngDirectiveDef = defineDirective({
type: TestDirective,
@ -206,11 +204,11 @@ describe('render3 integration test', () => {
const App = createComponent('app', function(rf: RenderFlags, ctx: any) {
if (rf & RenderFlags.Create) {
elementStart(0, 'b', ['directive', '']);
setBindingsDisabled();
elementStart(1, 'i');
text(2, 'Hello {{ name }}!');
elementEnd();
setBindingsEnabled();
setBindingsDisabled();
elementStart(1, 'i');
text(2, 'Hello {{ name }}!');
elementEnd();
setBindingsEnabled();
elementEnd();
}
}, 3, 0, [TestDirective]);
@ -224,9 +222,7 @@ describe('render3 integration test', () => {
let directiveInvoked: boolean = false;
class TestDirective {
ngOnInit() {
directiveInvoked = true;
}
ngOnInit() { directiveInvoked = true; }
static ngDirectiveDef = defineDirective({
type: TestDirective,
@ -243,11 +239,11 @@ describe('render3 integration test', () => {
const App = createComponent('app', function(rf: RenderFlags, ctx: any) {
if (rf & RenderFlags.Create) {
elementStart(0, 'b');
setBindingsDisabled();
elementStart(1, 'i', ['directive', '']);
text(2, 'Hello {{ name }}!');
elementEnd();
setBindingsEnabled();
setBindingsDisabled();
elementStart(1, 'i', ['directive', '']);
text(2, 'Hello {{ name }}!');
elementEnd();
setBindingsEnabled();
elementEnd();
}
}, 3, 0, [TestDirective]);