diff --git a/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/elements/GOLDEN_PARTIAL.js b/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/elements/GOLDEN_PARTIAL.js new file mode 100644 index 0000000000..538f572463 --- /dev/null +++ b/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/elements/GOLDEN_PARTIAL.js @@ -0,0 +1,550 @@ +/**************************************************************************************************** + * PARTIAL FILE: svg.js + ****************************************************************************************************/ +import { Component, NgModule } from '@angular/core'; +import * as i0 from "@angular/core"; +export class MyComponent { +} +MyComponent.ɵfac = function MyComponent_Factory(t) { return new (t || MyComponent)(); }; +MyComponent.ɵcmp = i0.ɵɵdefineComponent({ type: MyComponent, selectors: [["my-component"]], decls: 5, vars: 0, consts: [["title", "Hello", 1, "my-app"], ["cx", "20", "cy", "30", "r", "50"]], template: function MyComponent_Template(rf, ctx) { if (rf & 1) { + i0.ɵɵelementStart(0, "div", 0); + i0.ɵɵnamespaceSVG(); + i0.ɵɵelementStart(1, "svg"); + i0.ɵɵelement(2, "circle", 1); + i0.ɵɵelementEnd(); + i0.ɵɵnamespaceHTML(); + i0.ɵɵelementStart(3, "p"); + i0.ɵɵtext(4, "test"); + i0.ɵɵelementEnd(); + i0.ɵɵelementEnd(); + } }, encapsulation: 2 }); +/*@__PURE__*/ (function () { i0.ɵsetClassMetadata(MyComponent, [{ + type: Component, + args: [{ + selector: 'my-component', + template: '

test

' + }] + }], null, null); })(); +export class MyModule { +} +MyModule.ɵmod = i0.ɵɵdefineNgModule({ type: MyModule }); +MyModule.ɵinj = i0.ɵɵdefineInjector({ factory: function MyModule_Factory(t) { return new (t || MyModule)(); } }); +(function () { (typeof ngJitMode === "undefined" || ngJitMode) && i0.ɵɵsetNgModuleScope(MyModule, { declarations: [MyComponent] }); })(); +/*@__PURE__*/ (function () { i0.ɵsetClassMetadata(MyModule, [{ + type: NgModule, + args: [{ declarations: [MyComponent] }] + }], null, null); })(); + +/**************************************************************************************************** + * PARTIAL FILE: svg.d.ts + ****************************************************************************************************/ +import * as i0 from "@angular/core"; +export declare class MyComponent { + static ɵfac: i0.ɵɵFactoryDef; + static ɵcmp: i0.ɵɵComponentDefWithMeta; +} +export declare class MyModule { + static ɵmod: i0.ɵɵNgModuleDefWithMeta; + static ɵinj: i0.ɵɵInjectorDef; +} + +/**************************************************************************************************** + * PARTIAL FILE: mathml.js + ****************************************************************************************************/ +import { Component, NgModule } from '@angular/core'; +import * as i0 from "@angular/core"; +export class MyComponent { +} +MyComponent.ɵfac = function MyComponent_Factory(t) { return new (t || MyComponent)(); }; +MyComponent.ɵcmp = i0.ɵɵdefineComponent({ type: MyComponent, selectors: [["my-component"]], decls: 5, vars: 0, consts: [["title", "Hello", 1, "my-app"]], template: function MyComponent_Template(rf, ctx) { if (rf & 1) { + i0.ɵɵelementStart(0, "div", 0); + i0.ɵɵnamespaceMathML(); + i0.ɵɵelementStart(1, "math"); + i0.ɵɵelement(2, "infinity"); + i0.ɵɵelementEnd(); + i0.ɵɵnamespaceHTML(); + i0.ɵɵelementStart(3, "p"); + i0.ɵɵtext(4, "test"); + i0.ɵɵelementEnd(); + i0.ɵɵelementEnd(); + } }, encapsulation: 2 }); +/*@__PURE__*/ (function () { i0.ɵsetClassMetadata(MyComponent, [{ + type: Component, + args: [{ + selector: 'my-component', + template: '

test

' + }] + }], null, null); })(); +export class MyModule { +} +MyModule.ɵmod = i0.ɵɵdefineNgModule({ type: MyModule }); +MyModule.ɵinj = i0.ɵɵdefineInjector({ factory: function MyModule_Factory(t) { return new (t || MyModule)(); } }); +(function () { (typeof ngJitMode === "undefined" || ngJitMode) && i0.ɵɵsetNgModuleScope(MyModule, { declarations: [MyComponent] }); })(); +/*@__PURE__*/ (function () { i0.ɵsetClassMetadata(MyModule, [{ + type: NgModule, + args: [{ declarations: [MyComponent] }] + }], null, null); })(); + +/**************************************************************************************************** + * PARTIAL FILE: mathml.d.ts + ****************************************************************************************************/ +import * as i0 from "@angular/core"; +export declare class MyComponent { + static ɵfac: i0.ɵɵFactoryDef; + static ɵcmp: i0.ɵɵComponentDefWithMeta; +} +export declare class MyModule { + static ɵmod: i0.ɵɵNgModuleDefWithMeta; + static ɵinj: i0.ɵɵInjectorDef; +} + +/**************************************************************************************************** + * PARTIAL FILE: dom.js + ****************************************************************************************************/ +import { Component, NgModule } from '@angular/core'; +import * as i0 from "@angular/core"; +export class MyComponent { +} +MyComponent.ɵfac = function MyComponent_Factory(t) { return new (t || MyComponent)(); }; +MyComponent.ɵcmp = i0.ɵɵdefineComponent({ type: MyComponent, selectors: [["my-component"]], decls: 5, vars: 0, consts: [["title", "Hello", 1, "my-app"]], template: function MyComponent_Template(rf, ctx) { if (rf & 1) { + i0.ɵɵelementStart(0, "div", 0); + i0.ɵɵtext(1, "Hello "); + i0.ɵɵelementStart(2, "b"); + i0.ɵɵtext(3, "World"); + i0.ɵɵelementEnd(); + i0.ɵɵtext(4, "!"); + i0.ɵɵelementEnd(); + } }, encapsulation: 2 }); +/*@__PURE__*/ (function () { i0.ɵsetClassMetadata(MyComponent, [{ + type: Component, + args: [{ + selector: 'my-component', + template: '
Hello World!
' + }] + }], null, null); })(); +export class MyModule { +} +MyModule.ɵmod = i0.ɵɵdefineNgModule({ type: MyModule }); +MyModule.ɵinj = i0.ɵɵdefineInjector({ factory: function MyModule_Factory(t) { return new (t || MyModule)(); } }); +(function () { (typeof ngJitMode === "undefined" || ngJitMode) && i0.ɵɵsetNgModuleScope(MyModule, { declarations: [MyComponent] }); })(); +/*@__PURE__*/ (function () { i0.ɵsetClassMetadata(MyModule, [{ + type: NgModule, + args: [{ declarations: [MyComponent] }] + }], null, null); })(); + +/**************************************************************************************************** + * PARTIAL FILE: dom.d.ts + ****************************************************************************************************/ +import * as i0 from "@angular/core"; +export declare class MyComponent { + static ɵfac: i0.ɵɵFactoryDef; + static ɵcmp: i0.ɵɵComponentDefWithMeta; +} +export declare class MyModule { + static ɵmod: i0.ɵɵNgModuleDefWithMeta; + static ɵinj: i0.ɵɵInjectorDef; +} + +/**************************************************************************************************** + * PARTIAL FILE: namespace.js + ****************************************************************************************************/ +import { Component, NgModule } from '@angular/core'; +import * as i0 from "@angular/core"; +export class MyComponent { +} +MyComponent.ɵfac = function MyComponent_Factory(t) { return new (t || MyComponent)(); }; +MyComponent.ɵcmp = i0.ɵɵdefineComponent({ type: MyComponent, selectors: [["my-component"]], decls: 5, vars: 0, consts: [[0, "xmlns", "foo", "http://someuri/foo", 0, "foo", "bar", "baz", "title", "Hello", 0, "foo", "qux", "quacks", 1, "my-app"]], template: function MyComponent_Template(rf, ctx) { if (rf & 1) { + i0.ɵɵelementStart(0, "div", 0); + i0.ɵɵtext(1, "Hello "); + i0.ɵɵelementStart(2, "b"); + i0.ɵɵtext(3, "World"); + i0.ɵɵelementEnd(); + i0.ɵɵtext(4, "!"); + i0.ɵɵelementEnd(); + } }, encapsulation: 2 }); +/*@__PURE__*/ (function () { i0.ɵsetClassMetadata(MyComponent, [{ + type: Component, + args: [{ + selector: 'my-component', + template: '
Hello World!
' + }] + }], null, null); })(); +export class MyModule { +} +MyModule.ɵmod = i0.ɵɵdefineNgModule({ type: MyModule }); +MyModule.ɵinj = i0.ɵɵdefineInjector({ factory: function MyModule_Factory(t) { return new (t || MyModule)(); } }); +(function () { (typeof ngJitMode === "undefined" || ngJitMode) && i0.ɵɵsetNgModuleScope(MyModule, { declarations: [MyComponent] }); })(); +/*@__PURE__*/ (function () { i0.ɵsetClassMetadata(MyModule, [{ + type: NgModule, + args: [{ declarations: [MyComponent] }] + }], null, null); })(); + +/**************************************************************************************************** + * PARTIAL FILE: namespace.d.ts + ****************************************************************************************************/ +import * as i0 from "@angular/core"; +export declare class MyComponent { + static ɵfac: i0.ɵɵFactoryDef; + static ɵcmp: i0.ɵɵComponentDefWithMeta; +} +export declare class MyModule { + static ɵmod: i0.ɵɵNgModuleDefWithMeta; + static ɵinj: i0.ɵɵInjectorDef; +} + +/**************************************************************************************************** + * PARTIAL FILE: ng-container.js + ****************************************************************************************************/ +import { Component, NgModule } from '@angular/core'; +import * as i0 from "@angular/core"; +export class MyComponent { +} +MyComponent.ɵfac = function MyComponent_Factory(t) { return new (t || MyComponent)(); }; +MyComponent.ɵcmp = i0.ɵɵdefineComponent({ type: MyComponent, selectors: [["my-component"]], decls: 4, vars: 0, template: function MyComponent_Template(rf, ctx) { if (rf & 1) { + i0.ɵɵelementContainerStart(0); + i0.ɵɵelementStart(1, "span"); + i0.ɵɵtext(2, "in a "); + i0.ɵɵelementEnd(); + i0.ɵɵtext(3, "container"); + i0.ɵɵelementContainerEnd(); + } }, encapsulation: 2 }); +/*@__PURE__*/ (function () { i0.ɵsetClassMetadata(MyComponent, [{ + type: Component, + args: [{ + selector: 'my-component', + template: 'in a container' + }] + }], null, null); })(); +export class MyModule { +} +MyModule.ɵmod = i0.ɵɵdefineNgModule({ type: MyModule }); +MyModule.ɵinj = i0.ɵɵdefineInjector({ factory: function MyModule_Factory(t) { return new (t || MyModule)(); } }); +(function () { (typeof ngJitMode === "undefined" || ngJitMode) && i0.ɵɵsetNgModuleScope(MyModule, { declarations: [MyComponent] }); })(); +/*@__PURE__*/ (function () { i0.ɵsetClassMetadata(MyModule, [{ + type: NgModule, + args: [{ declarations: [MyComponent] }] + }], null, null); })(); + +/**************************************************************************************************** + * PARTIAL FILE: ng-container.d.ts + ****************************************************************************************************/ +import * as i0 from "@angular/core"; +export declare class MyComponent { + static ɵfac: i0.ɵɵFactoryDef; + static ɵcmp: i0.ɵɵComponentDefWithMeta; +} +export declare class MyModule { + static ɵmod: i0.ɵɵNgModuleDefWithMeta; + static ɵinj: i0.ɵɵInjectorDef; +} + +/**************************************************************************************************** + * PARTIAL FILE: empty_ng-container.js + ****************************************************************************************************/ +import { Component, NgModule } from '@angular/core'; +import * as i0 from "@angular/core"; +export class MyComponent { +} +MyComponent.ɵfac = function MyComponent_Factory(t) { return new (t || MyComponent)(); }; +MyComponent.ɵcmp = i0.ɵɵdefineComponent({ type: MyComponent, selectors: [["my-component"]], decls: 1, vars: 0, template: function MyComponent_Template(rf, ctx) { if (rf & 1) { + i0.ɵɵelementContainer(0); + } }, encapsulation: 2 }); +/*@__PURE__*/ (function () { i0.ɵsetClassMetadata(MyComponent, [{ + type: Component, + args: [{ selector: 'my-component', template: '' }] + }], null, null); })(); +export class MyModule { +} +MyModule.ɵmod = i0.ɵɵdefineNgModule({ type: MyModule }); +MyModule.ɵinj = i0.ɵɵdefineInjector({ factory: function MyModule_Factory(t) { return new (t || MyModule)(); } }); +(function () { (typeof ngJitMode === "undefined" || ngJitMode) && i0.ɵɵsetNgModuleScope(MyModule, { declarations: [MyComponent] }); })(); +/*@__PURE__*/ (function () { i0.ɵsetClassMetadata(MyModule, [{ + type: NgModule, + args: [{ declarations: [MyComponent] }] + }], null, null); })(); + +/**************************************************************************************************** + * PARTIAL FILE: empty_ng-container.d.ts + ****************************************************************************************************/ +import * as i0 from "@angular/core"; +export declare class MyComponent { + static ɵfac: i0.ɵɵFactoryDef; + static ɵcmp: i0.ɵɵComponentDefWithMeta; +} +export declare class MyModule { + static ɵmod: i0.ɵɵNgModuleDefWithMeta; + static ɵinj: i0.ɵɵInjectorDef; +} + +/**************************************************************************************************** + * PARTIAL FILE: properties.js + ****************************************************************************************************/ +import { Component, NgModule } from '@angular/core'; +import * as i0 from "@angular/core"; +export class MyComponent { + constructor() { + this.id = 'one'; + } +} +MyComponent.ɵfac = function MyComponent_Factory(t) { return new (t || MyComponent)(); }; +MyComponent.ɵcmp = i0.ɵɵdefineComponent({ type: MyComponent, selectors: [["my-component"]], decls: 1, vars: 1, consts: [[3, "id"]], template: function MyComponent_Template(rf, ctx) { if (rf & 1) { + i0.ɵɵelement(0, "div", 0); + } if (rf & 2) { + i0.ɵɵproperty("id", ctx.id); + } }, encapsulation: 2 }); +/*@__PURE__*/ (function () { i0.ɵsetClassMetadata(MyComponent, [{ + type: Component, + args: [{ selector: 'my-component', template: '
' }] + }], null, null); })(); +export class MyModule { +} +MyModule.ɵmod = i0.ɵɵdefineNgModule({ type: MyModule }); +MyModule.ɵinj = i0.ɵɵdefineInjector({ factory: function MyModule_Factory(t) { return new (t || MyModule)(); } }); +(function () { (typeof ngJitMode === "undefined" || ngJitMode) && i0.ɵɵsetNgModuleScope(MyModule, { declarations: [MyComponent] }); })(); +/*@__PURE__*/ (function () { i0.ɵsetClassMetadata(MyModule, [{ + type: NgModule, + args: [{ declarations: [MyComponent] }] + }], null, null); })(); + +/**************************************************************************************************** + * PARTIAL FILE: properties.d.ts + ****************************************************************************************************/ +import * as i0 from "@angular/core"; +export declare class MyComponent { + id: string; + static ɵfac: i0.ɵɵFactoryDef; + static ɵcmp: i0.ɵɵComponentDefWithMeta; +} +export declare class MyModule { + static ɵmod: i0.ɵɵNgModuleDefWithMeta; + static ɵinj: i0.ɵɵInjectorDef; +} + +/**************************************************************************************************** + * PARTIAL FILE: property_pure_functions.js + ****************************************************************************************************/ +import { Component, NgModule } from '@angular/core'; +import * as i0 from "@angular/core"; +const _c0 = function (a0) { return [a0]; }; +const _c1 = function () { return [0]; }; +export class MyComponent { + constructor() { + this.id = 'one'; + } +} +MyComponent.ɵfac = function MyComponent_Factory(t) { return new (t || MyComponent)(); }; +MyComponent.ɵcmp = i0.ɵɵdefineComponent({ type: MyComponent, selectors: [["my-component"]], decls: 2, vars: 15, consts: [[3, "ternary", "pipe", "and", "or"]], template: function MyComponent_Template(rf, ctx) { if (rf & 1) { + i0.ɵɵelement(0, "div", 0); + i0.ɵɵpipe(1, "pipe"); + } if (rf & 2) { + i0.ɵɵproperty("ternary", ctx.cond ? i0.ɵɵpureFunction1(8, _c0, ctx.a) : i0.ɵɵpureFunction0(10, _c1))("pipe", i0.ɵɵpipeBind3(1, 4, ctx.value, 1, 2))("and", ctx.cond && i0.ɵɵpureFunction1(11, _c0, ctx.b))("or", ctx.cond || i0.ɵɵpureFunction1(13, _c0, ctx.c)); + } }, encapsulation: 2 }); +/*@__PURE__*/ (function () { i0.ɵsetClassMetadata(MyComponent, [{ + type: Component, + args: [{ + selector: 'my-component', + template: `
` + }] + }], null, null); })(); +export class MyModule { +} +MyModule.ɵmod = i0.ɵɵdefineNgModule({ type: MyModule }); +MyModule.ɵinj = i0.ɵɵdefineInjector({ factory: function MyModule_Factory(t) { return new (t || MyModule)(); } }); +(function () { (typeof ngJitMode === "undefined" || ngJitMode) && i0.ɵɵsetNgModuleScope(MyModule, { declarations: [MyComponent] }); })(); +/*@__PURE__*/ (function () { i0.ɵsetClassMetadata(MyModule, [{ + type: NgModule, + args: [{ declarations: [MyComponent] }] + }], null, null); })(); + +/**************************************************************************************************** + * PARTIAL FILE: property_pure_functions.d.ts + ****************************************************************************************************/ +import * as i0 from "@angular/core"; +export declare class MyComponent { + id: string; + static ɵfac: i0.ɵɵFactoryDef; + static ɵcmp: i0.ɵɵComponentDefWithMeta; +} +export declare class MyModule { + static ɵmod: i0.ɵɵNgModuleDefWithMeta; + static ɵinj: i0.ɵɵInjectorDef; +} + +/**************************************************************************************************** + * PARTIAL FILE: host_binding_pure_functions.js + ****************************************************************************************************/ +import { Component, Input, NgModule } from '@angular/core'; +import * as i0 from "@angular/core"; +const _c0 = function (a0, a1) { return { collapsedHeight: a0, expandedHeight: a1 }; }; +const _c1 = function (a0, a1) { return { value: a0, params: a1 }; }; +const _c2 = function (a0, a1) { return { collapsedWidth: a0, expandedWidth: a1 }; }; +export class MyComponent { + getExpandedState() { + return 'expanded'; + } +} +MyComponent.ɵfac = function MyComponent_Factory(t) { return new (t || MyComponent)(); }; +MyComponent.ɵcmp = i0.ɵɵdefineComponent({ type: MyComponent, selectors: [["my-component"]], hostVars: 14, hostBindings: function MyComponent_HostBindings(rf, ctx) { if (rf & 2) { + i0.ɵɵsyntheticHostProperty("@expansionHeight", i0.ɵɵpureFunction2(5, _c1, ctx.getExpandedState(), i0.ɵɵpureFunction2(2, _c0, ctx.collapsedHeight, ctx.expandedHeight)))("@expansionWidth", i0.ɵɵpureFunction2(11, _c1, ctx.getExpandedState(), i0.ɵɵpureFunction2(8, _c2, ctx.collapsedWidth, ctx.expandedWidth))); + } }, inputs: { expandedHeight: "expandedHeight", collapsedHeight: "collapsedHeight", expandedWidth: "expandedWidth", collapsedWidth: "collapsedWidth" }, decls: 1, vars: 0, template: function MyComponent_Template(rf, ctx) { if (rf & 1) { + i0.ɵɵtext(0, "..."); + } }, encapsulation: 2 }); +/*@__PURE__*/ (function () { i0.ɵsetClassMetadata(MyComponent, [{ + type: Component, + args: [{ + selector: 'my-component', + template: '...', + host: { + '[@expansionHeight]': `{ + value: getExpandedState(), + params: { + collapsedHeight: collapsedHeight, + expandedHeight: expandedHeight + } + }`, + '[@expansionWidth]': `{ + value: getExpandedState(), + params: { + collapsedWidth: collapsedWidth, + expandedWidth: expandedWidth + } + }` + } + }] + }], null, { expandedHeight: [{ + type: Input + }], collapsedHeight: [{ + type: Input + }], expandedWidth: [{ + type: Input + }], collapsedWidth: [{ + type: Input + }] }); })(); +export class MyModule { +} +MyModule.ɵmod = i0.ɵɵdefineNgModule({ type: MyModule }); +MyModule.ɵinj = i0.ɵɵdefineInjector({ factory: function MyModule_Factory(t) { return new (t || MyModule)(); } }); +(function () { (typeof ngJitMode === "undefined" || ngJitMode) && i0.ɵɵsetNgModuleScope(MyModule, { declarations: [MyComponent] }); })(); +/*@__PURE__*/ (function () { i0.ɵsetClassMetadata(MyModule, [{ + type: NgModule, + args: [{ declarations: [MyComponent] }] + }], null, null); })(); + +/**************************************************************************************************** + * PARTIAL FILE: host_binding_pure_functions.d.ts + ****************************************************************************************************/ +import * as i0 from "@angular/core"; +export declare class MyComponent { + expandedHeight: string; + collapsedHeight: string; + expandedWidth: string; + collapsedWidth: string; + getExpandedState(): string; + static ɵfac: i0.ɵɵFactoryDef; + static ɵcmp: i0.ɵɵComponentDefWithMeta; +} +export declare class MyModule { + static ɵmod: i0.ɵɵNgModuleDefWithMeta; + static ɵinj: i0.ɵɵInjectorDef; +} + +/**************************************************************************************************** + * PARTIAL FILE: class_style_bindings.js + ****************************************************************************************************/ +import { Component, NgModule } from '@angular/core'; +import * as i0 from "@angular/core"; +export class MyComponent { + constructor() { + this.error = true; + this.color = 'red'; + } +} +MyComponent.ɵfac = function MyComponent_Factory(t) { return new (t || MyComponent)(); }; +MyComponent.ɵcmp = i0.ɵɵdefineComponent({ type: MyComponent, selectors: [["my-component"]], decls: 1, vars: 4, template: function MyComponent_Template(rf, ctx) { if (rf & 1) { + i0.ɵɵelement(0, "div"); + } if (rf & 2) { + i0.ɵɵstyleProp("background-color", ctx.color); + i0.ɵɵclassProp("error", ctx.error); + } }, encapsulation: 2 }); +/*@__PURE__*/ (function () { i0.ɵsetClassMetadata(MyComponent, [{ + type: Component, + args: [{ + selector: 'my-component', + template: '
' + }] + }], null, null); })(); +export class MyModule { +} +MyModule.ɵmod = i0.ɵɵdefineNgModule({ type: MyModule }); +MyModule.ɵinj = i0.ɵɵdefineInjector({ factory: function MyModule_Factory(t) { return new (t || MyModule)(); } }); +(function () { (typeof ngJitMode === "undefined" || ngJitMode) && i0.ɵɵsetNgModuleScope(MyModule, { declarations: [MyComponent] }); })(); +/*@__PURE__*/ (function () { i0.ɵsetClassMetadata(MyModule, [{ + type: NgModule, + args: [{ declarations: [MyComponent] }] + }], null, null); })(); + +/**************************************************************************************************** + * PARTIAL FILE: class_style_bindings.d.ts + ****************************************************************************************************/ +import * as i0 from "@angular/core"; +export declare class MyComponent { + error: boolean; + color: string; + static ɵfac: i0.ɵɵFactoryDef; + static ɵcmp: i0.ɵɵComponentDefWithMeta; +} +export declare class MyModule { + static ɵmod: i0.ɵɵNgModuleDefWithMeta; + static ɵinj: i0.ɵɵInjectorDef; +} + +/**************************************************************************************************** + * PARTIAL FILE: deduplicate_attributes.js + ****************************************************************************************************/ +import { Component, NgModule } from '@angular/core'; +import * as i0 from "@angular/core"; +export class MyComponent { +} +MyComponent.ɵfac = function MyComponent_Factory(t) { return new (t || MyComponent)(); }; +MyComponent.ɵcmp = i0.ɵɵdefineComponent({ type: MyComponent, selectors: [["my-component"]], decls: 2, vars: 0, consts: [["title", "hi"]], template: function MyComponent_Template(rf, ctx) { if (rf & 1) { + i0.ɵɵelement(0, "div", 0); + i0.ɵɵelement(1, "span", 0); + } }, encapsulation: 2 }); +/*@__PURE__*/ (function () { i0.ɵsetClassMetadata(MyComponent, [{ + type: Component, + args: [{ + selector: 'my-component', + template: ` +
+ + ` + }] + }], null, null); })(); +export class MyModule { +} +MyModule.ɵmod = i0.ɵɵdefineNgModule({ type: MyModule }); +MyModule.ɵinj = i0.ɵɵdefineInjector({ factory: function MyModule_Factory(t) { return new (t || MyModule)(); } }); +(function () { (typeof ngJitMode === "undefined" || ngJitMode) && i0.ɵɵsetNgModuleScope(MyModule, { declarations: [MyComponent] }); })(); +/*@__PURE__*/ (function () { i0.ɵsetClassMetadata(MyModule, [{ + type: NgModule, + args: [{ declarations: [MyComponent] }] + }], null, null); })(); + +/**************************************************************************************************** + * PARTIAL FILE: deduplicate_attributes.d.ts + ****************************************************************************************************/ +import * as i0 from "@angular/core"; +export declare class MyComponent { + static ɵfac: i0.ɵɵFactoryDef; + static ɵcmp: i0.ɵɵComponentDefWithMeta; +} +export declare class MyModule { + static ɵmod: i0.ɵɵNgModuleDefWithMeta; + static ɵinj: i0.ɵɵInjectorDef; +} + diff --git a/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/elements/TEST_CASES.json b/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/elements/TEST_CASES.json new file mode 100644 index 0000000000..ad75a49600 --- /dev/null +++ b/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/elements/TEST_CASES.json @@ -0,0 +1,231 @@ +{ + "$schema": "../test_case_schema.json", + "cases": [ + { + "description": "should handle SVG", + "inputFiles": [ + "svg.ts" + ], + "expectations": [ + { + "files": [ + { + "expected": "svg_factory.js", + "generated": "svg.js" + } + ], + "failureMessage": "Incorrect generated factory." + }, + { + "files": [ + { + "expected": "svg_template.js", + "generated": "svg.js" + } + ], + "failureMessage": "Incorrect generated template." + } + ] + }, + { + "description": "should handle MathML", + "inputFiles": [ + "mathml.ts" + ], + "expectations": [ + { + "files": [ + { + "expected": "mathml_factory.js", + "generated": "mathml.js" + } + ], + "failureMessage": "Incorrect generated factory." + }, + { + "files": [ + { + "expected": "mathml_template.js", + "generated": "mathml.js" + } + ], + "failureMessage": "Incorrect generated template." + } + ] + }, + { + "description": "should translate DOM structure", + "inputFiles": [ + "dom.ts" + ], + "expectations": [ + { + "files": [ + { + "expected": "dom_factory.js", + "generated": "dom.js" + } + ], + "failureMessage": "Incorrect generated factory." + }, + { + "files": [ + { + "expected": "dom_template.js", + "generated": "dom.js" + } + ], + "failureMessage": "Incorrect generated template." + } + ] + }, + { + "description": "should support namespaced attributes", + "inputFiles": [ + "namespace.ts" + ], + "expectations": [ + { + "files": [ + { + "expected": "namespace_factory.js", + "generated": "namespace.js" + } + ], + "failureMessage": "Incorrect generated factory." + }, + { + "files": [ + { + "expected": "namespace_template.js", + "generated": "namespace.js" + } + ], + "failureMessage": "Incorrect generated template." + } + ] + }, + { + "description": "should support ", + "inputFiles": [ + "ng-container.ts" + ], + "expectations": [ + { + "failureMessage": "Incorrect generated template." + } + ] + }, + { + "description": "should generate self-closing elementContainer instruction for empty ", + "inputFiles": [ + "empty_ng-container.ts" + ], + "expectations": [ + { + "failureMessage": "Incorrect generated template." + } + ] + }, + { + "description": "should bind to element properties", + "inputFiles": [ + "properties.ts" + ], + "expectations": [ + { + "files": [ + { + "expected": "properties_factory.js", + "generated": "properties.js" + } + ], + "failureMessage": "Incorrect generated factory." + }, + { + "files": [ + { + "expected": "properties_template.js", + "generated": "properties.js" + } + ], + "failureMessage": "Incorrect generated template." + } + ] + }, + { + "description": "should reserve slots for pure functions", + "inputFiles": [ + "property_pure_functions.ts" + ], + "expectations": [ + { + "files": [ + { + "expected": "property_pure_functions_factory.js", + "generated": "property_pure_functions.js" + } + ], + "failureMessage": "Incorrect generated factory." + }, + { + "files": [ + { + "expected": "property_pure_functions_template.js", + "generated": "property_pure_functions.js" + } + ], + "failureMessage": "Incorrect generated template." + } + ] + }, + { + "description": "should reserve slots for pure functions in host binding function", + "inputFiles": [ + "host_binding_pure_functions.ts" + ], + "expectations": [ + { + "failureMessage": "Incorrect `hostBindings` function." + } + ] + }, + { + "description": "should bind to class and style names", + "inputFiles": [ + "class_style_bindings.ts" + ], + "expectations": [ + { + "files": [ + { + "expected": "class_style_bindings_factory.js", + "generated": "class_style_bindings.js" + } + ], + "failureMessage": "Incorrect generated factory." + }, + { + "files": [ + { + "expected": "class_style_bindings_template.js", + "generated": "class_style_bindings.js" + } + ], + "failureMessage": "Incorrect generated template." + } + ] + }, + { + "description": "should de-duplicate attribute arrays", + "inputFiles": [ + "deduplicate_attributes.ts" + ], + "expectations": [ + { + "failureMessage": "Incorrect generated template." + } + ] + } + ] +} diff --git a/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/elements/class_style_bindings.ts b/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/elements/class_style_bindings.ts new file mode 100644 index 0000000000..87f962c874 --- /dev/null +++ b/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/elements/class_style_bindings.ts @@ -0,0 +1,14 @@ +import {Component, NgModule} from '@angular/core'; + +@Component({ + selector: 'my-component', + template: '
' +}) +export class MyComponent { + error = true; + color = 'red'; +} + +@NgModule({declarations: [MyComponent]}) +export class MyModule { +} diff --git a/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/elements/class_style_bindings_factory.js b/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/elements/class_style_bindings_factory.js new file mode 100644 index 0000000000..b407377cdb --- /dev/null +++ b/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/elements/class_style_bindings_factory.js @@ -0,0 +1 @@ +MyComponent.ɵfac = function MyComponent_Factory(t) { return new (t || MyComponent)(); } \ No newline at end of file diff --git a/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/elements/class_style_bindings_template.js b/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/elements/class_style_bindings_template.js new file mode 100644 index 0000000000..4c74990900 --- /dev/null +++ b/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/elements/class_style_bindings_template.js @@ -0,0 +1,14 @@ +MyComponent.ɵcmp = i0.ɵɵdefineComponent({type:MyComponent,selectors:[["my-component"]], +decls: 1, +vars: 4, +template: function MyComponent_Template(rf,ctx){ + if (rf & 1) { + $r3$.ɵɵelement(0, "div"); + } + if (rf & 2) { + $r3$.ɵɵstyleProp("background-color", ctx.color); + $r3$.ɵɵclassProp("error", ctx.error); + } +}, +encapsulation: 2 +}); diff --git a/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/elements/deduplicate_attributes.js b/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/elements/deduplicate_attributes.js new file mode 100644 index 0000000000..fad270e221 --- /dev/null +++ b/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/elements/deduplicate_attributes.js @@ -0,0 +1,8 @@ +consts: [["title", "hi"]], +template: function MyComponent_Template(rf, ctx) { + if (rf & 1) { + $r3$.ɵɵelement(0, "div", 0); + $r3$.ɵɵelement(1, "span", 0); + } + … +} \ No newline at end of file diff --git a/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/elements/deduplicate_attributes.ts b/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/elements/deduplicate_attributes.ts new file mode 100644 index 0000000000..66d891dd9a --- /dev/null +++ b/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/elements/deduplicate_attributes.ts @@ -0,0 +1,15 @@ +import {Component, NgModule} from '@angular/core'; + +@Component({ + selector: 'my-component', + template: ` +
+ + ` +}) +export class MyComponent { +} + +@NgModule({declarations: [MyComponent]}) +export class MyModule { +} \ No newline at end of file diff --git a/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/elements/dom.ts b/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/elements/dom.ts new file mode 100644 index 0000000000..f07455bdd9 --- /dev/null +++ b/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/elements/dom.ts @@ -0,0 +1,12 @@ +import {Component, NgModule} from '@angular/core'; + +@Component({ + selector: 'my-component', + template: '
Hello World!
' +}) +export class MyComponent { +} + +@NgModule({declarations: [MyComponent]}) +export class MyModule { +} diff --git a/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/elements/dom_factory.js b/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/elements/dom_factory.js new file mode 100644 index 0000000000..b407377cdb --- /dev/null +++ b/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/elements/dom_factory.js @@ -0,0 +1 @@ +MyComponent.ɵfac = function MyComponent_Factory(t) { return new (t || MyComponent)(); } \ No newline at end of file diff --git a/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/elements/dom_template.js b/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/elements/dom_template.js new file mode 100644 index 0000000000..f7acebc639 --- /dev/null +++ b/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/elements/dom_template.js @@ -0,0 +1,13 @@ +// NOTE: AttributeMarker.Classes = 1 +consts: [["title", "Hello", 1, "my-app"]], +template: function MyComponent_Template(rf, ctx) { + if (rf & 1) { + $r3$.ɵɵelementStart(0, "div", 0); + $r3$.ɵɵtext(1, "Hello "); + $r3$.ɵɵelementStart(2, "b"); + $r3$.ɵɵtext(3, "World"); + $r3$.ɵɵelementEnd(); + $r3$.ɵɵtext(4, "!"); + $r3$.ɵɵelementEnd(); + } +} diff --git a/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/elements/empty_ng-container.js b/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/elements/empty_ng-container.js new file mode 100644 index 0000000000..89e0cd6548 --- /dev/null +++ b/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/elements/empty_ng-container.js @@ -0,0 +1,6 @@ +// NOTE: The template should look like this (where IDENT is a wild card for an identifier): +template: function MyComponent_Template(rf, ctx) { + if (rf & 1) { + i0.ɵɵelementContainer(0); + } +} \ No newline at end of file diff --git a/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/elements/empty_ng-container.ts b/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/elements/empty_ng-container.ts new file mode 100644 index 0000000000..2c38791f68 --- /dev/null +++ b/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/elements/empty_ng-container.ts @@ -0,0 +1,9 @@ +import {Component, NgModule} from '@angular/core'; + +@Component({selector: 'my-component', template: ''}) +export class MyComponent { +} + +@NgModule({declarations: [MyComponent]}) +export class MyModule { +} diff --git a/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/elements/host_binding_pure_functions.js b/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/elements/host_binding_pure_functions.js new file mode 100644 index 0000000000..5b3b5b0c0a --- /dev/null +++ b/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/elements/host_binding_pure_functions.js @@ -0,0 +1,18 @@ +const $_c0$ = function (a0, a1) { return { collapsedHeight: a0, expandedHeight: a1 }; }; +const $_c1$ = function (a0, a1) { return { value: a0, params: a1 }; }; +const $_c2$ = function (a0, a1) { return { collapsedWidth: a0, expandedWidth: a1 }; }; +… +hostVars: 14, +hostBindings: function MyComponent_HostBindings(rf, ctx) { + if (rf & 2) { + $r3$.ɵɵsyntheticHostProperty("@expansionHeight", + $r3$.ɵɵpureFunction2(5, $_c1$, ctx.getExpandedState(), + $r3$.ɵɵpureFunction2(2, $_c0$, ctx.collapsedHeight, ctx.expandedHeight) + ) + )("@expansionWidth", + $r3$.ɵɵpureFunction2(11, $_c1$, ctx.getExpandedState(), + $r3$.ɵɵpureFunction2(8, $_c2$, ctx.collapsedWidth, ctx.expandedWidth) + ) + ); + } +}, \ No newline at end of file diff --git a/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/elements/host_binding_pure_functions.ts b/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/elements/host_binding_pure_functions.ts new file mode 100644 index 0000000000..846aaa5371 --- /dev/null +++ b/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/elements/host_binding_pure_functions.ts @@ -0,0 +1,37 @@ +import {Component, Input, NgModule} from '@angular/core'; + +@Component({ + selector: 'my-component', + template: '...', + host: { + '[@expansionHeight]': `{ + value: getExpandedState(), + params: { + collapsedHeight: collapsedHeight, + expandedHeight: expandedHeight + } + }`, + '[@expansionWidth]': `{ + value: getExpandedState(), + params: { + collapsedWidth: collapsedWidth, + expandedWidth: expandedWidth + } + }` + } +}) +export class MyComponent { + @Input() expandedHeight!: string; + @Input() collapsedHeight!: string; + + @Input() expandedWidth!: string; + @Input() collapsedWidth!: string; + + getExpandedState() { + return 'expanded'; + } +} + +@NgModule({declarations: [MyComponent]}) +export class MyModule { +} diff --git a/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/elements/mathml.js b/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/elements/mathml.js new file mode 100644 index 0000000000..6da17c178a --- /dev/null +++ b/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/elements/mathml.js @@ -0,0 +1,15 @@ +consts: [["title", "Hello", ${AttributeMarker.Classes}, "my-app"]], +template: function MyComponent_Template(rf, ctx) { + if (rf & 1) { + $r3$.ɵɵelementStart(0, "div", 0); + $r3$.ɵɵnamespaceMathML(); + $r3$.ɵɵelementStart(1, "math"); + $r3$.ɵɵelement(2, "infinity"); + $r3$.ɵɵelementEnd(); + $r3$.ɵɵnamespaceHTML(); + $r3$.ɵɵelementStart(3, "p"); + $r3$.ɵɵtext(4, "test"); + $r3$.ɵɵelementEnd(); + $r3$.ɵɵelementEnd(); + } +} \ No newline at end of file diff --git a/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/elements/mathml.ts b/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/elements/mathml.ts new file mode 100644 index 0000000000..57c7da1aed --- /dev/null +++ b/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/elements/mathml.ts @@ -0,0 +1,12 @@ +import {Component, NgModule} from '@angular/core'; + +@Component({ + selector: 'my-component', + template: '

test

' +}) +export class MyComponent { +} + +@NgModule({declarations: [MyComponent]}) +export class MyModule { +} diff --git a/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/elements/mathml_factory.js b/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/elements/mathml_factory.js new file mode 100644 index 0000000000..b407377cdb --- /dev/null +++ b/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/elements/mathml_factory.js @@ -0,0 +1 @@ +MyComponent.ɵfac = function MyComponent_Factory(t) { return new (t || MyComponent)(); } \ No newline at end of file diff --git a/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/elements/mathml_template.js b/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/elements/mathml_template.js new file mode 100644 index 0000000000..e04d350751 --- /dev/null +++ b/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/elements/mathml_template.js @@ -0,0 +1,16 @@ +// NOTE: AttributeMarker.Classes = 1 +consts: [["title", "Hello", 1, "my-app"]], +template: function MyComponent_Template(rf, ctx) { + if (rf & 1) { + $r3$.ɵɵelementStart(0, "div", 0); + $r3$.ɵɵnamespaceMathML(); + $r3$.ɵɵelementStart(1, "math"); + $r3$.ɵɵelement(2, "infinity"); + $r3$.ɵɵelementEnd(); + $r3$.ɵɵnamespaceHTML(); + $r3$.ɵɵelementStart(3, "p"); + $r3$.ɵɵtext(4, "test"); + $r3$.ɵɵelementEnd(); + $r3$.ɵɵelementEnd(); + } +} \ No newline at end of file diff --git a/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/elements/namespace.ts b/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/elements/namespace.ts new file mode 100644 index 0000000000..093ff615b1 --- /dev/null +++ b/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/elements/namespace.ts @@ -0,0 +1,13 @@ +import {Component, NgModule} from '@angular/core'; + +@Component({ + selector: 'my-component', + template: + '
Hello World!
' +}) +export class MyComponent { +} + +@NgModule({declarations: [MyComponent]}) +export class MyModule { +} diff --git a/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/elements/namespace_factory.js b/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/elements/namespace_factory.js new file mode 100644 index 0000000000..b407377cdb --- /dev/null +++ b/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/elements/namespace_factory.js @@ -0,0 +1 @@ +MyComponent.ɵfac = function MyComponent_Factory(t) { return new (t || MyComponent)(); } \ No newline at end of file diff --git a/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/elements/namespace_template.js b/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/elements/namespace_template.js new file mode 100644 index 0000000000..cb55537cb9 --- /dev/null +++ b/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/elements/namespace_template.js @@ -0,0 +1,19 @@ +// NOTE: AttributeMarker.NamespaceURI = 0 +// NOTE: AttributeMarker.Classes = 1 +consts: [[ + 0, "xmlns", "foo", "http://someuri/foo", + 0, "foo", "bar", "baz", + "title", "Hello", + 0, "foo", "qux", "quacks", + 1, "my-app"]], +template: function MyComponent_Template(rf, ctx) { + if (rf & 1) { + $r3$.ɵɵelementStart(0, "div", 0); + $r3$.ɵɵtext(1, "Hello "); + $r3$.ɵɵelementStart(2, "b"); + $r3$.ɵɵtext(3, "World"); + $r3$.ɵɵelementEnd(); + $r3$.ɵɵtext(4, "!"); + $r3$.ɵɵelementEnd(); + } +} \ No newline at end of file diff --git a/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/elements/ng-container.js b/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/elements/ng-container.js new file mode 100644 index 0000000000..1fd1beb586 --- /dev/null +++ b/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/elements/ng-container.js @@ -0,0 +1,10 @@ +template: function MyComponent_Template(rf, ctx) { + if (rf & 1) { + i0.ɵɵelementContainerStart(0); + i0.ɵɵelementStart(1, "span"); + i0.ɵɵtext(2, "in a "); + i0.ɵɵelementEnd(); + i0.ɵɵtext(3, "container"); + i0.ɵɵelementContainerEnd(); + } +} \ No newline at end of file diff --git a/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/elements/ng-container.ts b/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/elements/ng-container.ts new file mode 100644 index 0000000000..2ed3b3cc33 --- /dev/null +++ b/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/elements/ng-container.ts @@ -0,0 +1,12 @@ +import {Component, NgModule} from '@angular/core'; + +@Component({ + selector: 'my-component', + template: 'in a container' +}) +export class MyComponent { +} + +@NgModule({declarations: [MyComponent]}) +export class MyModule { +} diff --git a/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/elements/properties.ts b/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/elements/properties.ts new file mode 100644 index 0000000000..493abe8679 --- /dev/null +++ b/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/elements/properties.ts @@ -0,0 +1,10 @@ +import {Component, NgModule} from '@angular/core'; + +@Component({selector: 'my-component', template: '
'}) +export class MyComponent { + id = 'one'; +} + +@NgModule({declarations: [MyComponent]}) +export class MyModule { +} diff --git a/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/elements/properties_factory.js b/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/elements/properties_factory.js new file mode 100644 index 0000000000..b407377cdb --- /dev/null +++ b/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/elements/properties_factory.js @@ -0,0 +1 @@ +MyComponent.ɵfac = function MyComponent_Factory(t) { return new (t || MyComponent)(); } \ No newline at end of file diff --git a/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/elements/properties_template.js b/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/elements/properties_template.js new file mode 100644 index 0000000000..16bf3ebe6b --- /dev/null +++ b/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/elements/properties_template.js @@ -0,0 +1,10 @@ +// NOTE: AttributeMarker.Bindings = 3 +consts: [[3, "id"]], +template: function MyComponent_Template(rf, ctx) { + if (rf & 1) { + $r3$.ɵɵelement(0, "div", 0); + } + if (rf & 2) { + $r3$.ɵɵproperty("id", ctx.id); + } +} diff --git a/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/elements/property_pure_functions.ts b/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/elements/property_pure_functions.ts new file mode 100644 index 0000000000..674a467ef3 --- /dev/null +++ b/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/elements/property_pure_functions.ts @@ -0,0 +1,18 @@ +import {Component, NgModule} from '@angular/core'; + +@Component({ + selector: 'my-component', + template: `
` +}) +export class MyComponent { + id = 'one'; +} + +@NgModule({declarations: [MyComponent]}) +export class MyModule { +} diff --git a/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/elements/property_pure_functions_factory.js b/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/elements/property_pure_functions_factory.js new file mode 100644 index 0000000000..b407377cdb --- /dev/null +++ b/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/elements/property_pure_functions_factory.js @@ -0,0 +1 @@ +MyComponent.ɵfac = function MyComponent_Factory(t) { return new (t || MyComponent)(); } \ No newline at end of file diff --git a/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/elements/property_pure_functions_template.js b/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/elements/property_pure_functions_template.js new file mode 100644 index 0000000000..643f264062 --- /dev/null +++ b/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/elements/property_pure_functions_template.js @@ -0,0 +1,9 @@ +template: function MyComponent_Template(rf, ctx) { + if (rf & 1) { + $r3$.ɵɵelement(0, "div", 0); + $r3$.ɵɵpipe(1, "pipe"); + } + if (rf & 2) { + $r3$.ɵɵproperty("ternary", ctx.cond ? $r3$.ɵɵpureFunction1(8, $c0$, ctx.a): $r3$.ɵɵpureFunction0(10, $c1$))("pipe", $r3$.ɵɵpipeBind3(1, 4, ctx.value, 1, 2))("and", ctx.cond && $r3$.ɵɵpureFunction1(11, $c0$, ctx.b))("or", ctx.cond || $r3$.ɵɵpureFunction1(13, $c0$, ctx.c)); + } +} diff --git a/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/elements/svg.ts b/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/elements/svg.ts new file mode 100644 index 0000000000..fc6b96cce4 --- /dev/null +++ b/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/elements/svg.ts @@ -0,0 +1,13 @@ +import {Component, NgModule} from '@angular/core'; + +@Component({ + selector: 'my-component', + template: + '

test

' +}) +export class MyComponent { +} + +@NgModule({declarations: [MyComponent]}) +export class MyModule { +} diff --git a/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/elements/svg_factory.js b/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/elements/svg_factory.js new file mode 100644 index 0000000000..b407377cdb --- /dev/null +++ b/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/elements/svg_factory.js @@ -0,0 +1 @@ +MyComponent.ɵfac = function MyComponent_Factory(t) { return new (t || MyComponent)(); } \ No newline at end of file diff --git a/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/elements/svg_template.js b/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/elements/svg_template.js new file mode 100644 index 0000000000..6250a4c83e --- /dev/null +++ b/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/elements/svg_template.js @@ -0,0 +1,15 @@ +consts: [["title", "Hello", 1, "my-app"], ["cx", "20", "cy", "30", "r", "50"]], + template: function MyComponent_Template(rf, ctx) { + if (rf & 1) { + $r3$.ɵɵelementStart(0, "div", 0); + $r3$.ɵɵnamespaceSVG(); + $r3$.ɵɵelementStart(1, "svg"); + $r3$.ɵɵelement(2, "circle", 1); + $r3$.ɵɵelementEnd(); + $r3$.ɵɵnamespaceHTML(); + $r3$.ɵɵelementStart(3, "p"); + $r3$.ɵɵtext(4, "test"); + $r3$.ɵɵelementEnd(); + $r3$.ɵɵelementEnd(); + } + }