angular-docs-cn/packages/core/test/acceptance
crisbeto 95fc3d4c5c fix(core): ngOnDestroy on multi providers called with incorrect context (#35840)
Currently destroy hooks are stored in memory as `[1, hook, 5, hook]` where
the numbers represent the index at which to find the context and `hook` is
the function to be invoked. This breaks down for `multi` providers,
because the value at the index will be an array of providers, resulting in
the hook being invoked with an array of all the multi provider values,
rather than the provider that was destroyed. In ViewEngine `ngOnDestroy`
wasn't being called for `multi` providers at all.

These changes fix the issue by changing the structure of the destroy hooks to `[1, hook, 5, [0, hook, 3, hook]]` where the indexes inside the inner array point to the provider inside of the multi provider array. Note that this is slightly different from the original design which called for the structure to be `[1, hook, 5, [hook, hook]`, because in the process of implementing it, I realized that we wouldn't get passing the correct context if only some of the `multi` providers have `ngOnDestroy` and others don't.

I've run the newly-added `view_destroy_hooks` benchmark against these changes and compared it to master. The difference seems to be insignificant (between 1% and 2% slower).

Fixes #35231.

PR Close #35840
2020-04-07 10:31:41 -07:00
..
BUILD.bazel build: derive ts_library dep from jasmine_node_test boostrap label if it ends in `_es5` (#34736) 2020-01-15 14:58:07 -05:00
attributes_spec.ts refactor(core): Migrate TestBed.get to TestBed.inject (#32382) 2019-09-09 19:10:54 -04:00
bootstrap_spec.ts fix(core): adhere to bootstrap options for JIT compiled components (#35534) 2020-03-19 08:57:39 -07:00
change_detection_spec.ts refactor(ivy): Switch styling to new reconcile algorithm (#34616) 2020-01-24 12:23:00 -08:00
common_integration_spec.ts test(ivy): move common integration tests to acceptance (#30213) 2019-05-14 11:37:50 -07:00
component_spec.ts fix(ivy): properly bootstrap components with attribute selectors (#34450) 2020-01-14 09:45:24 -08:00
content_spec.ts fix(ivy): Ensure ngProjectAs marker name appears at even attribute index (#34617) 2020-01-07 10:51:46 -08:00
copy_definition_feature_spec.ts feat(ivy): add a runtime feature to copy cmp/dir definitions (#33362) 2019-10-25 09:16:50 -07:00
debug_spec.ts refactor(ivy): migrate debug spec from render3 (#32621) 2019-09-12 11:35:49 -07:00
di_spec.ts fix(ivy): injecting incorrect provider when re-providing injectable with useClass (#34574) 2020-02-26 13:00:21 -08:00
directive_spec.ts fix(compiler): support directive inputs with interpolations on `<ng-template>`s (#35984) 2020-03-16 10:51:18 -07:00
discover_utils_spec.ts docs(ivy): document global debugging utilities and clean up API (#34453) 2020-01-30 11:30:32 -08:00
embedded_views_spec.ts fix(ivy): unable to bind to implicit receiver in embedded views (#30897) 2019-06-11 14:29:42 -07:00
exports_spec.ts refactor(ivy): move exports tests to acceptance (#30157) 2019-04-26 16:37:34 -07:00
host_binding_spec.ts refactor(ivy): clean of #34804 from previous merge (#35022) 2020-01-29 16:35:08 -08:00
i18n_spec.ts fix(compiler): support directive inputs with interpolations on `<ng-template>`s (#35984) 2020-03-16 10:51:18 -07:00
inherit_definition_feature_spec.ts fix(core): make subclass inherit developer-defined data (#35105) 2020-02-19 12:50:48 -08:00
integration_spec.ts feat(ivy): Change static priority resolution to be same level as directive it belongs to (#34938) 2020-01-29 15:41:47 -08:00
lifecycle_spec.ts fix(ivy): do not invoke change detection for destroyed views (#34241) 2019-12-06 13:03:08 -08:00
listener_spec.ts test: clean up explicit dynamic query usages (#33015) 2019-10-17 16:10:10 -04:00
ng_module_spec.ts Revert "fix(core): log error instead of warning for unknown properties and elements (#35798)" (#35845) 2020-03-03 16:02:58 -08:00
ngdevmode_debug_spec.ts test(ivy): Have more descriptive names for `LView` (#33449) 2019-11-07 15:33:50 +00:00
outputs_spec.ts test: clean up explicit dynamic query usages (#33015) 2019-10-17 16:10:10 -04:00
pipe_spec.ts fix(core): don't re-invoke pure pipes that throw and arguments are the same (#35827) 2020-03-10 20:58:07 -04:00
property_binding_spec.ts fix(ivy): error if directive with synthetic property binding is on same node as directive that injects ViewContainerRef (#35343) 2020-02-12 17:14:25 -08:00
property_interpolation_spec.ts refactor: fix typescript strict flag failures in all tests (#30993) 2019-07-18 14:21:26 -07:00
providers_spec.ts fix(core): ngOnDestroy on multi providers called with incorrect context (#35840) 2020-04-07 10:31:41 -07:00
pure_function_spec.ts fix(ivy): incorrectly generating shared pure function between null and object literal (#35481) 2020-02-20 15:23:58 -08:00
query_spec.ts fix(core): allow null / undefined values in query results (#35796) 2020-03-02 11:16:22 -08:00
renderer_factory_spec.ts refactor(ivy): Switch styling to new reconcile algorithm (#34616) 2020-01-24 12:23:00 -08:00
router_integration_spec.ts refactor(core): Migrate TestBed.get to TestBed.inject (#32382) 2019-09-09 19:10:54 -04:00
styling_spec.ts fix(core): treat `[class]` and `[className]` as unrelated bindings (#35668) 2020-03-02 08:18:59 -08:00
template_ref_spec.ts test(ivy): get ViewRef.rootNodes should get all root nodes from projectable nodes (#33647) 2019-11-11 09:37:38 -08:00
text_spec.ts refactor: fix typescript strict flag failures in all tests (#30993) 2019-07-18 14:21:26 -07:00
view_container_ref_spec.ts fix(ivy): add attributes and classes to host elements based on selector (#34481) 2020-02-18 17:18:13 -08:00
view_insertion_spec.ts test(ivy): non-regression test for ViewContainerRef queried on ng-container (#33939) 2019-11-20 14:45:43 -08:00
view_ref_spec.ts test(ivy): fix failing view ref test (#29178) 2019-03-07 18:56:22 -08:00