diff --git a/packages/core/test/bundling/hello_world_i18n/BUILD.bazel b/packages/core/test/bundling/hello_world_i18n/BUILD.bazel new file mode 100644 index 0000000000..cc886bbaef --- /dev/null +++ b/packages/core/test/bundling/hello_world_i18n/BUILD.bazel @@ -0,0 +1,36 @@ +package(default_visibility = ["//visibility:public"]) + +load("//tools:defaults.bzl", "ts_library", "ivy_ng_module") +load("//packages/bazel/src:ng_rollup_bundle.bzl", "ng_rollup_bundle") +load("@build_bazel_rules_typescript//:defs.bzl", "ts_devserver") + +ivy_ng_module( + name = "hello_world_i18n", + srcs = ["index.ts"], + deps = [ + "//packages/core", + ], +) + +ng_rollup_bundle( + name = "bundle", + # Remove once #22913 lands + entry_point = "packages/core/test/bundling/hello_world_i18n/index.js", + deps = [ + ":hello_world_i18n", + "//packages/core", + ], +) + +ts_devserver( + name = "devserver", + static_files = [ + ":bundle.min_debug.js", + ":bundle.min.js", + "index.html", + ], + deps = [ + # fix for ibazel until https://github.com/angular/angular/pull/22912 gets merged + "//packages/compiler", + ], +) diff --git a/packages/core/test/bundling/hello_world_i18n/index.html b/packages/core/test/bundling/hello_world_i18n/index.html new file mode 100644 index 0000000000..c5c7bb3e0b --- /dev/null +++ b/packages/core/test/bundling/hello_world_i18n/index.html @@ -0,0 +1,31 @@ + + + + + Angular Hello World Example + + + + + + + + + \ No newline at end of file diff --git a/packages/core/test/bundling/hello_world_i18n/index.ts b/packages/core/test/bundling/hello_world_i18n/index.ts new file mode 100644 index 0000000000..c1c4012014 --- /dev/null +++ b/packages/core/test/bundling/hello_world_i18n/index.ts @@ -0,0 +1,33 @@ +/** + * @license + * Copyright Google Inc. All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ + +import {Component, NgModule, ɵrenderComponent as renderComponent} from '@angular/core'; + +// simulate translations for now +const translations: {[key: string]: string} = { + 'Hello World!': 'Bonjour Monde!', + 'Hello Title!': 'Bonjour Titre!', +}; + +// simulate Google Closure getMsg for now +(window as any).goog = {getMsg: (key: string) => { return translations[key] || key; }}; + +@Component({ + selector: 'hello-world', + template: `
Hello World!
` +}) +export class HelloWorld { +} +// TODO(misko): Forgetting to export HelloWorld and not having NgModule fails silently. + +@NgModule({declarations: [HelloWorld]}) +export class INeedToExistEvenThoughtIAmNotNeeded { +} +// TODO(misko): Package should not be required to make this work. + +renderComponent(HelloWorld);