fix(ivy): support providing components and dirs in tests (#29945)

Previous to this commit, providing a component or directive in a test
module without @Injectable() would throw because the injectable factory
would not be found. Providing components in tests in addition to declaring
or importing them is not necessary, but it should not throw an error.

This commit ensures factory data is saved when component defs and directive
defs are created, which allows them to be processed by the module injector.

Note that bootstrapping is still required for this setup to work because
directiveInject() does not support cases where the view has not been
created. This case will be handled in a future commit.

PR Close #29945
This commit is contained in:
Kara Erickson
2019-04-16 16:58:44 -07:00
committed by Alex Rickabaugh
parent ab6036272c
commit ca2462cff7
7 changed files with 129 additions and 53 deletions

View File

@ -83,6 +83,9 @@
{
"name": "NG_ELEMENT_ID"
},
{
"name": "NG_INJECTABLE_DEF"
},
{
"name": "NG_PIPE_DEF"
},
@ -680,6 +683,9 @@
{
"name": "ɵɵdefineComponent"
},
{
"name": "ɵɵdefineInjectable"
},
{
"name": "ɵɵdefineInjector"
},

View File

@ -71,6 +71,9 @@
{
"name": "NG_ELEMENT_ID"
},
{
"name": "NG_INJECTABLE_DEF"
},
{
"name": "NG_PIPE_DEF"
},
@ -491,6 +494,9 @@
{
"name": "ɵɵdefineComponent"
},
{
"name": "ɵɵdefineInjectable"
},
{
"name": "ɵɵnamespaceHTML"
},