1815 Commits

Author SHA1 Message Date
Ben Lesh
abe4433202 test(ivy): add tests around directive attribute ghosting ()
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 
2019-05-21 09:03:03 -07:00
Ben Lesh
d7eaae6f22 refactor(ivy): Move instructions back to ɵɵ ()
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 
2019-05-20 16:37:47 -07:00
Miško Hevery
6454f76cf6 refactor(ivy): remove ngPrivateData megamorphic prop access ()
PR Close 
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 ()
PR Close 
2019-05-20 10:12:07 -07:00
Paul Gschwendtner
8e2e9dcee6 test(ivy): move render3 view_container_ref tests to acceptance ()
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 
2019-05-17 13:33:22 -07:00
Ben Lesh
01919fbaae test(ivy): Add TODOs ()
PR Close 
2019-05-17 09:56:49 -07:00
Ben Lesh
80d4fc5e26 test(ivy): remove new Component use from inheritance tests ()
PR Close 
2019-05-17 09:56:49 -07:00
Matias Niemelä
f03475cac8 refactor(ivy): evaluate prop-based styling bindings with a new algorithm ()
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 
2019-05-17 09:54:19 -07:00
Kristiyan Kostadinov
1714451a6d test(ivy): move integration tests into acceptance ()
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 
2019-05-16 14:40:47 -07:00
crisbeto
1f6fcb6cd3 fix(ivy): unable to bind SafeValue to clip-path ()
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 
2019-05-16 14:40:21 -07:00
Ben Lesh
60235b5aef test(ivy): add additional lifecycle hook acceptance tests ()
Moves additional lifecycle hook tests from render3 to acceptance

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

PR Close 
2019-05-16 14:39:22 -07:00
Ben Lesh
222dde129d test(ivy): add onDestroy acceptance tests ()
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 
2019-05-16 14:39:22 -07:00
Ben Lesh
257e9646d0 test(ivy): add afterViewInit acceptance tests ()
Migrates afterViewInit and afterViewChecked render3 tests to acceptance tests

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

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

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

PR Close 
2019-05-16 14:39:21 -07:00
Pawel Kozlowski
07ebe9624f docs(ivy): document rules for the global state access ()
PR Close 
2019-05-16 14:38:46 -07:00
Filipe Silva
ac34a1429b refactor: remove toplevel property accesses ()
PR Close 
2019-05-16 12:08:49 -07:00
Ben Lesh
3f7e823b80 test(ivy): add exhaustive inheritance tests ()
- 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 
2019-05-16 11:45:17 -07:00
Kara Erickson
c62c5e2999 fix(ivy): do not throw if host style is on a template node ()
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 
2019-05-16 09:42:34 -07:00
Olivier Combe
f2ae452f01 perf(ivy): don't relink the whole tree when TNode exists ()
PR Close 
2019-05-16 09:42:01 -07:00
Paul Gschwendtner
45e11915dc test(ivy): move render3 query tests to acceptance ()
Moves all manual render3 query tests that use the `elementProperty`
instructions to TestBed acceptance tests.

PR Close 
2019-05-15 14:11:38 -07:00
Pete Bacon Darwin
1a0e500eea fix(ivy): support sub-class services that only inherit @Injectable ()
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 
2019-05-15 14:10:33 -07:00
Ben Lesh
35c1750fcc test(ivy): port TemplateRef tests over to acceptance tests ()
- 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 
2019-05-15 14:10:18 -07:00
Ben Lesh
4f9b16783b refactor(ivy): deprecate ɵɵinject and ɵɵdefineInjectable ()
- They are to be removed before the end of RC

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

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

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

PR Close 
2019-05-14 14:49:39 -07:00
Paul Gschwendtner
9e5377a2e3 refactor(core): improve messages for static-query migrations ()
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 
2019-05-14 14:04:44 -07:00
Paul Gschwendtner
0cdf5980e2 fix(core): static-query migration should not fallback to test strategy ()
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 
2019-05-14 14:04:43 -07:00
Paul Gschwendtner
6ceb9034dc fix(core): static-query migration errors not printed properly ()
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 
2019-05-14 14:04:43 -07:00
cexbrayat
1b059e595f test(ivy): move common integration tests to acceptance ()
PR Close 
2019-05-14 11:37:50 -07:00
Alex Eagle
06efc340b6 build: update rules_nodejs and clean up bazel warnings ()
Preserve compatibility with rollup_bundle rule.
Add missing npm dependencies, which are now enforced by the strict_deps plugin in tsc_wrapped

PR Close 
2019-05-14 10:08:45 -07:00
Kristiyan Kostadinov
cc2f175617 test(ivy): move discovery_utils tests to acceptance ()
Rewrites the discovery util tests to use `TestBed`.

PR Close 
2019-05-14 09:55:17 -07:00
Kristiyan Kostadinov
96baff3a85 test(ivy): move change detection tests into acceptance ()
Moves most of the r3 change detection tests into `acceptance`. Notes:
* A handful of tests weren't migrated, because they were testing an API that isn't exposed publicly yet.
* The `should throw if bindings in children of current view have changed` and `should NOT throw if bindings in ancestors of current view have changed` tests were removed, because there's not nice way of hitting the same code path with `TestBed` and doing the same assertion as with the raw instructions. I'm open to ideas on how we could do them.
* There were a few tests that assert that the `innerHTML` looks in a particular way. I've switched them to use `textContent`, because Ivy and ViewEngine produce slightly different DOM. The tests were only checking whether the text has changed anyway.

PR Close 
2019-05-14 09:54:45 -07:00
Paul Gschwendtner
090eac068a test(ivy): move property render3 tests to acceptance ()
Moves all manual render3 property binding tests to
TestBed acceptance tests. Unfortunately three property
binding tests could not be migrated as these rely on
manual Ivy template code that is not supported within
TestBed. These can be revisited as discussed in the
framework team meeting.

PR Close 
2019-05-14 09:39:22 -07:00
Paul Gschwendtner
d09d8e0adf test(ivy): move render3 directive tests to acceptance ()
Moves all manual render3 directive tests to TestBed acceptance
tests.

PR Close 
2019-05-14 09:37:01 -07:00
Paul Gschwendtner
a57f3e7bbf test(ivy): move render3 renderer_factory tests to acceptance ()
Moves all manual render3 tests which are located within the
`renderer_factory_spec.ts` file to acceptance tests. A few tests
that use Ivy-specific logic which is not replicable with `TestBed`
remain in the render3 folder (e.g. using `renderTemplate`)

Additionally migrated tests that assert the lifecycles of the
renderer_factory are set to *ivy only* as the lifecycle seems
to be different in Ivy. Tracked with: FW-1320

PR Close 
2019-05-14 09:36:24 -07:00
Kristiyan Kostadinov
f74373f2dd fix(ivy): align NgModule registration timing with ViewEngine ()
Currently in Ivy `NgModule` registration happens when the class is declared, however this is inconsistent with ViewEngine and requires extra generated code. These changes remove the generated code for `registerModuleFactory`, pass the id through to the `ngModuleDef` and do the module registration inside `NgModuleFactory.create`.

This PR resolves FW-1285.

PR Close 
2019-05-13 11:13:25 -07:00
Ben Lesh
7569a2e0d9 test(ivy): pure function acceptance tests ()
- Moves tests related to the pureFunction instructions from render3 to acceptance tests
- Leaves behind one test for in-template javascript that is not supported syntax yet

PR Close 
2019-05-13 10:55:59 -07:00
Olivier Combe
0cf09fc981 test(ivy): use TestBed for render3 i18n tests ()
PR Close 
2019-05-13 10:51:31 -07:00
Kristiyan Kostadinov
cb6dea473f test(ivy): move pipe tests into acceptance ()
Moves over the tests from `pipe_spec` into `acceptance`. Note that the two `WrappedValue` tests haven't been moved over, because impure pipes always throw "changed after checked" errors in `TestBed`. This seems to be consistent with ViewEngine.

PR Close 
2019-05-10 14:35:57 -07:00
JiaLiPassion
5ab809ddf9 build: upgrade zone.js to 0.9.1 ()
Close 30203

resolves the issue that zone-legacy XHR issue

PR Close 
2019-05-10 14:25:56 -07:00
Kristiyan Kostadinov
5fd39283ec test(ivy): move output tests to acceptance ()
Moves most of the tests in `output_spec` into `acceptance`. Note that one test is left in `render3`, because it's testing mixing in custom logic with instructions which we can't replicate using `TestBed`.

PR Close 
2019-05-10 09:27:57 -07:00
Paul Gschwendtner
1f2b39ad7d test(ivy): move content projection tests to acceptance ()
Moves all manual `render3` content projection tests that use
the `ɵɵelementProperty` to acceptance tests. Additionally a
few other content projection tests were moved over to
acceptance. Eventually we'll be able to move all remaining
content projection tests to acceptance.

PR Close 
2019-05-10 09:18:37 -07:00
Olivier Combe
24e172d779 test(ivy): use TestBed for render3 component tests ()
PR Close 
2019-05-10 09:18:19 -07:00
Pete Bacon Darwin
b68850215a refactor(core): clean up support for ES2015 constructor delegation ()
This commit moves the delegated constructor detection to a helper
function and also adds more test coverage.

The original code for this came from https://github.com/angular/angular/pull/24156
thanks to @ts2do.

Closes 
Closes 

// FW-1310

PR Close 
2019-05-10 09:17:20 -07:00
Paul Gschwendtner
8d3365e4fc fix(core): static-query usage migration strategy should detect ambiguous query usage ()
Currently we always just set the timing to `false` if we aren't
able to analyze a given call expression or new expression. e.g.

```ts
ngOnInit() {
  thirdPartyCallSync(() => this.query.doSomething())
}
```

In that case the `thirdPartyCallSync` function comes from the `node_modules`
and is only defined through types while there is no code for the
actual function logic that can be analyzed. This makes it impossible
to tell whether the given call expression actually causes the specified
arrow function to be executed synchronously or not. In order to be able
to make this better, we now peek into the passed arrow function and
check for a synchronous query usage. If so, we set the query timing to
static and mark it as ambiguous. This ensures that the usage strategy is
less "magical" and more correct with third-party code.

Additionally since functions like `setTimeout` are not analyzable but known
to be asynchronous, there is a hard-coded list of known functions which
shouldn't be marked as ambiguous.

Resolves FW-1214. As planned within https://hackmd.io/hPiLWpPlQ4uynC1luIBdfQ

PR Close 
2019-05-09 14:39:06 -07:00
Paul Gschwendtner
8cec8f5584 test(core): update core_all size-tracking golden file ()
Even though we don't run the size-tracking test on CI
right now, we update the golden size map as part of
the size-tracking tool update. The size-map difference
should generally be kept up-to-date to be able to
determine which PRs contribute size to a given file.

PR Close 
2019-05-09 12:55:17 -07:00