diff --git a/packages/common/locales/BUILD.bazel b/packages/common/locales/BUILD.bazel new file mode 100644 index 0000000000..c0d43c43a9 --- /dev/null +++ b/packages/common/locales/BUILD.bazel @@ -0,0 +1,15 @@ +package(default_visibility = ["//visibility:public"]) + +load("@build_bazel_rules_typescript//:defs.bzl", "ts_library") + +ts_library( + name = "locales", + srcs = glob( + ["**/*.ts"], + exclude = ["closure-locale.ts"], + ), + module_name = "@angular/common/locales", + tsconfig = "//packages:tsconfig", + deps = [ + ], +) diff --git a/packages/common/public_api.ts b/packages/common/public_api.ts index 7dfd92837b..308ff0cf65 100644 --- a/packages/common/public_api.ts +++ b/packages/common/public_api.ts @@ -12,5 +12,6 @@ * Entry point for all public APIs of this package. */ export * from './src/common'; +export {registerLocaleData as ɵregisterLocaleData} from './src/i18n/locale_data'; // This file only reexports content of the `src` folder. Keep it that way. diff --git a/packages/common/src/i18n/localization.ts b/packages/common/src/i18n/localization.ts index bcf75dda0a..69aeceafdf 100644 --- a/packages/common/src/i18n/localization.ts +++ b/packages/common/src/i18n/localization.ts @@ -27,8 +27,6 @@ export abstract class NgLocalization { * Returns the plural category for a given value. * - "=value" when the case exists, * - the plural category otherwise - * - * @internal */ export function getPluralCategory( value: number, cases: string[], ngLocalization: NgLocalization, locale?: string): string { diff --git a/packages/common/test/BUILD.bazel b/packages/common/test/BUILD.bazel new file mode 100644 index 0000000000..18527a78f9 --- /dev/null +++ b/packages/common/test/BUILD.bazel @@ -0,0 +1,43 @@ +load("@build_bazel_rules_typescript//:defs.bzl", "ts_library", "ts_web_test") +load("@build_bazel_rules_nodejs//:defs.bzl", "jasmine_node_test") + +ts_library( + name = "test_lib", + testonly = 1, + srcs = glob( + ["**/*.ts"], + exclude = ["**/*_node_only_spec.ts"], + ), + tsconfig = "//packages:tsconfig", + deps = [ + "//packages/compiler", + "//packages/common", + "//packages/common/locales", + "//packages/core", + "//packages/core/testing", + "//packages/platform-browser", + "//packages/platform-browser/testing", + "//packages/platform-browser-dynamic", + ], +) + +jasmine_node_test( + name = "test", + bootstrap = ["angular_src/packages/_testing_init/init_node_spec.js"], + deps = [ + ":test_lib", + "//packages/_testing_init:node", + ], +) + +ts_web_test( + name = "test_web", + bootstrap = [ + "//:angular_bootstrap_scripts", + ], + # do not sort + deps = [ + "//packages/_testing_init:browser", + ":test_lib", + ], +) diff --git a/packages/common/test/i18n/locale_data_api_spec.ts b/packages/common/test/i18n/locale_data_api_spec.ts index 4506b4886f..667977e82d 100644 --- a/packages/common/test/i18n/locale_data_api_spec.ts +++ b/packages/common/test/i18n/locale_data_api_spec.ts @@ -6,10 +6,10 @@ * found in the LICENSE file at https://angular.io/license */ -import localeCaESVALENCIA from '../../locales/ca-ES-VALENCIA'; -import localeEn from '../../locales/en'; -import localeFr from '../../locales/fr'; -import localeFrCA from '../../locales/fr-CA'; +import localeCaESVALENCIA from '@angular/common/locales/ca-ES-VALENCIA'; +import localeEn from '@angular/common/locales/en'; +import localeFr from '@angular/common/locales/fr'; +import localeFrCA from '@angular/common/locales/fr-CA'; import {registerLocaleData} from '../../src/i18n/locale_data'; import {findLocaleData} from '../../src/i18n/locale_data_api'; diff --git a/packages/common/test/i18n/localization_spec.ts b/packages/common/test/i18n/localization_spec.ts index fea5870e35..8eba92fb2c 100644 --- a/packages/common/test/i18n/localization_spec.ts +++ b/packages/common/test/i18n/localization_spec.ts @@ -6,10 +6,10 @@ * found in the LICENSE file at https://angular.io/license */ -import localeRo from '../../locales/ro'; -import localeSr from '../../locales/sr'; -import localeZgh from '../../locales/zgh'; -import localeFr from '../../locales/fr'; +import localeRo from '@angular/common/locales/ro'; +import localeSr from '@angular/common/locales/sr'; +import localeZgh from '@angular/common/locales/zgh'; +import localeFr from '@angular/common/locales/fr'; import {LOCALE_ID} from '@angular/core'; import {TestBed, inject} from '@angular/core/testing'; import {NgLocaleLocalization, NgLocalization, getPluralCategory, DEPRECATED_PLURAL_FN, getPluralCase} from '../../src/i18n/localization'; diff --git a/packages/common/test/pipes/date_pipe_spec.ts b/packages/common/test/pipes/date_pipe_spec.ts index a3fc65ecf3..93f549dcaf 100644 --- a/packages/common/test/pipes/date_pipe_spec.ts +++ b/packages/common/test/pipes/date_pipe_spec.ts @@ -9,12 +9,12 @@ import {DatePipe, registerLocaleData} from '@angular/common'; import {PipeResolver} from '@angular/compiler/src/pipe_resolver'; import {JitReflector} from '@angular/platform-browser-dynamic/src/compiler_reflector'; -import localeEn from '../../locales/en'; -import localeEnExtra from '../../locales/extra/en'; -import localeDe from '../../locales/de'; -import localeHu from '../../locales/hu'; -import localeSr from '../../locales/sr'; -import localeTh from '../../locales/th'; +import localeEn from '@angular/common/locales/en'; +import localeEnExtra from '@angular/common/locales/extra/en'; +import localeDe from '@angular/common/locales/de'; +import localeHu from '@angular/common/locales/hu'; +import localeSr from '@angular/common/locales/sr'; +import localeTh from '@angular/common/locales/th'; { describe('DatePipe', () => { diff --git a/packages/common/test/pipes/number_pipe_spec.ts b/packages/common/test/pipes/number_pipe_spec.ts index af354e9abd..f4b6d83bb4 100644 --- a/packages/common/test/pipes/number_pipe_spec.ts +++ b/packages/common/test/pipes/number_pipe_spec.ts @@ -6,9 +6,9 @@ * found in the LICENSE file at https://angular.io/license */ -import localeEn from '../../locales/en'; -import localeEsUS from '../../locales/es-US'; -import localeFr from '../../locales/fr'; +import localeEn from '@angular/common/locales/en'; +import localeEsUS from '@angular/common/locales/es-US'; +import localeFr from '@angular/common/locales/fr'; import {registerLocaleData, CurrencyPipe, DecimalPipe, PercentPipe} from '@angular/common'; import {beforeEach, describe, expect, it} from '@angular/core/testing/src/testing_internal'; diff --git a/packages/compiler/test/BUILD.bazel b/packages/compiler/test/BUILD.bazel index 08afaa898a..300f184cfa 100644 --- a/packages/compiler/test/BUILD.bazel +++ b/packages/compiler/test/BUILD.bazel @@ -1,9 +1,13 @@ -load("@build_bazel_rules_typescript//:defs.bzl", "ts_library") +load("@build_bazel_rules_typescript//:defs.bzl", "ts_library", "ts_web_test") +load("@build_bazel_rules_nodejs//:defs.bzl", "jasmine_node_test") ts_library( - name = "test", + name = "test_lib", testonly = 1, - srcs = glob(["**/*.ts"]), + srcs = glob( + ["**/*.ts"], + exclude = ["**/*_node_only_spec.ts"], + ), tsconfig = "//packages:tsconfig", deps = [ "//packages:types", @@ -18,3 +22,42 @@ ts_library( "//packages/platform-browser/testing", ], ) + +ts_library( + name = "test_node_only_lib", + testonly = 1, + srcs = glob(["**/*_node_only_spec.ts"]), + tsconfig = "//packages:tsconfig", + deps = [ + ":test_lib", + "//packages/compiler", + "//packages/compiler/testing", + ], +) + +jasmine_node_test( + name = "test", + bootstrap = ["angular_src/packages/_testing_init/init_node_spec.js"], + # dissable since tests are running but not yet passing + tags = ["manual"], + deps = [ + ":test_lib", + ":test_node_only_lib", + "//packages/_testing_init:node", + "//packages/core", + ], +) + +ts_web_test( + name = "test_web", + bootstrap = [ + "//:angular_bootstrap_scripts", + ], + # dissable since tests are running but not yet passing + tags = ["manual"], + # do not sort + deps = [ + "//packages/_testing_init:browser", + ":test_lib", + ], +)