diff --git a/packages/compiler-cli/test/compliance/r3_view_compiler_binding_spec.ts b/packages/compiler-cli/test/compliance/r3_view_compiler_binding_spec.ts index bd7c47f1c7..c1368a8ae7 100644 --- a/packages/compiler-cli/test/compliance/r3_view_compiler_binding_spec.ts +++ b/packages/compiler-cli/test/compliance/r3_view_compiler_binding_spec.ts @@ -218,8 +218,25 @@ 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 property bindings and listeners'); }); + + it('should not generate extra instructions for elements with no children', () => { + const files: MockDirectory = getAppFiles(` +
+ `); + + const template = ` + template:function MyComponent_Template(rf, $ctx$){ + if (rf & 1) { + $i0$.ɵelement(0, "div"); + } + } + `; + const result = compile(files, angularFiles); + expectEmit(result.source, template, 'Incorrect handling of elements with no children'); + }); + }); }); diff --git a/packages/core/test/render3/integration_spec.ts b/packages/core/test/render3/integration_spec.ts index da08bab78c..521c99b4a8 100644 --- a/packages/core/test/render3/integration_spec.ts +++ b/packages/core/test/render3/integration_spec.ts @@ -7,13 +7,12 @@ */ import {ElementRef, TemplateRef, ViewContainerRef} from '@angular/core'; -import {RenderFlags} from '@angular/core/src/render3'; import {RendererStyleFlags2, RendererType2} from '../../src/render/api'; import {AttributeMarker, defineComponent, defineDirective} from '../../src/render3/index'; import {NO_CHANGE, bind, container, containerRefreshEnd, containerRefreshStart, element, elementAttribute, elementClassProp, elementContainerEnd, elementContainerStart, elementEnd, elementProperty, elementStart, elementStyleProp, elementStyling, elementStylingApply, embeddedViewEnd, embeddedViewStart, setBindingsEnabled, setBindingsDisabled, interpolation1, interpolation2, interpolation3, interpolation4, interpolation5, interpolation6, interpolation7, interpolation8, interpolationV, listener, load, loadDirective, projection, projectionDef, reference, text, textBinding, template} from '../../src/render3/instructions'; -import {InitialStylingFlags} from '../../src/render3/interfaces/definition'; +import {InitialStylingFlags, RenderFlags} from '../../src/render3/interfaces/definition'; import {RElement, Renderer3, RendererFactory3, domRendererFactory3, RText, RComment, RNode, RendererStyleFlags3, ProceduralRenderer3} from '../../src/render3/interfaces/renderer'; import {HEADER_OFFSET, CONTEXT, DIRECTIVES} from '../../src/render3/interfaces/view'; import {sanitizeUrl} from '../../src/sanitization/sanitization';