2116 Commits

Author SHA1 Message Date
Paul Gschwendtner d361eaaf83 test: convert source-map core tests to use async/await instead of fakeAsync (#46888)
The source map tests rely on asynchronous logic from the `source-map`
package. The tests itself are written using `fakeAsync` but this
unnecessarily complicates the interaction with the asynchronous
source-map helpers/package.

To fix this, we just make the tests use async/await as we don't intend
to test fakeAsync in this `describe` block..

PR Close #46888
2022-07-19 09:40:56 -07:00
Paul Gschwendtner cc86c30cb1 test: update source-map tests to account for source-map breaking change (#46888)
The source-map package now requires the
`SourceMapConsumer`/`SourceMapGenerator` classes to be instantiated
asynchronously. This commit updates our tests to account for that.

PR Close #46888
2022-07-19 09:40:55 -07:00
dario-piotrowicz 5bdbb6285b fix(animations): make sure falsy values are added to _globalTimelineStyles (#46863)
style values get added to the `_globalTimelineStyles` map in order to keep
them so that they can be used across different timelines

`_globalTimelineStyles` was previously a plain object but has been
refactored to a map in #44482, as part of the update a check has been
changed from a ternary operation to an or (||), causing falsy values (as 0)
not to be added to the map anymore, apply the nullish coalescing operator (??)
instead to make sure only `undefined` and `null` are filtered out

also since this aspect was clearly not covered by tests, add a new test
to ensure that such regression doesn't happen in the future

resolves #46833

PR Close #46863
2022-07-18 21:46:13 +00:00
Paul Gschwendtner fa308a6bdf test: update tests to account for karma-jasmine v5.0.0
Karma jasmine updated the `jasmine-core` dependency. Jasmine is now more
strict when:

* The done callback is invoked multiple times
* The done callback is used, while a promise is also returned
* The done callback is treated as error when e.g. a number is returned
  as first argument. This was the case with `requestAnimationFrame`.
2022-07-18 17:20:20 +00:00
Andrew Kushnir 481dc8dd2e refactor(core): improve an error message when ENVIRONMENT_INITIALIZER is not a multi provider (#46829)
Currently if the `ENVIRONMENT_INITIALIZER` token is not configured with `multi: true` flag, the code fails while trying to iterate over the value. This commit checks whether the `ENVIRONMENT_INITIALIZER` token value type is an array and throws a helpful error message.

PR Close #46829
2022-07-13 22:01:14 +00:00
dario-piotrowicz 862dd03764 refactor(animations): refactor non-animatable check to be timeline based (#46666)
move the check for non-animatable properties from the animation building
phase to the application of the animation's transition instead, in such
a way we can check it against the keyframes of the transition's timeline
in order to only provide warnings for properties which are being
animated, thus not providing any warning for non-animatable properties
being applied to elements via the style function

this change has the benfit just mentioned above but it comes with two
drawbacks:
 - the warning handling is not done in the building time so it is a bit
inconsistent with other type of validations (such as the unsupported css
properties one for example)
 - before the warning was being applied only when the animation's data
was being parsed, so it happed only once but now since it is applied
when the animation is actually being prepared to be played, it happens
each time the animation runs

resolves #46602

PR Close #46666
2022-07-12 22:36:22 +00:00
Paul Gschwendtner 349043db7b build: replace size-tracking test with rule from shared dev-infra (#46802)
The JS size-tracking logic has been moved into the dev-infra repository
and the rule has been updated to work better with Bazel labels. The
Starlark target is updated accordingly in this commit.

PR Close #46802
2022-07-12 19:06:30 +00:00
Jessica Janiuk 61c7e26500 Revert "refactor(router): Remove use of OutletInjector" (#46775)
This reverts commit e288d87742.

PR Close #46775
2022-07-11 19:13:21 +00:00
Jessica Janiuk ec267b4127 Revert "build: update router symbol golden file" (#46760)
This reverts commit bb9ec76c7d.

PR Close #46760
2022-07-08 23:12:34 +00:00
Andrew Scott 770f05421e refactor(router): Remove use of OutletInjector (#46755)
OutletInjector doesn't do anything special. Injector.create can be used instead

PR Close #46755
2022-07-08 21:56:01 +00:00
Andrew Scott 50126af513 build: update router symbol golden file (#46757)
File got out of date when merging a patch & main branch change

PR Close #46757
2022-07-08 21:14:57 +00:00
dario-piotrowicz 68b46e0d8d Revert "fix(animations): enable shadowElements to leave when their parent does (#46459)" (#46739)
This reverts commit b417370383.

The change applied is no longer appropriate since the use of animations
and shadow dom components is discouraged (as of #46738)

PR Close #46739
2022-07-07 13:51:30 -07:00
Paul Gschwendtner cde0a40a4b test: refactor bundle tests to not directly access CommonJS module.exports (#46642)
The test apps are bundled using their production ESM JS output using
`esbuild`. ESBuild warns about any CJS usages, like `module.exports.`

```
INFO: From Bundling Javascript packages/core/test/bundling/todo_i18n/index.ts [esbuild]:
▲ [WARNING] The CommonJS "module" variable is treated as a global variable in an ECMAScript module and may not work as expected

    bazel-out/k8-fastbuild/bin/packages/core/test/bundling/todo_i18n/index.mjs:494:0:
      494 │ module.exports = {
          ╵ ~~~~~~

  This file is considered to be an ECMAScript module because the file name ends in ".mjs".
```

Some bundling tests currently use `module.exports` to make
functions/symbols available to specs later requiring the bundle (in
order to run the bundle). Instead of using the CJS global here, the
logic can be attached consistently to `window` (there is currently a
mismatch of window vs. module.exports anyway..).

PR Close #46642
2022-07-01 10:20:52 -07:00
Alex Rickabaugh 368765c4a1 refactor(core): remove experimental Renderer3 abstraction (#46646)
This commit removes the `Renderer3` experiment which attempted to use the
real DOM API as Angular's renderer. As shown in the diff, having this
experiment around added real code complexity to Angular that could not be
removed by an optimizer.

Since we no longer feel this experiment is worth continuing, we're removing
the `Renderer3` concept and all supporting code.

PR Close #46646
2022-06-30 12:44:30 -07:00
Alex Rickabaugh 4272da5de6 refactor(core): disable automatic usage of Renderer3 (#46646)
Previously, when instantiating a component, Angular would look in the DI
hierarchy for `RendererFactory2`. Any DI tree which rolls up through an
application injector (that is, one created with `BrowserModule`) should be
able to provide this interface. If not found, Angular would switch to the
experimental `Renderer3` mechanism. This switch was designed this way,
because it allowed for the creation of experimental applications where
`RendererFactory2` was not included in the bundle at all.

In this commit, instead of automatically falling back on `Renderer3`-style
rendering, an error is raised instead if `RendererFactory2` is missing from
the DI hierarchy.

PR Close #46646
2022-06-30 12:44:30 -07:00
Alex Rickabaugh 6c3267f4b1 test(core): migrate tests off of Renderer3 interfaces (#46646)
This commit migrates any remaining Angular tests which are using some form
of Renderer3 interfaces. Instead, they're switched to Renderer2.

PR Close #46646
2022-06-30 12:44:29 -07:00
Alex Rickabaugh 497df1a1bf refactor(core): rename the ProceduralRenderer3 interface to Renderer (#46646)
Due to the restrictions of circular dependency checking, we need a separate
internal interface for a renderer. We cannot use `Renderer2` as a type
internally as even importing it as a type incurs a dependency on its
implementation, which creates a major potential for circular dependencies.

Previously this role was served by the `Renderer3` type. As we prepare to
remove the `Renderer3` abstraction (the idea of using `document` as a
differently-shaped renderer), this commit renames `ProceduralRenderer3` to
the more generic term `Renderer`.

`RendererFactory3` is also renamed to the more generic `RendererFactory` for
consistency.

PR Close #46646
2022-06-30 12:44:29 -07:00
Andrew Kushnir 88298cab50 test(core): set parent injector in createEnvironmentInjector calls in tests (#46633)
This commit updates the `createEnvironmentInjector` calls in standalone components tests, so that an injector is wired to the DI hierarchy and the code doesn't fall back to using a Renderer3.

PR Close #46633
2022-06-29 14:30:19 -07:00
Pawel Kozlowski a183a2df50 test(core): remove enableRenderer3 and Renderer3 from tests (#46612)
Remove calls to enableRenderer3 in the functional unit tests.
This effectivelly cuts code paths going through the Renderer3
in the functional tests.

PR Close #46612
2022-06-29 11:18:22 -07:00
Andrew Kushnir cee8181e1a refactor(core): remove no longer needed utils (#46571)
This commit removes a file that contained utils (including `TemplateFixture`) that are no longer used.

PR Close #46571
2022-06-29 10:01:36 -07:00
Andrew Kushnir d716ff8e87 test(core): update various tests to avoid referencing TemplateFixture (#46571)
This commit updates the remaining set of tests to avoid referencing `TemplateFixture` class.

PR Close #46571
2022-06-29 10:01:36 -07:00
Andrew Kushnir b9049f5c41 test(core): avoid TemplateFixture usages in LViewDebug spec (#46571)
This commit further reduces the use of an obsolete `TemplateFixture` class.

PR Close #46571
2022-06-29 10:01:36 -07:00
Andrew Kushnir 07a7b721be test(core): avoid TemplateFixture usages in i18n spec (#46571)
This commit further reduces the use of an obsolete `TemplateFixture` class.

PR Close #46571
2022-06-29 10:01:36 -07:00
Andrew Kushnir 5442aad62b test(core): move Pipe-related tests to the acceptance folder (#46571)
This commit refactors a  Pipe-related test to use TestBed and moves it to the `acceptance` folder.

PR Close #46571
2022-06-29 10:01:36 -07:00
Alan Agius 72976c7a28 test: update golden symbols (#46582)
This is causing CI to fail

PR Close #46582
2022-06-29 00:53:52 -07:00
Alex Rickabaugh 0a36ee70fc test(core): convert remaining bundling tests to not use renderComponent (#46559)
This commit converts the remaining bundling tests which were using
`renderComponent` to use regular bootstrapping instead.

Since `renderComponent` is synchronous and regular bootstrapping is not,
some test adjustments were necessary to wait for bootstrapping before test
assertions could run.

Additionally, debug servers were adjusted in some cases where they'd broken
(likely some time ago).

PR Close #46559
2022-06-28 21:37:46 -07:00
Alex Rickabaugh 290ccc36c7 test(core): add symbol tests back to todo, hello_world bundling tests (#46559)
The deleted r3 versions of these tests had symbol tests, but their r2
equivalents did not. This commit adds symbol tests to the r2 variants.

PR Close #46559
2022-06-28 21:37:46 -07:00
Alex Rickabaugh 5e4be235ca test(core): rename r2-based hello_world and todo bundling tests (#46559)
In the previous commit, the r3-based hello_world and todo tests were deleted
in favor of the r2 versions. This commit renames the r2 versions to drop the
r2 suffix.

PR Close #46559
2022-06-28 21:37:46 -07:00
Alex Rickabaugh 5b84168ee8 test(core): remove redundant renderComponent-based bundling tests (#46559)
The `hello_world` and `todo` bundling tests use the experimental
`renderComponent` function (and `Renderer3`) as a result, and have
corresponding `Renderer2` equivalents. This commit removes these tests in
favor of the `Renderer2` versions, which will be renamed in a future commit.

PR Close #46559
2022-06-28 21:37:46 -07:00
Andrew Kushnir a2171c11e4 refactor(core): remove no longer used helper methods in the renderer3 folder (#46561)
This commit updates the `render_util.ts` file to drop no longer needed helpers.

PR Close #46561
2022-06-28 21:28:22 -07:00
Andrew Kushnir 86bd3b38b7 test(core): refactor tests to use TestBed instead of hand-written instructions (#46561)
This commit updates various tests to use TestBed instead of hand-written instructions, which makes tests easier to maintain and allows to perform further cleanup.

PR Close #46561
2022-06-28 21:28:22 -07:00
Andrew Kushnir 1e7f22f00a fix(core): trigger ApplicationRef.destroy when Platform is destroyed (#46497)
This commit updates the `ApplicationRef` logic to trigger the destroy operation when an underlying platform is destroyed. This is needed to make sure all teardown processing is completed correctly to avoid memory leaks.

Closes #46473.

PR Close #46497
2022-06-28 13:02:56 -07:00
Dylan Hunn 747872212d fix(forms): Update a Forms validator error to use RuntimeError (#46537)
Replace `new Error()` in a forms Validators function with `RuntimeError`, for better tree-shakability. Also, improve the error messages, and add documentation.

PR Close #46537
2022-06-28 11:32:55 -07:00
Alex Rickabaugh 35f14c6296 refactor(core): disable renderer3 unless explicitly enabled by tests (#46530)
The `Renderer3` abstraction in Angular was an experimental code path in Ivy
which uses direct DOM operations instead of the former `Renderer2` path. To
allow `Renderer2` to tree-shake away, `Renderer3` is the default _unless_
`Renderer2` is provided. It was only an experiment, and never meant to be a
production code path.

However, it's possible for `Renderer3` to leak into user code. This commit
prevents that possibility by causing the `Renderer3` path to throw, unless
an explicit function has been called to enable it.

PR Close #46530
2022-06-28 11:15:55 -07:00
Pawel Kozlowski ac5ca1a0d8 test(core): convert view container TemplateFixture tests to TestBed (#46544)
Convert all ViewContainerRef tests with the hand-written generated
code to TestBed (and use code generated by the JiT compiler).

PR Close #46544
2022-06-28 11:15:02 -07:00
Pawel Kozlowski 3abf4be296 test(core): convert remaining query tests to TestBed (#46549)
This commit moves the remaining hand-written query tests to TestBed.

PR Close #46549
2022-06-28 11:14:33 -07:00
Andrew Kushnir d0d930eb14 test(core): replace hand-written instructions in component tests with TestBed (#46532)
This commit updates a set of misc tests to avoid using hand-written instructions and replace them with TestBed APIs.

PR Close #46532
2022-06-28 09:36:18 -07:00
Pawel Kozlowski 94e93c639b test(core): remove unused common_with_def.ts (#46547)
The common_with_def.ts is not used any more and can be
deleted.

PR Close #46547
2022-06-28 09:35:11 -07:00
Andrew Kushnir e8b967a19a test(core): replace hand-written instructions in ComponentRef tests with TestBed (#46528)
This commit updates a set of ComponentRef tests to avoid using hand-written instructions and replace them with TestBed APIs.

PR Close #46528
2022-06-27 15:46:10 -07:00
Andrew Kushnir fadb4f0b1f test(core): replace hand-written instructions in tests with TestBed APIs (#46525)
This commit updates a set of tests to avoid using hand-written instructions and replace them with TestBed APIs. Some tests were moved to the `acceptance` folder to colocate them with other renderer-related tests.

PR Close #46525
2022-06-27 15:43:10 -07:00
Andrew Kushnir ed3495f1b2 test(core): replace hand-written instructions in change detection tests with TestBed (#46529)
This commit updates a set of change detection tests to avoid using hand-written instructions and replace them with TestBed APIs.

PR Close #46529
2022-06-27 15:42:13 -07:00
Pawel Kozlowski 56eca9538f test(core): convert listener TemplateFixture tests to TestBed (#46517)
Convert some of the query tests (read option) from TemplateFixture
to TestBed.

PR Close #46517
2022-06-27 15:16:11 -07:00
Pawel Kozlowski b522534eaf test(core): remove test for the ViewChildren descendants option (#46517)
Removing the hand-written test for the case that is not supported
(ViewChildren don't support the descendants option).

PR Close #46517
2022-06-27 15:16:11 -07:00
Alex Rickabaugh 50c8158540 test(core): update di_spec.ts to use TestBed (#46522)
di_spec.ts was using handwritten definitions and the `renderComponent`-based
`ComponentFixture` (left over technical debt from the early days of Ivy.

This commit updates it to:

* remove unnecessary tests ("limp mode" DI, Renderer3, etc)
* convert other tests to use JIT-compiled classes and not handwritten defs

PR Close #46522
2022-06-27 15:15:50 -07:00
Alex Rickabaugh 549fc421df test(core): use TestBed & JIT instead of handwritten defs in providers_spec (#46527)
This commit finishes converting providers_spec.ts from `ComponentFixture`
and handwritten definitions to TestBed and JIT-compiled standalone
components.

PR Close #46527
2022-06-27 15:15:00 -07:00
Alex Rickabaugh 54e1c708f9 test(core): convert internal directiveInject calls to inject (#46527)
This commit replaces usage of the internal `directiveInject` instruction
with the public `inject` function, as part of a larger cleanup of
providers_spec.ts.

PR Close #46527
2022-06-27 15:15:00 -07:00
Alex Rickabaugh b8d6ffbc9f test(core): convert providers test utility to TestBed (#46527)
This commit convers the providers_helper utility function
`expectProvidersScenario` to use the TestBed internally instead of
`ComponentFixture` and handwritten defs. This required several adjustments:

* Making the `ngModule`s passed in to the helper utility real NgModules.
* Using `ViewEncapsulation.None` for the test components (stabilizes the
  generated HTML).
* Convert handwritten test components & directives into JIT-compiled
  standalone equivalents.

PR Close #46527
2022-06-27 15:15:00 -07:00
Andrew Scott ca043987c8 refactor(router): separate router initializer into different logical providers (#46481)
This change separates the router initializer into different providers.
While it does not actually change the tree-shakeablity or the public
API, it does move us towards a world that _could_ do this. That is,
instead of `initialNavigation: 'disabled'`, users could use
`provideDisabledInitialNavigation` in the `bootstrapApplication` call
and none of the code for `initialNavigation: 'enabledBlocking'` would be
included in the application.

PR Close #46481
2022-06-27 09:07:13 -07:00
Andrew Scott 464d4133cb refactor(router): Move preloading to tree-shakeable provider (#46481)
Extracting preloading to a provider moves us towards
thinking about a world where `ExtraOptions` doesn't exist to control
behaviors that are opt-in/opt-out. Instead, these behaviors could be
controlled by the presence (or lackthereof) of the providers which has
the functionality. This is relevant to a world in which we no longer
have the `RouterModule` but instead have something like `provideRouter`
where the features are tree-shakeable.

This change _does not_ make the `RouterPreloader` tree-shakeable inside
`RouterModule.forRoot` because the compiler cannot statically determine
whether it's needed. However, in the `provideRouter` world without
`forRoot`, preloading could be exposed through the provider function
instead, making the `RouterPreloader` and `PreloadingStrategy`
implementations tree-shakeable for those that don't use it (which is the
default - no preloading).

PR Close #46481
2022-06-27 09:07:13 -07:00
Pawel Kozlowski 972617fd7e test(core): convert listener TemplateFixture tests to TestBed (#46509)
Converts listeners tests with hand-written generated code to
TestBed fixtures.

PR Close #46509
2022-06-27 09:04:39 -07:00