Commit Graph

1631 Commits

Author SHA1 Message Date
Ben Lesh 2cdbe9b2ef refactor(ivy): ensure new attribute instructons are available in JIT (#30503)
PR Close #30503
2019-05-22 16:30:29 -07:00
Ben Lesh 7555a46e23 refactor(ivy): add new attribute interpolation instructions (#30503)
PR Close #30503
2019-05-22 16:30:28 -07:00
Ben Lesh 38d7acee4d refactor(ivy): add new ɵɵattribute instruction (#30503)
- adds the ɵɵattribute instruction
- adds compilation handling for Δattribute instruction
- updates tests

PR Close #30503
2019-05-22 16:30:28 -07:00
Ben Lesh 10f48278c2 test(ivy): add attribute interpolation test (#30503)
PR Close #30503
2019-05-22 16:30:28 -07:00
Andrew Kushnir 86c46908d4 fix(ivy): R3TestBed doesn't allow template overrides with an empty string (#30602)
Prior to this change a component was considered unresolved (i.e. having dynamic resources that should be loaded, like external template or stylesheets) even if template override was provided as an empty string (for example, via TestBed.overrideTemplateUsingTestingModule call). This commit fixes the condition that previously treated empty string as an absent template value.

PR Close #30602
2019-05-22 16:25:56 -07:00
Paul Gschwendtner fa6cbb3ffe fix(ivy): ng-container with ViewContainerRef creates two comments (#30611)
With Ivy, injecting a `ViewContainerRef` for a `<ng-container>` element
results in two comments generated in the DOM. One comment as host
element for the `ElementContainer` and one for the generated `LContainer`
which is needed for the created `ViewContainerRef`.

This is problematic as developers expect the same anchor element for
the `LContainer` and the `ElementContainer` in order to be able to move
the host element of `<ng-container>` without leaving the actual
`LContainer` anchor element at the original location.

This worked differently in View Engine and various applications might
depend on the behavior where the `ViewContainerRef` shares the anchor
comment node with the host comment node of the `<ng-container>`. For
example `CdkTable` from `@angular/cdk` moves around the host element of
a `<ng-container>` and also expects embedded views to be inserted next
to the moved `<ng-container>` host element.

See: f8be5329f8/src/cdk/table/table.ts (L999-L1016)

Resolves FW-1341

PR Close #30611
2019-05-22 16:25:22 -07:00
Andrew Kushnir 02523debe5 fix(ivy): handle pipes in i18n attributes properly (#30573)
Prior to this change we processed binding expression (including bindings with pipes) in i18n attributes before we generate update instruction. As a result, slot offsets for pipeBind instructions were calculated incorrectly. Now we perform binding expression processing when we generate "update block" instructions, so offsets are calculated correctly.

PR Close #30573
2019-05-22 16:23:18 -07:00
Paul Gschwendtner f74e0fd825 refactor(core): migrations should parse cli workspace config as json5 (#30582)
Currently we try to parse CLI workspace configurations gracefully by
using the native `JSON.parse()` method. This means that the CLI workspace
configuration needs to follow the strict JSON specification because otherwise
the migrations would not be able to find TypeScript configurations in the CLI
project where JSON5 workspace configurations are supported.

In order to handle such workspace configurations, we leverage the JSON
parsing logicfrom the `@angular-devkit/core` which is also used by the CLI.

PR Close #30582
2019-05-21 17:26:22 -07:00
Pawel Kozlowski 66f269c077 refactor(ivy): rename query-related functions for clarity (#30587)
PR Close #30587
2019-05-21 13:14:15 -07:00
Pawel Kozlowski b613f90146 refactor(ivy): avoid calling query instructions from static query instructions (#30587)
PR Close #30587
2019-05-21 13:14:14 -07:00
Pawel Kozlowski 2fe6f350cb refactor(ivy): avoid repeated read of LView from global state (#30587)
PR Close #30587
2019-05-21 13:14:14 -07:00
Pawel Kozlowski 514ebf402a refactor(ivy): avoid calling other instructions from the loadViewQuery instruction (#30587)
PR Close #30587
2019-05-21 13:14:14 -07:00
cexbrayat f6bf8928f2 fix(core): temporarily remove @deprecated jsdoc tag for a TextBed.get overload (#30514)
PR #29290 introduced a new `TestBed.get` signature and deprecated the existing one.
This raises a lot of TSLint deprecation warnings in projects using a strict TS config (see #29905 for context), so we are temporarily removing the `@deprecated` annotation in favor of a plain text warning until we properly fix it.

Refs #29905
Fixes FW-1336

PR Close #30514
2019-05-21 13:11:21 -07:00
Miško Hevery f3c69e7f6b refactor(ivy): rewrite flatten function to be more memory efficient (#30468)
The `flatten` function used `concat` and `slice` which created a lot of intermediary
object allocations. Because `flatten` is used from query any benchmark which
used query would exhibit high minor GC counts.

PR Close #30468
2019-05-21 13:06:23 -07:00
Kara Erickson a96976e88f fix(core): remove deprecated `TestBed.deprecatedOverrideProvider` API (#30576)
BREAKING CHANGE

In PR #19558, we fixed a bug in `TestBed.overrideProvider` where
eager providers were not being instantiated correctly. However,
it turned out that since this bug had been around for quite a bit,
many apps were relying on the broken behavior where the providers
would not be instantiated. To assist in the transition, the
`TestBed.deprecatedOverrideProvider` method was temporarily
introduced to mimic the old behavior so that apps would have a
longer time period to migrate their code.

2 years and 3 versions later, it is time to remove the temporary
method. This commit removes `TestBed.deprecatedOverrideProvider`
altogether. Any usages of `TestBed.deprecatedOverrideProvider`
should be replaced with `TestBed.overrideProvider`. This may mean
that providers that were not created before will now be instantiated,
which could mean that your tests need to provide more mocks or stubs
for the dependencies of the newly instantiated providers.

PR Close #30576
2019-05-21 12:37:17 -07:00
Miško Hevery df1d3fbd7b perf(ivy): minor cleanup; prevent sparse arrays (#30495)
PR Close #30495
2019-05-21 09:04:39 -07:00
Ben Lesh abe4433202 test(ivy): add tests around directive attribute ghosting (#30544)
This battery of tests is to ensure the instructions we are generating have the same behavior in Ivy has they did in ViewEngine.

PR Close #30544
2019-05-21 09:03:03 -07:00
Ben Lesh d7eaae6f22 refactor(ivy): Move instructions back to ɵɵ (#30546)
There is an encoding issue with using delta `Δ`, where the browser will attempt to detect the file encoding if the character set is not explicitly declared on a `<script/>` tag, and Chrome will find the `Δ` character and decide it is window-1252 encoding, which misinterprets the `Δ` character to be some other character that is not a valid JS identifier character

So back to the frog eyes we go.

```
    __
   /ɵɵ\
  ( -- ) - I am ineffable. I am forever.
 _/    \_
/  \  /  \
==  ==  ==
```

PR Close #30546
2019-05-20 16:37:47 -07:00
Miško Hevery 6454f76cf6 refactor(ivy): remove ngPrivateData megamorphic prop access (#30548)
PR Close #30548
2019-05-20 10:12:07 -07:00
Miško Hevery 28ae22ecb9 refactor(ivy): move `renderTemplate` into render_util.ts because it is only used in tests (#30548)
PR Close #30548
2019-05-20 10:12:07 -07:00
Paul Gschwendtner 8e2e9dcee6 test(ivy): move render3 view_container_ref tests to acceptance (#30488)
Moves all manual render3 view_container_ref tests that use property
bindings to acceptance tests with TestBed.

Two issues surfaced and refer to a difference between Ivy and View
engine:

* Multi-slot projection is not working with Ivy: FW-1331
* ViewContainerRef throws if index is invalid while View Engine clamped index: FW-1330

PR Close #30488
2019-05-17 13:33:22 -07:00
Ben Lesh 01919fbaae test(ivy): Add TODOs (#30522)
PR Close #30522
2019-05-17 09:56:49 -07:00
Ben Lesh 80d4fc5e26 test(ivy): remove `new Component` use from inheritance tests (#30522)
PR Close #30522
2019-05-17 09:56:49 -07:00
Matias Niemelä f03475cac8 refactor(ivy): evaluate prop-based styling bindings with a new algorithm (#30469)
This is the first refactor PR designed to change how styling bindings
(i.e. `[style]` and `[class]`) behave in Ivy. Instead of having a heavy
element-by-element context be generated for each element, this new
refactor aims to use a single context for each `tNode` element that is
examined and iterated over when styling values are to be applied to the
element.

This patch brings this new functionality to prop-based bindings such as
`[style.prop]` and `[class.name]`.

PR Close #30469
2019-05-17 09:54:19 -07:00
Kristiyan Kostadinov 1714451a6d test(ivy): move integration tests into acceptance (#30461)
Moves most of the tests from `render3/integration_spec` into `acceptance`. Note that there are still a handful of tests left in render3, because we don't have a way of moving all of them to go through `TestBed` since they either have r3-specific assertions or we don't have access to the same APIs as the raw instructions.

PR Close #30461
2019-05-16 14:40:47 -07:00
crisbeto 1f6fcb6cd3 fix(ivy): unable to bind SafeValue to clip-path (#30491)
Fixes not being able to pass in a `SafeValue` to a `clip-path` binding, because `clip-path` wasn't in the list of exceptions.

PR Close #30491
2019-05-16 14:40:21 -07:00
Ben Lesh 60235b5aef test(ivy): add additional lifecycle hook acceptance tests (#30445)
Moves additional lifecycle hook tests from render3 to acceptance

PR Close #30445
2019-05-16 14:39:22 -07:00
Ben Lesh d18c58816f test(ivy): add onChanges acceptance tests (#30445)
- moves render3 tests to acceptance tests.

PR Close #30445
2019-05-16 14:39:22 -07:00
Ben Lesh 222dde129d test(ivy): add onDestroy acceptance tests (#30445)
Ports render3 onDestroy tests over to be acceptance tests. Removes old render3 tests if possible.

Note the onlyInIvy test for one area where Ivy has a different behavior than ViewEngine

PR Close #30445
2019-05-16 14:39:22 -07:00
Ben Lesh 257e9646d0 test(ivy): add afterViewInit acceptance tests (#30445)
Migrates afterViewInit and afterViewChecked render3 tests to acceptance tests

PR Close #30445
2019-05-16 14:39:22 -07:00
Ben Lesh a5e06ba629 test(ivy): onAfterContentInit acceptance tests (#30445)
- Ports onAfterContentInit tests from render3 to acceptance tests

PR Close #30445
2019-05-16 14:39:22 -07:00
Ben Lesh 9a6d298ca7 test(ivy): doCheck lifecycle acceptance tests (#30445)
- ports render3 doCheck tests to acceptance tests

PR Close #30445
2019-05-16 14:39:21 -07:00
Ben Lesh 6ec621b72d test(ivy): onInit lifecycle acceptance tests (#30445)
Ports render3 lifecycle onInit tests to acceptance tests

PR Close #30445
2019-05-16 14:39:21 -07:00
Pawel Kozlowski 07ebe9624f docs(ivy): document rules for the global state access (#30485)
PR Close #30485
2019-05-16 14:38:46 -07:00
Filipe Silva ac34a1429b refactor: remove toplevel property accesses (#29329)
PR Close #29329
2019-05-16 12:08:49 -07:00
Ben Lesh 3f7e823b80 test(ivy): add exhaustive inheritance tests (#30442)
- Adds inheritance tests for many combinations of directive, component and bare class inheritance
- Adds tests that are failing in ivy, but should work, marks them with `xit` and a TODO.
- Removes render3 unit tests that cover the same things.

PR Close #30442
2019-05-16 11:45:17 -07:00
Kara Erickson c62c5e2999 fix(ivy): do not throw if host style is on a template node (#30498)
In View Engine, we would simply ignore host style bindings on template nodes. In Ivy,
we are throwing a "Cannot read length of undefined" error instead. For backwards
compatibility, we should also ignore these bindings rather than blowing up.

PR Close #30498
2019-05-16 09:42:34 -07:00
Olivier Combe f2ae452f01 perf(ivy): don't relink the whole tree when `TNode` exists (#30511)
PR Close #30511
2019-05-16 09:42:01 -07:00
Paul Gschwendtner 45e11915dc test(ivy): move render3 query tests to acceptance (#30382)
Moves all manual render3 query tests that use the `elementProperty`
instructions to TestBed acceptance tests.

PR Close #30382
2019-05-15 14:11:38 -07:00
Pete Bacon Darwin 1a0e500eea fix(ivy): support sub-class services that only inherit `@Injectable` (#30388)
In View engine it is possible to instantiate a service that that has no
`@Injectable` decorator as long as it satisfies one of:

1) It has no dependencies and so a constructor with no parameters.
This is already supported in Ivy.
2) It has no constructor of its own and sub-classes a service which has
dependencies but has its own `@Injectable` decorator. This second
scenario was broken in Ivy.

In Ivy, previous to this commit, if a class to be instantiated did not have
its own `@Injectable` decorator and did not provide a constructor of
its own, then it would be created using `new` with no arguments -
i.e. falling back to the first scenario.

After this commit Ivy correctly uses the `ngInjectableDef` inherited
from the super-class to provide the `factory` for instantiating the
sub-class.

FW-1314

PR Close #30388
2019-05-15 14:10:33 -07:00
Ben Lesh 35c1750fcc test(ivy): port TemplateRef tests over to acceptance tests (#30443)
- Moves template ref tests from render3 unit tests to acceptance tests.
- Marks tests testing ivy specific changes as `onlyInIvy`.
- Deletes old render3 unit tests that are no longer necessary

PR Close #30443
2019-05-15 14:10:18 -07:00
Ben Lesh 4f9b16783b refactor(ivy): deprecate ɵɵinject and ɵɵdefineInjectable (#30362)
- They are to be removed before the end of RC

PR Close #30362
2019-05-14 16:52:15 -07:00
Ben Lesh 018a5168a5 refactor(ivy): mark ΔdefineInjectable as codeGenApi. (#30362)
PR Close #30362
2019-05-14 16:52:15 -07:00
Ben Lesh cf86ed7b29 refactor(ivy): migrate ɵɵ prefix back to Δ (#30362)
Now that issues are resolved with Closure compiler, we can move back to our desired prefix of `Δ`.

PR Close #30362
2019-05-14 16:52:15 -07:00
Alex Rickabaugh dbb150a9bd Revert "fix(core): CSS sanitizer now allows parens in file names (#30322)" (#30463)
This reverts commit 728db88280.

We're reverting this commit for now, until it can be subjected to a more
thorough security review.

PR Close #30463
2019-05-14 14:49:39 -07:00
Paul Gschwendtner 9e5377a2e3 refactor(core): improve messages for static-query migrations (#30458)
Slightly improves the messages for the static-query migration in order
to make the terminal output less verbose but more helpful. Unfortunately
we are limited in what we can print due to the devkit not providing much
utilities for printing good messages from a migration schematic.

PR Close #30458
2019-05-14 14:04:44 -07:00
Paul Gschwendtner 0cdf5980e2 fix(core): static-query migration should not fallback to test strategy (#30458)
Currently if something fails in the selected strategy (e.g. AOT failures),
the migration currently accidentally falls back to the test strategy. This
is not helpful as we want to give developers the possibility to re-run
the migration after fixing potential AOT failures.

PR Close #30458
2019-05-14 14:04:43 -07:00
Paul Gschwendtner 6ceb9034dc fix(core): static-query migration errors not printed properly (#30458)
Apparently the devkit logger is not able to properly print
out error objects, so we need to convert them to a string
before in order to make the error visible to the user.

This is not testable without an e2e test that validates the CLI
terminal output.

PR Close #30458
2019-05-14 14:04:43 -07:00
cexbrayat 1b059e595f test(ivy): move common integration tests to acceptance (#30213)
PR Close #30213
2019-05-14 11:37:50 -07:00
Alex Eagle 06efc340b6 build: update rules_nodejs and clean up bazel warnings (#30370)
Preserve compatibility with rollup_bundle rule.
Add missing npm dependencies, which are now enforced by the strict_deps plugin in tsc_wrapped

PR Close #30370
2019-05-14 10:08:45 -07:00