From a9864471a4590da00529dae9381da1014a7f569e Mon Sep 17 00:00:00 2001 From: Keen Yee Liau Date: Thu, 22 Aug 2019 11:15:45 -0700 Subject: [PATCH] test: make tree test work in g3 (#32274) This PR modifies the tree render3 (ivy) test so that it works in g3. Namely, the index.ts must be named index_aot.ts and scripts should be loaded via ts_devserver and not as an explicit script tag in the HTML. PR Close #32274 --- .../benchmarks/src/tree/render3/BUILD.bazel | 18 ++++++++++-------- modules/benchmarks/src/tree/render3/index.html | 6 ------ .../tree/render3/{index.ts => index_aot.ts} | 1 - modules/benchmarks/src/tree/render3/tree.ts | 9 ++++++--- 4 files changed, 16 insertions(+), 18 deletions(-) rename modules/benchmarks/src/tree/render3/{index.ts => index_aot.ts} (97%) diff --git a/modules/benchmarks/src/tree/render3/BUILD.bazel b/modules/benchmarks/src/tree/render3/BUILD.bazel index 4462699373..6f22d21252 100644 --- a/modules/benchmarks/src/tree/render3/BUILD.bazel +++ b/modules/benchmarks/src/tree/render3/BUILD.bazel @@ -6,20 +6,22 @@ load("//modules/benchmarks:benchmark_test.bzl", "benchmark_test") ng_module( name = "tree_lib", - srcs = glob(["**/*.ts"]), + srcs = [ + "index_aot.ts", + "tree.ts", + ], tags = ["ivy-only"], deps = [ "//modules/benchmarks/src/tree:util_lib", "//packages:types", "//packages/common", "//packages/core", - "@npm//reflect-metadata", ], ) ng_rollup_bundle( name = "bundle", - entry_point = ":index.ts", + entry_point = ":index_aot.ts", tags = ["ivy-only"], deps = [ ":tree_lib", @@ -29,12 +31,12 @@ ng_rollup_bundle( ts_devserver( name = "devserver", - static_files = [ - ":bundle.min_debug.js", - ":bundle.min.js", - "index.html", - ], + index_html = "index.html", + port = 4200, tags = ["ivy-only"], + deps = [ + ":bundle.min_debug.js", + ], ) benchmark_test( diff --git a/modules/benchmarks/src/tree/render3/index.html b/modules/benchmarks/src/tree/render3/index.html index 0f86ab6ac4..4889a4f40c 100644 --- a/modules/benchmarks/src/tree/render3/index.html +++ b/modules/benchmarks/src/tree/render3/index.html @@ -31,11 +31,5 @@ - diff --git a/modules/benchmarks/src/tree/render3/index.ts b/modules/benchmarks/src/tree/render3/index_aot.ts similarity index 97% rename from modules/benchmarks/src/tree/render3/index.ts rename to modules/benchmarks/src/tree/render3/index_aot.ts index 6c84b1df34..b923514314 100644 --- a/modules/benchmarks/src/tree/render3/index.ts +++ b/modules/benchmarks/src/tree/render3/index_aot.ts @@ -6,7 +6,6 @@ * found in the LICENSE file at https://angular.io/license */ -import 'reflect-metadata'; import {ɵrenderComponent as renderComponent} from '@angular/core'; import {bindAction, profile} from '../../util'; import {TreeComponent, createDom, destroyDom, detectChanges} from './tree'; diff --git a/modules/benchmarks/src/tree/render3/tree.ts b/modules/benchmarks/src/tree/render3/tree.ts index e6622edebd..a6c77591ce 100644 --- a/modules/benchmarks/src/tree/render3/tree.ts +++ b/modules/benchmarks/src/tree/render3/tree.ts @@ -9,7 +9,7 @@ import {CommonModule} from '@angular/common'; import {Component, NgModule, ɵdetectChanges} from '@angular/core'; -import {TreeNode, buildTree, emptyTree} from '../util'; +import {buildTree, emptyTree} from '../util'; export function destroyDom(component: TreeComponent) { component.data = emptyTree; @@ -34,8 +34,11 @@ export function detectChanges(component: TreeComponent) { @Component({ selector: 'tree', inputs: ['data'], - template: - ` {{data.value}} ` + template: ` + {{data.value}} + + + `, }) export class TreeComponent { data: any = emptyTree;