ng-mocks 13.4.0 → 13.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (289) hide show
  1. package/README.md +1 -1
  2. package/examples/MockBuilder/spec.components.fixtures.ts +4 -4
  3. package/examples/MockBuilder/spec.modules.fixtures.ts +6 -6
  4. package/examples/MockBuilder/test.deep.spec.ts +9 -8
  5. package/examples/MockBuilder/test.ng-mocks.spec.ts +9 -8
  6. package/examples/MockBuilder/test.promise.spec.ts +6 -6
  7. package/examples/MockComponent/test.spec.ts +3 -2
  8. package/examples/MockDirective-Attribute/test.spec.ts +4 -3
  9. package/examples/MockDirective-Structural/test.spec.ts +23 -16
  10. package/examples/MockForms/test.spec.ts +2 -3
  11. package/examples/MockInstance/test.spec.ts +2 -1
  12. package/examples/MockModule/test.spec.ts +5 -4
  13. package/examples/MockObservable/test.spec.ts +3 -2
  14. package/examples/MockPipe/test.spec.ts +25 -9
  15. package/examples/MockProvider/test.spec.ts +1 -0
  16. package/examples/MockReactiveForms/test.spec.ts +3 -4
  17. package/examples/MockRender/test.spec.ts +5 -6
  18. package/examples/MockSanitizer/test.spec.ts +1 -0
  19. package/examples/MockViewChild/test.spec.ts +1 -0
  20. package/examples/TestAttributeDirective/test.spec.ts +3 -2
  21. package/examples/TestDirectiveLetOf/dynamic.spec.ts +1 -0
  22. package/examples/TestDirectiveLetOf/static.spec.ts +1 -0
  23. package/examples/TestHttpInterceptor/test.spec.ts +3 -2
  24. package/examples/TestHttpRequest/test.spec.ts +2 -1
  25. package/examples/TestLazyModule/test.spec.ts +1 -0
  26. package/examples/TestLifecycleHooks/fixtures.ts +1 -1
  27. package/examples/TestLifecycleHooks/test.spec.ts +1 -0
  28. package/examples/TestMultiToken/test.spec.ts +1 -0
  29. package/examples/TestPipe/test.spec.ts +3 -2
  30. package/examples/TestProvider/test.spec.ts +1 -0
  31. package/examples/TestProviderInComponent/test.spec.ts +2 -1
  32. package/examples/TestProviderInDirective/test.spec.ts +3 -2
  33. package/examples/TestProviderWithDependencies/test.spec.ts +1 -0
  34. package/examples/TestProviderWithUseClass/test.spec.ts +1 -0
  35. package/examples/TestProviderWithUseExisting/test.spec.ts +1 -0
  36. package/examples/TestProviderWithUseFactory/test.spec.ts +1 -0
  37. package/examples/TestProviderWithUseValue/test.spec.ts +1 -0
  38. package/examples/TestRoute/test.spec.ts +1 -0
  39. package/examples/TestRoutingGuard/test.spec.ts +5 -4
  40. package/examples/TestRoutingResolver/test.spec.ts +2 -1
  41. package/examples/TestStructuralDirective/test.spec.ts +1 -0
  42. package/examples/TestStructuralDirectiveWithContext/test.spec.ts +1 -0
  43. package/examples/TestTemplateRefByDirective/test.spec.ts +1 -0
  44. package/examples/TestTemplateRefById/test.spec.ts +1 -0
  45. package/examples/TestTemplateRefByRender/test.spec.ts +1 -0
  46. package/examples/TestToken/test.spec.ts +1 -0
  47. package/examples/TestViewChild/test.spec.ts +1 -0
  48. package/examples/main/test.spec.ts +1 -2
  49. package/examples/ngMocksFaster/test.spec.ts +1 -2
  50. package/examples/ngMocksGuts/test.spec.ts +2 -1
  51. package/examples/readme/builder.spec.ts +2 -1
  52. package/examples/readme/classic.spec.ts +2 -3
  53. package/index.js +1 -1
  54. package/index.js.map +1 -1
  55. package/ng-mocks.d.ts +2449 -0
  56. package/package.json +13 -7
  57. package/index.d.ts +0 -37
  58. package/lib/common/core.config.d.ts +0 -10
  59. package/lib/common/core.define-property.d.ts +0 -2
  60. package/lib/common/core.form.d.ts +0 -12
  61. package/lib/common/core.helpers.d.ts +0 -12
  62. package/lib/common/core.injector.d.ts +0 -3
  63. package/lib/common/core.reflect.body-catch.d.ts +0 -2
  64. package/lib/common/core.reflect.directive-resolve.d.ts +0 -3
  65. package/lib/common/core.reflect.jit.d.ts +0 -3
  66. package/lib/common/core.reflect.meta.d.ts +0 -2
  67. package/lib/common/core.reflect.module-resolve.d.ts +0 -3
  68. package/lib/common/core.reflect.pipe-resolve.d.ts +0 -3
  69. package/lib/common/core.reflect.provided-in.d.ts +0 -3
  70. package/lib/common/core.tokens.d.ts +0 -9
  71. package/lib/common/core.types.d.ts +0 -10
  72. package/lib/common/decorate.inputs.d.ts +0 -2
  73. package/lib/common/decorate.mock.d.ts +0 -3
  74. package/lib/common/decorate.outputs.d.ts +0 -2
  75. package/lib/common/decorate.queries.d.ts +0 -5
  76. package/lib/common/error.empty-def.d.ts +0 -2
  77. package/lib/common/error.jest-mock.d.ts +0 -2
  78. package/lib/common/error.missing-decorators.d.ts +0 -2
  79. package/lib/common/func.get-global.d.ts +0 -2
  80. package/lib/common/func.get-mocked-ng-def-of.d.ts +0 -35
  81. package/lib/common/func.get-name.d.ts +0 -2
  82. package/lib/common/func.get-provider.d.ts +0 -2
  83. package/lib/common/func.get-source-of-mock.d.ts +0 -35
  84. package/lib/common/func.import-exists.d.ts +0 -2
  85. package/lib/common/func.is-jest-mock.d.ts +0 -2
  86. package/lib/common/func.is-mock-control-value-accessor.d.ts +0 -5
  87. package/lib/common/func.is-mock-ng-def.d.ts +0 -10
  88. package/lib/common/func.is-mock-of.d.ts +0 -36
  89. package/lib/common/func.is-mock-validator.d.ts +0 -5
  90. package/lib/common/func.is-mock.d.ts +0 -8
  91. package/lib/common/func.is-mocked-ng-def-of.d.ts +0 -36
  92. package/lib/common/func.is-ng-def.d.ts +0 -44
  93. package/lib/common/func.is-ng-injection-token.d.ts +0 -7
  94. package/lib/common/func.is-ng-module-def-with-providers.d.ts +0 -7
  95. package/lib/common/func.is-ng-type.d.ts +0 -2
  96. package/lib/common/jit-reflector.d.ts +0 -15
  97. package/lib/common/mock-control-value-accessor-proxy.d.ts +0 -26
  98. package/lib/common/mock-control-value-accessor.d.ts +0 -45
  99. package/lib/common/mock.d.ts +0 -20
  100. package/lib/common/ng-mocks-global-overrides.d.ts +0 -1
  101. package/lib/common/ng-mocks-stack.d.ts +0 -16
  102. package/lib/common/ng-mocks-universe.d.ts +0 -25
  103. package/lib/mock/clone-providers.d.ts +0 -7
  104. package/lib/mock/decorate-declaration.d.ts +0 -12
  105. package/lib/mock/get-mock.d.ts +0 -2
  106. package/lib/mock/to-existing-provider.d.ts +0 -6
  107. package/lib/mock/to-factory-provider.d.ts +0 -7
  108. package/lib/mock-builder/func.extract-tokens.d.ts +0 -8
  109. package/lib/mock-builder/mock-builder-stash.d.ts +0 -5
  110. package/lib/mock-builder/mock-builder.d.ts +0 -9
  111. package/lib/mock-builder/mock-builder.performance.d.ts +0 -9
  112. package/lib/mock-builder/mock-builder.promise.d.ts +0 -36
  113. package/lib/mock-builder/performance/are-equal-config-params.d.ts +0 -2
  114. package/lib/mock-builder/performance/are-equal-maps.d.ts +0 -2
  115. package/lib/mock-builder/performance/are-equal-providers.d.ts +0 -2
  116. package/lib/mock-builder/performance/are-equal-sets.d.ts +0 -2
  117. package/lib/mock-builder/performance/equal-render-configs.d.ts +0 -2
  118. package/lib/mock-builder/performance/equal-render-defs.d.ts +0 -2
  119. package/lib/mock-builder/performance/equal-variables.d.ts +0 -2
  120. package/lib/mock-builder/performance/get-empty-config.d.ts +0 -12
  121. package/lib/mock-builder/performance/required-metadata.d.ts +0 -7
  122. package/lib/mock-builder/promise/add-def-to-root-provider-parameters.d.ts +0 -3
  123. package/lib/mock-builder/promise/add-missing-definition.d.ts +0 -2
  124. package/lib/mock-builder/promise/add-missing-keep-declarations-and-modules.d.ts +0 -3
  125. package/lib/mock-builder/promise/add-missing-mock-declarations-and-modules.d.ts +0 -3
  126. package/lib/mock-builder/promise/add-requested-providers.d.ts +0 -3
  127. package/lib/mock-builder/promise/apply-platform-modules.d.ts +0 -2
  128. package/lib/mock-builder/promise/check-root-provider-dependency.d.ts +0 -2
  129. package/lib/mock-builder/promise/create-ng-mocks-overrides-token.d.ts +0 -3
  130. package/lib/mock-builder/promise/create-ng-mocks-token.d.ts +0 -3
  131. package/lib/mock-builder/promise/create-ng-mocks-touches-token.d.ts +0 -3
  132. package/lib/mock-builder/promise/detect-wrong-declarations.d.ts +0 -3
  133. package/lib/mock-builder/promise/extract-dep.d.ts +0 -2
  134. package/lib/mock-builder/promise/get-override-def.d.ts +0 -3
  135. package/lib/mock-builder/promise/get-root-provider-parameters.d.ts +0 -3
  136. package/lib/mock-builder/promise/get-root-providers-data.d.ts +0 -5
  137. package/lib/mock-builder/promise/handle-entry-components.d.ts +0 -3
  138. package/lib/mock-builder/promise/handle-provided-in-dependency.d.ts +0 -2
  139. package/lib/mock-builder/promise/handle-root-providers.d.ts +0 -3
  140. package/lib/mock-builder/promise/init-exclude-def.d.ts +0 -2
  141. package/lib/mock-builder/promise/init-keep-def.d.ts +0 -2
  142. package/lib/mock-builder/promise/init-mock-declarations.d.ts +0 -2
  143. package/lib/mock-builder/promise/init-module.d.ts +0 -5
  144. package/lib/mock-builder/promise/init-modules.d.ts +0 -2
  145. package/lib/mock-builder/promise/init-ng-modules.d.ts +0 -3
  146. package/lib/mock-builder/promise/init-replace-def.d.ts +0 -2
  147. package/lib/mock-builder/promise/init-universe.d.ts +0 -3
  148. package/lib/mock-builder/promise/parse-mock-arguments.d.ts +0 -5
  149. package/lib/mock-builder/promise/parse-provider.d.ts +0 -5
  150. package/lib/mock-builder/promise/skip-dep.d.ts +0 -2
  151. package/lib/mock-builder/promise/skip-init-module.d.ts +0 -3
  152. package/lib/mock-builder/promise/skip-override.d.ts +0 -3
  153. package/lib/mock-builder/promise/skip-root-provider-dependency.d.ts +0 -2
  154. package/lib/mock-builder/promise/try-mock-declaration.d.ts +0 -2
  155. package/lib/mock-builder/promise/try-mock-provider.d.ts +0 -2
  156. package/lib/mock-builder/promise/types.d.ts +0 -18
  157. package/lib/mock-builder/types.d.ts +0 -96
  158. package/lib/mock-component/mock-component.d.ts +0 -7
  159. package/lib/mock-component/render/generate-template.d.ts +0 -2
  160. package/lib/mock-component/render/get-key.d.ts +0 -2
  161. package/lib/mock-component/types.d.ts +0 -12
  162. package/lib/mock-declaration/mock-declaration.d.ts +0 -6
  163. package/lib/mock-directive/mock-directive.d.ts +0 -7
  164. package/lib/mock-directive/types.d.ts +0 -32
  165. package/lib/mock-helper/crawl/crawl-by-attribute-value.d.ts +0 -3
  166. package/lib/mock-helper/crawl/crawl-by-attribute.d.ts +0 -3
  167. package/lib/mock-helper/crawl/crawl-by-declaration.d.ts +0 -4
  168. package/lib/mock-helper/crawl/crawl-by-id.d.ts +0 -3
  169. package/lib/mock-helper/crawl/crawl-by-tag-name.d.ts +0 -3
  170. package/lib/mock-helper/crawl/detect-attribute-in-selectors.d.ts +0 -2
  171. package/lib/mock-helper/crawl/detect-crawler.d.ts +0 -5
  172. package/lib/mock-helper/crawl/detect-selectors-from-node.d.ts +0 -3
  173. package/lib/mock-helper/crawl/detect-tag-name-in-selectors.d.ts +0 -2
  174. package/lib/mock-helper/crawl/detect-text-node.d.ts +0 -3
  175. package/lib/mock-helper/crawl/el-def-compare.d.ts +0 -2
  176. package/lib/mock-helper/crawl/el-def-get-node.d.ts +0 -2
  177. package/lib/mock-helper/crawl/el-def-get-parent.d.ts +0 -2
  178. package/lib/mock-helper/crawl/func.get-public-provider-keys.d.ts +0 -3
  179. package/lib/mock-helper/crawl/func.is-valid-reveal-selector.d.ts +0 -2
  180. package/lib/mock-helper/crawl/func.parse-inputs-and-requires-attributes.d.ts +0 -3
  181. package/lib/mock-helper/crawl/mock-helper.crawl.d.ts +0 -4
  182. package/lib/mock-helper/crawl/mock-helper.reveal-all.d.ts +0 -2
  183. package/lib/mock-helper/crawl/mock-helper.reveal.d.ts +0 -2
  184. package/lib/mock-helper/crawl/nested-check-children.d.ts +0 -3
  185. package/lib/mock-helper/crawl/nested-check.d.ts +0 -3
  186. package/lib/mock-helper/cva/func.get-vca.d.ts +0 -3
  187. package/lib/mock-helper/cva/mock-helper.change.d.ts +0 -3
  188. package/lib/mock-helper/cva/mock-helper.touch.d.ts +0 -4
  189. package/lib/mock-helper/events/mock-helper.click.d.ts +0 -3
  190. package/lib/mock-helper/events/mock-helper.event.d.ts +0 -2
  191. package/lib/mock-helper/events/mock-helper.trigger.d.ts +0 -5
  192. package/lib/mock-helper/find/func.parse-find-args.d.ts +0 -2
  193. package/lib/mock-helper/find/func.parse-find-term.d.ts +0 -4
  194. package/lib/mock-helper/find/mock-helper.find-all.d.ts +0 -3
  195. package/lib/mock-helper/find/mock-helper.find.d.ts +0 -3
  196. package/lib/mock-helper/find-instance/func.is-valid-find-instance-selector.d.ts +0 -2
  197. package/lib/mock-helper/find-instance/mock-helper.find-instance.d.ts +0 -2
  198. package/lib/mock-helper/find-instance/mock-helper.find-instances.d.ts +0 -2
  199. package/lib/mock-helper/format/format-handler.d.ts +0 -2
  200. package/lib/mock-helper/format/handle-array.d.ts +0 -2
  201. package/lib/mock-helper/format/handle-text.d.ts +0 -2
  202. package/lib/mock-helper/format/is-debug-node.d.ts +0 -3
  203. package/lib/mock-helper/format/is-fixture.d.ts +0 -5
  204. package/lib/mock-helper/format/is-html-element.d.ts +0 -2
  205. package/lib/mock-helper/format/is-text.d.ts +0 -2
  206. package/lib/mock-helper/format/mock-helper.format-html.d.ts +0 -2
  207. package/lib/mock-helper/format/mock-helper.format-text.d.ts +0 -2
  208. package/lib/mock-helper/format/types.d.ts +0 -14
  209. package/lib/mock-helper/func.get-from-node-element.d.ts +0 -3
  210. package/lib/mock-helper/func.get-from-node-injector.d.ts +0 -5
  211. package/lib/mock-helper/func.get-from-node-ivy.d.ts +0 -5
  212. package/lib/mock-helper/func.get-from-node-scan.d.ts +0 -10
  213. package/lib/mock-helper/func.get-from-node-standard.d.ts +0 -5
  214. package/lib/mock-helper/func.get-from-node.d.ts +0 -24
  215. package/lib/mock-helper/func.get-last-fixture.d.ts +0 -3
  216. package/lib/mock-helper/func.global-prepare.d.ts +0 -2
  217. package/lib/mock-helper/func.parse-find-args-name.d.ts +0 -3
  218. package/lib/mock-helper/func.parse-find-args.d.ts +0 -2
  219. package/lib/mock-helper/func.parse-provider-tokens-directives.d.ts +0 -3
  220. package/lib/mock-helper/mock-helper.attributes.d.ts +0 -2
  221. package/lib/mock-helper/mock-helper.auto-spy.d.ts +0 -4
  222. package/lib/mock-helper/mock-helper.console-ignore.d.ts +0 -2
  223. package/lib/mock-helper/mock-helper.console-throw.d.ts +0 -2
  224. package/lib/mock-helper/mock-helper.console.d.ts +0 -2
  225. package/lib/mock-helper/mock-helper.d.ts +0 -342
  226. package/lib/mock-helper/mock-helper.default-config.d.ts +0 -5
  227. package/lib/mock-helper/mock-helper.default-mock.d.ts +0 -4
  228. package/lib/mock-helper/mock-helper.faster-install.d.ts +0 -6
  229. package/lib/mock-helper/mock-helper.faster.d.ts +0 -2
  230. package/lib/mock-helper/mock-helper.flush-test-bed.d.ts +0 -2
  231. package/lib/mock-helper/mock-helper.get.d.ts +0 -2
  232. package/lib/mock-helper/mock-helper.global-exclude.d.ts +0 -4
  233. package/lib/mock-helper/mock-helper.global-keep.d.ts +0 -4
  234. package/lib/mock-helper/mock-helper.global-mock.d.ts +0 -4
  235. package/lib/mock-helper/mock-helper.global-replace.d.ts +0 -3
  236. package/lib/mock-helper/mock-helper.global-wipe.d.ts +0 -4
  237. package/lib/mock-helper/mock-helper.guts.d.ts +0 -3
  238. package/lib/mock-helper/mock-helper.input.d.ts +0 -2
  239. package/lib/mock-helper/mock-helper.object.d.ts +0 -47
  240. package/lib/mock-helper/mock-helper.output.d.ts +0 -2
  241. package/lib/mock-helper/mock-helper.reset.d.ts +0 -2
  242. package/lib/mock-helper/mock-helper.stub-member.d.ts +0 -4
  243. package/lib/mock-helper/mock-helper.stub.d.ts +0 -3
  244. package/lib/mock-helper/render/func.find-deep.d.ts +0 -3
  245. package/lib/mock-helper/render/func.parse-template.d.ts +0 -3
  246. package/lib/mock-helper/render/mock-helper.hide.d.ts +0 -2
  247. package/lib/mock-helper/render/mock-helper.render.d.ts +0 -2
  248. package/lib/mock-helper/template-ref/detect-crawler.d.ts +0 -3
  249. package/lib/mock-helper/template-ref/detect-template-ref.d.ts +0 -4
  250. package/lib/mock-helper/template-ref/func.is-valid-template-ref-selector.d.ts +0 -2
  251. package/lib/mock-helper/template-ref/mock-helper.find-template-ref.d.ts +0 -2
  252. package/lib/mock-helper/template-ref/mock-helper.find-template-refs.d.ts +0 -3
  253. package/lib/mock-instance/mock-instance-apply.d.ts +0 -2
  254. package/lib/mock-instance/mock-instance-forgot-reset.d.ts +0 -2
  255. package/lib/mock-instance/mock-instance.d.ts +0 -61
  256. package/lib/mock-module/create-resolvers.d.ts +0 -6
  257. package/lib/mock-module/mark-providers.d.ts +0 -2
  258. package/lib/mock-module/mock-module.d.ts +0 -10
  259. package/lib/mock-module/mock-ng-def.d.ts +0 -4
  260. package/lib/mock-module/types.d.ts +0 -2
  261. package/lib/mock-pipe/mock-pipe.d.ts +0 -11
  262. package/lib/mock-pipe/types.d.ts +0 -2
  263. package/lib/mock-provider/mock-provider.d.ts +0 -15
  264. package/lib/mock-render/func.create-wrapper.d.ts +0 -4
  265. package/lib/mock-render/func.generate-template.d.ts +0 -2
  266. package/lib/mock-render/func.install-prop-reader.d.ts +0 -2
  267. package/lib/mock-render/func.reflect-template.d.ts +0 -4
  268. package/lib/mock-render/mock-render-factory.d.ts +0 -48
  269. package/lib/mock-render/mock-render.d.ts +0 -53
  270. package/lib/mock-render/types.d.ts +0 -23
  271. package/lib/mock-service/check.is-class.d.ts +0 -2
  272. package/lib/mock-service/check.is-func.d.ts +0 -2
  273. package/lib/mock-service/check.is-inst.d.ts +0 -2
  274. package/lib/mock-service/helper.create-clone.d.ts +0 -2
  275. package/lib/mock-service/helper.create-mock-from-prototype.d.ts +0 -5
  276. package/lib/mock-service/helper.define-property-descriptor.d.ts +0 -2
  277. package/lib/mock-service/helper.extract-methods-from-prototype.d.ts +0 -2
  278. package/lib/mock-service/helper.extract-properties-from-prototype.d.ts +0 -2
  279. package/lib/mock-service/helper.extract-property-descriptor.d.ts +0 -2
  280. package/lib/mock-service/helper.mock-function.d.ts +0 -6
  281. package/lib/mock-service/helper.mock-service.d.ts +0 -28
  282. package/lib/mock-service/helper.mock.d.ts +0 -3
  283. package/lib/mock-service/helper.replace-with-mocks.d.ts +0 -2
  284. package/lib/mock-service/helper.resolve-provider.d.ts +0 -2
  285. package/lib/mock-service/helper.use-factory.d.ts +0 -3
  286. package/lib/mock-service/mock-provider.d.ts +0 -2
  287. package/lib/mock-service/mock-service.d.ts +0 -17
  288. package/lib/mock-service/types.d.ts +0 -2
  289. package/lib/resolve/collect-declarations.d.ts +0 -2
package/ng-mocks.d.ts ADDED
@@ -0,0 +1,2449 @@
1
+ import { ChangeDetectorRef, DebugElement, DebugNode, ElementRef, EventEmitter, FactoryProvider, InjectionToken, Injector, PipeTransform, Provider, TemplateRef, ViewContainerRef } from '@angular/core';
2
+ import { ComponentFixture, MetadataOverride, TestBed, TestModuleMetadata } from '@angular/core/testing';
3
+
4
+ interface AbstractType<T> extends Function {
5
+ prototype: T;
6
+ }
7
+ interface Type<T> extends Function {
8
+ new (...args: any[]): T;
9
+ }
10
+ declare type AnyType<T> = Type<T> | AbstractType<T>;
11
+ declare type DebugNodeSelector = DebugNode | ComponentFixture<any> | string | [
12
+ string
13
+ ] | [
14
+ string,
15
+ string | number
16
+ ] | null | undefined;
17
+ /**
18
+ * NG_MOCKS token is a map from a declaration to its mock copy.
19
+ *
20
+ * @internal
21
+ *
22
+ * ```ts
23
+ * const MockClass = TestBed.inject(NG_MOCKS).get(RealClass);
24
+ * ```
25
+ */
26
+ export declare const NG_MOCKS: InjectionToken<Map<any, any>>;
27
+ /**
28
+ * NG_MOCKS_TOUCHES token is a set of all touched declarations during mock process.
29
+ *
30
+ * @internal
31
+ *
32
+ * ```ts
33
+ * const touched = TestBed.inject(NG_MOCKS_TOUCHES).has(RealClass);
34
+ * ```
35
+ */
36
+ export declare const NG_MOCKS_TOUCHES: InjectionToken<Set<any>>;
37
+ /**
38
+ * NG_MOCKS_OVERRIDES token contains overrides for:
39
+ * - TestBed.overrideModule
40
+ * - TestBed.overrideComponent
41
+ * - TestBed.overrideDirective
42
+ * - TestBed.overrideProvider
43
+ *
44
+ * It is used when there is no way to provide a mock copy and an override is required.
45
+ * For example, if we want to keep a component, but to override one of its local providers.
46
+ *
47
+ * @internal
48
+ */
49
+ export declare const NG_MOCKS_OVERRIDES: InjectionToken<Map<AnyType<any>, MetadataOverride<any>>>;
50
+ /**
51
+ * NG_MOCKS_GUARDS token influences on provided guards in MockBuilder.
52
+ * More info by the links below.
53
+ *
54
+ * @see https://ng-mocks.sudo.eu/api/MockBuilder#ng_mocks_guards-token
55
+ * @see https://ng-mocks.sudo.eu/guides/routing-guard
56
+ */
57
+ export declare const NG_MOCKS_GUARDS: InjectionToken<void>;
58
+ /**
59
+ * NG_MOCKS_INTERCEPTORS token influences on provided interceptors in MockBuilder.
60
+ * More info by the links below.
61
+ *
62
+ * @see https://ng-mocks.sudo.eu/api/MockBuilder#ng_mocks_interceptors-token
63
+ * @see https://ng-mocks.sudo.eu/guides/http-interceptor
64
+ */
65
+ export declare const NG_MOCKS_INTERCEPTORS: InjectionToken<void>;
66
+ /**
67
+ * NG_MOCKS_ROOT_PROVIDERS token influences on root providers in MockBuilder,
68
+ * which aren't provided in specified modules.
69
+ * It helps to mock or keep them automatically.
70
+ *
71
+ * @see https://ng-mocks.sudo.eu/api/MockBuilder#ng_mocks_root_providers-token
72
+ */
73
+ export declare const NG_MOCKS_ROOT_PROVIDERS: InjectionToken<void>;
74
+ /**
75
+ * It will be removed from public interface with the next release: A14
76
+ *
77
+ * @deprecated
78
+ * @internal
79
+ */
80
+ export declare const getTestBedInjection: <I>(token: AnyType<I> | InjectionToken<I>) => I | undefined;
81
+ /**
82
+ * It will be removed from public interface with the next release: A14
83
+ *
84
+ * @deprecated
85
+ * @internal
86
+ */
87
+ export declare const getInjection: <I>(token: Type<I> | InjectionToken<I>) => I;
88
+ /**
89
+ * The interface describes the type of the next value in MockBuilder().then().
90
+ */
91
+ export interface IMockBuilderResult {
92
+ testBed: typeof TestBed;
93
+ }
94
+ /**
95
+ * The interface with flags which are suitable for each declaration in MockBuilder chain functions.
96
+ *
97
+ * @see https://ng-mocks.sudo.eu/api/MockBuilder#config
98
+ */
99
+ export interface IMockBuilderConfigAll {
100
+ /**
101
+ * @see https://ng-mocks.sudo.eu/api/MockBuilder#dependency-flag
102
+ */
103
+ dependency?: boolean;
104
+ /**
105
+ * @see https://ng-mocks.sudo.eu/api/MockBuilder#export-flag
106
+ */
107
+ export?: boolean;
108
+ }
109
+ /**
110
+ * The interface with flags which are suitable for modules in MockBuilder chain functions.
111
+ *
112
+ * @see https://ng-mocks.sudo.eu/api/MockBuilder#config
113
+ */
114
+ export interface IMockBuilderConfigModule {
115
+ /**
116
+ * @see https://ng-mocks.sudo.eu/api/MockBuilder#exportall-flag
117
+ */
118
+ exportAll?: boolean;
119
+ }
120
+ /**
121
+ * The interface with flags which are suitable for components in MockBuilder chain functions.
122
+ *
123
+ * @see https://ng-mocks.sudo.eu/api/MockBuilder#config
124
+ */
125
+ export interface IMockBuilderConfigComponent {
126
+ /**
127
+ * @see https://ng-mocks.sudo.eu/api/MockBuilder#render-flag
128
+ */
129
+ render?: {
130
+ [blockName: string]: boolean | {
131
+ $implicit?: any;
132
+ variables?: Record<keyof any, any>;
133
+ };
134
+ };
135
+ }
136
+ /**
137
+ * The interface with flags which are suitable for directives in MockBuilder chain functions.
138
+ *
139
+ * @see https://ng-mocks.sudo.eu/api/MockBuilder#config
140
+ */
141
+ export interface IMockBuilderConfigDirective {
142
+ /**
143
+ * @see https://ng-mocks.sudo.eu/api/MockBuilder#render-flag
144
+ */
145
+ render?: boolean | {
146
+ $implicit?: any;
147
+ variables?: Record<keyof any, any>;
148
+ };
149
+ }
150
+ interface IMockBuilderConfigMock {
151
+ /**
152
+ * @see https://ng-mocks.sudo.eu/api/MockBuilder#precise-flag
153
+ */
154
+ precise?: boolean;
155
+ }
156
+ /**
157
+ * IMockBuilderConfig is a union of all flags for all MockBuilder chain functions.
158
+ *
159
+ * @see https://ng-mocks.sudo.eu/api/MockBuilder#config
160
+ */
161
+ export declare type IMockBuilderConfig = IMockBuilderConfigAll | IMockBuilderConfigModule | IMockBuilderConfigComponent | IMockBuilderConfigDirective;
162
+ /**
163
+ * IMockBuilder describes chain functions of MockBuilder.
164
+ *
165
+ * @see https://ng-mocks.sudo.eu/api/MockBuilder
166
+ */
167
+ export interface IMockBuilder extends Promise<IMockBuilderResult> {
168
+ /**
169
+ * beforeCompileComponents lets extend TestBed.
170
+ * For example, to add NO_ERRORS_SCHEMA, please don't do so.
171
+ *
172
+ * @see https://ng-mocks.sudo.eu/api/MockBuilder#adding-schemas
173
+ */
174
+ beforeCompileComponents(callback: (testBed: typeof TestBed) => void): this;
175
+ /**
176
+ * .build() returns a declaration which can be used in TestBed.configureTestingModule.
177
+ * It is usually helpful with 3rd-party libraries when something should be excluded.
178
+ *
179
+ * @see https://ng-mocks.sudo.eu/api/MockBuilder#factory-function
180
+ * @see https://ng-mocks.sudo.eu/extra/with-3rd-party
181
+ */
182
+ build(): TestModuleMetadata;
183
+ /**
184
+ * .exclude() excludes declarations.
185
+ *
186
+ * @see https://ng-mocks.sudo.eu/api/MockBuilder#exclude
187
+ */
188
+ exclude(def: any): this;
189
+ /**
190
+ * .keep() keeps declarations as they are, and doesn't mock them.
191
+ *
192
+ * @see https://ng-mocks.sudo.eu/api/MockBuilder#keep
193
+ */
194
+ keep(def: any, config?: IMockBuilderConfigAll & IMockBuilderConfigModule): this;
195
+ /**
196
+ * .mock() with a transform function is useful to mock pipes.
197
+ *
198
+ * @see https://ng-mocks.sudo.eu/api/MockBuilder#mock
199
+ */
200
+ mock<T extends PipeTransform>(pipe: AnyType<T>, mock: T["transform"], config?: IMockBuilderConfig): this;
201
+ /**
202
+ * .mock() for strings is useful to mock string providers.
203
+ * However, please considering using tokens instead of string providers.
204
+ *
205
+ * @see https://ng-mocks.sudo.eu/api/MockBuilder#mock
206
+ */
207
+ mock<T = any>(provider: string, mock: T, config?: IMockBuilderConfig): this;
208
+ /**
209
+ * .mock() for tokens is useful to provide a mock copy of the token.
210
+ *
211
+ * @see https://ng-mocks.sudo.eu/api/MockBuilder#mock
212
+ */
213
+ mock<T>(token: InjectionToken<T>, mock: InjectionToken<T> | T | undefined, config?: IMockBuilderConfig): this;
214
+ /**
215
+ * .mock() for declarations is useful to provide a partial mock implementation.
216
+ *
217
+ * @see https://ng-mocks.sudo.eu/api/MockBuilder#mock
218
+ */
219
+ mock<T>(provider: AnyType<T>, mock: AnyType<T> | Partial<T>, config?: IMockBuilderConfig & IMockBuilderConfigMock): this;
220
+ /**
221
+ * .mock() for declarations which mocks all methods and properties.
222
+ *
223
+ * @see https://ng-mocks.sudo.eu/api/MockBuilder#mock
224
+ */
225
+ mock<T>(def: AnyType<T>, config: IMockBuilderConfig): this;
226
+ /**
227
+ * .mock() for declarations which mocks all methods and properties.
228
+ *
229
+ * @see https://ng-mocks.sudo.eu/api/MockBuilder#mock
230
+ */
231
+ mock(def: any): this;
232
+ /**
233
+ * .provide() lets add additional providers to TestBed.
234
+ * If you need to mock an existing provider, please use .mock().
235
+ *
236
+ * @see https://ng-mocks.sudo.eu/api/MockBuilder#provide
237
+ */
238
+ provide(def: Provider): this;
239
+ /**
240
+ * .replace() lets substitute declarations.
241
+ * For example, BrowserAnimationsModule with NoopAnimationsModule.
242
+ *
243
+ * @see https://ng-mocks.sudo.eu/api/MockBuilder#replace
244
+ */
245
+ replace(source: AnyType<any>, destination: AnyType<any>, config?: IMockBuilderConfigAll & IMockBuilderConfigModule): this;
246
+ }
247
+ declare type ngMocksMockConfig = {
248
+ config?: IMockBuilderConfig;
249
+ hostBindings?: string[];
250
+ hostListeners?: string[];
251
+ init?: (instance: any) => void;
252
+ isControlValueAccessor?: boolean;
253
+ isValidator?: boolean;
254
+ outputs?: string[];
255
+ queryScanKeys?: string[];
256
+ setControlValueAccessor?: boolean;
257
+ };
258
+ /**
259
+ * Mock class is the base class for each mock.
260
+ * Usually, it should not be used directly.
261
+ */
262
+ export declare class Mock {
263
+ protected __ngMocksConfig: ngMocksMockConfig;
264
+ constructor(injector?: Injector | null, ngControl?: any | null);
265
+ }
266
+ /**
267
+ * LegacyControlValueAccessor was used to be a way to manipulate a mock ControlValueAccessor.
268
+ *
269
+ * @deprecated use isMockControlValueAccessor or isMockValidator instead (removing in A13)
270
+ * @see https://ng-mocks.sudo.eu/api/helpers/isMockControlValueAccessor
271
+ * @see https://ng-mocks.sudo.eu/api/helpers/isMockValidator
272
+ */
273
+ export declare class LegacyControlValueAccessor extends Mock {
274
+ /**
275
+ * @deprecated use isMockControlValueAccessor instead (removing in A13)
276
+ * @see https://ng-mocks.sudo.eu/api/helpers/isMockControlValueAccessor
277
+ */
278
+ __simulateChange(value: any): void;
279
+ /**
280
+ * @deprecated use isMockControlValueAccessor instead (removing in A13)
281
+ * @see https://ng-mocks.sudo.eu/api/helpers/isMockControlValueAccessor
282
+ */
283
+ __simulateTouch(): void;
284
+ /**
285
+ * @deprecated use isMockValidator instead (removing in A13)
286
+ * @see https://ng-mocks.sudo.eu/api/helpers/isMockValidator
287
+ */
288
+ __simulateValidatorChange(): void;
289
+ }
290
+ /**
291
+ * MockControlValueAccessor exposes access to a mock ControlValueAccessor.
292
+ * It should be used in a combination with isMockControlValueAccessor.
293
+ *
294
+ * @see https://ng-mocks.sudo.eu/api/helpers/isMockControlValueAccessor
295
+ */
296
+ export interface MockControlValueAccessor {
297
+ /**
298
+ * It simulates an external change of the value.
299
+ * Please consider usage of ngMocks.change().
300
+ *
301
+ * @see https://ng-mocks.sudo.eu/extra/mock-form-controls
302
+ * @see https://ng-mocks.sudo.eu/api/ngMocks/change
303
+ */
304
+ __simulateChange(value: any): void;
305
+ /**
306
+ * It simulates an external touch.
307
+ * Please consider usage of ngMocks.touch().
308
+ *
309
+ * @see https://ng-mocks.sudo.eu/extra/mock-form-controls
310
+ * @see https://ng-mocks.sudo.eu/api/ngMocks/touch
311
+ */
312
+ __simulateTouch(): void;
313
+ }
314
+ /**
315
+ * MockValidator exposes access to a mock Validator.
316
+ * It should be used in a combination with isMockValidator.
317
+ *
318
+ * @see https://ng-mocks.sudo.eu/api/helpers/isMockValidator
319
+ */
320
+ export interface MockValidator {
321
+ /**
322
+ * it simulates an external validation change.
323
+ *
324
+ * @see https://ng-mocks.sudo.eu/extra/mock-form-controls
325
+ */
326
+ __simulateValidatorChange(): void;
327
+ }
328
+ declare type MockedComponentSelector<T> = [
329
+ keyof T
330
+ ] | [
331
+ keyof T,
332
+ number
333
+ ] | [
334
+ keyof T,
335
+ number,
336
+ number
337
+ ] | [
338
+ keyof T,
339
+ number,
340
+ number,
341
+ number
342
+ ] | [
343
+ keyof T,
344
+ number,
345
+ number,
346
+ number,
347
+ number
348
+ ] | [
349
+ keyof T,
350
+ number,
351
+ number,
352
+ number,
353
+ number,
354
+ number
355
+ ] | [
356
+ keyof T,
357
+ number,
358
+ number,
359
+ number,
360
+ number,
361
+ number,
362
+ number
363
+ ] | [
364
+ keyof T,
365
+ number,
366
+ number,
367
+ number,
368
+ number,
369
+ number,
370
+ number,
371
+ number
372
+ ] | [
373
+ keyof T,
374
+ number,
375
+ number,
376
+ number,
377
+ number,
378
+ number,
379
+ number,
380
+ number,
381
+ number
382
+ ] | [
383
+ keyof T,
384
+ number,
385
+ number,
386
+ number,
387
+ number,
388
+ number,
389
+ number,
390
+ number,
391
+ number,
392
+ number
393
+ ] | [
394
+ keyof T,
395
+ number,
396
+ number,
397
+ number,
398
+ number,
399
+ number,
400
+ number,
401
+ number,
402
+ number,
403
+ number,
404
+ number
405
+ ] | string;
406
+ /**
407
+ * MockedComponent is a legacy representation of an interface of a mock component instance.
408
+ * Please avoid its usage and try to rely on ngMocks.render() and ngMocks.hide().
409
+ *
410
+ * @see https://ng-mocks.sudo.eu/api/ngMocks/render
411
+ * @see https://ng-mocks.sudo.eu/api/ngMocks/hide
412
+ */
413
+ export declare type MockedComponent<T> = T & LegacyControlValueAccessor & {
414
+ /**
415
+ * @deprecated use ngMocks.hide instead (removing in A13)
416
+ * @see https://ng-mocks.sudo.eu/api/ngMocks/hide
417
+ */
418
+ __hide(contentChildSelector: MockedComponentSelector<T>): void;
419
+ /**
420
+ * @deprecated use ngMocks.render instead (removing in A13)
421
+ * @see https://ng-mocks.sudo.eu/api/ngMocks/render
422
+ */
423
+ __render(contentChildSelector: MockedComponentSelector<T>, $implicit?: any, variables?: Record<keyof any, any>): void;
424
+ };
425
+ /**
426
+ * MockedDirective is a legacy representation of an interface of a mock directive instance.
427
+ * Please avoid its usage and try to rely on ngMocks.render() and ngMocks.hide().
428
+ *
429
+ * @see https://ng-mocks.sudo.eu/api/ngMocks/render#render-structural-directives
430
+ * @see https://ng-mocks.sudo.eu/api/ngMocks/hide
431
+ */
432
+ export declare type MockedDirective<T> = T & LegacyControlValueAccessor & {
433
+ /**
434
+ * Pointer to ChangeDetectorRef.
435
+ */
436
+ __cdr?: ChangeDetectorRef;
437
+ /**
438
+ * Pointer to current element in case of Attribute Directives.
439
+ */
440
+ __element?: ElementRef;
441
+ /**
442
+ * Just a flag for easy understanding what it is.
443
+ */
444
+ __isStructural: boolean;
445
+ /**
446
+ * Pointer to the template of Structural Directives.
447
+ */
448
+ __template?: TemplateRef<any>;
449
+ /**
450
+ * Pointer to ViewContainerRef.
451
+ */
452
+ __vcr?: ViewContainerRef;
453
+ /**
454
+ * @deprecated use this.__vcr (removing in A13)
455
+ */
456
+ __viewContainer?: ViewContainerRef;
457
+ /**
458
+ * @deprecated use ngMocks.render instead (removing in A13)
459
+ * @see https://ng-mocks.sudo.eu/api/ngMocks/render#render-structural-directives
460
+ */
461
+ __render($implicit?: any, variables?: Record<keyof any, any>): void;
462
+ };
463
+ /**
464
+ * MockedModule is a legacy representation of an interface of a mock module instance.
465
+ * Please avoid its usage, because, usually, you should not rely on whether it's a mock or not.
466
+ */
467
+ export declare type MockedModule<T> = T & Mock;
468
+ /**
469
+ * MockedPipe is a legacy representation of an interface of a mock pipe instance.
470
+ * Please avoid its usage, because, usually, you should not rely on whether it's a mock or not.
471
+ */
472
+ export declare type MockedPipe<T> = T & Mock;
473
+ /**
474
+ * Returns the mock class of a mock module based on a mock module or a source module.
475
+ * It works in runtime if the module has been mocked.
476
+ *
477
+ * @see https://ng-mocks.sudo.eu/api/helpers/getMockedNgDefOf
478
+ *
479
+ * ```ts
480
+ * getMockedNgDefOf(RealModule, 'm'); // returns MockModule
481
+ * getMockedNgDefOf(MockModule, 'm'); // returns MockModule
482
+ * getMockedNgDefOf(ArbitraryClass, 'm'); // throws
483
+ * ```
484
+ */
485
+ export declare function getMockedNgDefOf<T>(declaration: AnyType<T>, type: "m"): Type<MockedModule<T>>;
486
+ /**
487
+ * Returns the mock class of a mock component based on a mock component or a source component.
488
+ * It works in runtime if the component has been mocked.
489
+ *
490
+ * @see https://ng-mocks.sudo.eu/api/helpers/getMockedNgDefOf
491
+ *
492
+ * ```ts
493
+ * getMockedNgDefOf(RealComponent, 'c'); // returns MockComponent
494
+ * getMockedNgDefOf(MockComponent, 'c'); // returns MockComponent
495
+ * getMockedNgDefOf(ArbitraryClass, 'c'); // throws
496
+ * ```
497
+ */
498
+ export declare function getMockedNgDefOf<T>(declaration: AnyType<T>, type: "c"): Type<MockedComponent<T>>;
499
+ /**
500
+ * Returns the mock class of a mock directive based on a mock directive or a source directive.
501
+ * It works in runtime if the directive has been mocked.
502
+ *
503
+ * @see https://ng-mocks.sudo.eu/api/helpers/getMockedNgDefOf
504
+ *
505
+ * ```ts
506
+ * getMockedNgDefOf(RealDirective, 'd'); // returns MockDirective
507
+ * getMockedNgDefOf(MockDirective, 'd'); // returns MockDirective
508
+ * getMockedNgDefOf(ArbitraryClass, 'd'); // throws
509
+ * ```
510
+ */
511
+ export declare function getMockedNgDefOf<T>(declaration: AnyType<T>, type: "d"): Type<MockedDirective<T>>;
512
+ /**
513
+ * Returns the mock class of a mock pipe based on a mock pipe or a source pipe.
514
+ * It works in runtime if the pipe has been mocked.
515
+ *
516
+ * @see https://ng-mocks.sudo.eu/api/helpers/getMockedNgDefOf
517
+ *
518
+ * ```ts
519
+ * getMockedNgDefOf(RealPipe, 'p'); // returns MockPipe
520
+ * getMockedNgDefOf(MockPipe, 'p'); // returns MockPipe
521
+ * getMockedNgDefOf(ArbitraryClass, 'p'); // throws
522
+ * ```
523
+ */
524
+ export declare function getMockedNgDefOf<T>(declaration: AnyType<T>, type: "p"): Type<MockedPipe<T>>;
525
+ /**
526
+ * Returns the mock class of a thing based on a mock class or a source class.
527
+ * It works in runtime if the thing has been mocked.
528
+ *
529
+ * @see https://ng-mocks.sudo.eu/api/helpers/getMockedNgDefOf
530
+ *
531
+ * ```ts
532
+ * getMockedNgDefOf(RealComponent); // returns MockComponent
533
+ * getMockedNgDefOf(MockPipe); // returns MockPipe
534
+ * getMockedNgDefOf(ArbitraryClass); // throws
535
+ * ```
536
+ */
537
+ export declare function getMockedNgDefOf<T>(declaration: AnyType<T>): Type<T>;
538
+ /**
539
+ * Returns the original class of a mock module class.
540
+ *
541
+ * @see https://ng-mocks.sudo.eu/api/helpers/getSourceOfMock
542
+ *
543
+ * ```ts
544
+ * getSourceOfMock(MockModule); // returns RealModule
545
+ * getSourceOfMock(RealModule); // returns RealModule
546
+ * ```
547
+ */
548
+ export declare function getSourceOfMock<T>(declaration: AnyType<MockedModule<T>>): Type<T>;
549
+ /**
550
+ * Returns the original class of a mock component class.
551
+ *
552
+ * @see https://ng-mocks.sudo.eu/api/helpers/getSourceOfMock
553
+ *
554
+ * ```ts
555
+ * getSourceOfMock(MockComponent); // returns RealComponent
556
+ * getSourceOfMock(RealComponent); // returns RealComponent
557
+ * ```
558
+ */
559
+ export declare function getSourceOfMock<T>(declaration: AnyType<MockedComponent<T>>): Type<T>;
560
+ /**
561
+ * Returns the original class of a mock directive class.
562
+ *
563
+ * @see https://ng-mocks.sudo.eu/api/helpers/getSourceOfMock
564
+ *
565
+ * ```ts
566
+ * getSourceOfMock(MockDirective); // returns RealDirective
567
+ * getSourceOfMock(RealDirective); // returns RealDirective
568
+ * ```
569
+ */
570
+ export declare function getSourceOfMock<T>(declaration: AnyType<MockedDirective<T>>): Type<T>;
571
+ /**
572
+ * Returns the original class of a mock pipe class.
573
+ *
574
+ * @see https://ng-mocks.sudo.eu/api/helpers/getSourceOfMock
575
+ *
576
+ * ```ts
577
+ * getSourceOfMock(MockPipe); // returns RealPipe
578
+ * getSourceOfMock(RealPipe); // returns RealPipe
579
+ * ```
580
+ */
581
+ export declare function getSourceOfMock<T>(declaration: AnyType<MockedPipe<T>>): Type<T>;
582
+ /**
583
+ * Returns the original class of a mock class.
584
+ *
585
+ * @see https://ng-mocks.sudo.eu/api/helpers/getSourceOfMock
586
+ *
587
+ * ```ts
588
+ * getSourceOfMock(MockClass); // returns RealClass
589
+ * getSourceOfMock(RealClass); // returns RealClass
590
+ * ```
591
+ */
592
+ export declare function getSourceOfMock<T>(declaration: AnyType<T>): Type<T>;
593
+ /**
594
+ * isMockControlValueAccessor helps to assert that an instance is a mock ControlValueAccessor
595
+ * to perform valueChange or touch simulations.
596
+ * Usually, it is used in if statements.
597
+ *
598
+ * @see https://ng-mocks.sudo.eu/api/helpers/isMockControlValueAccessor
599
+ * @see https://ng-mocks.sudo.eu/api/ngMocks/change
600
+ * @see https://ng-mocks.sudo.eu/api/ngMocks/touch
601
+ */
602
+ export declare const isMockControlValueAccessor: <T>(value: T) => value is T & MockControlValueAccessor;
603
+ /**
604
+ * isMockNgDef verifies whether a class is a mock component class.
605
+ *
606
+ * @internal
607
+ *
608
+ * ```ts
609
+ * isMockNgDef(MockComponent, 'c'); // returns true
610
+ * isMockNgDef(RealComponent, 'c'); // returns false
611
+ * isMockNgDef(ArbitraryClass, 'c'); // returns false
612
+ * ```
613
+ */
614
+ export declare function isMockNgDef<T>(component: Type<T>, ngType: "c"): component is Type<MockedComponent<T>>;
615
+ /**
616
+ * isMockNgDef verifies whether a class is a mock directive class.
617
+ *
618
+ * @internal
619
+ *
620
+ * ```ts
621
+ * isMockNgDef(MockDirective, 'd'); // returns true
622
+ * isMockNgDef(RealDirective, 'd'); // returns false
623
+ * isMockNgDef(ArbitraryClass, 'd'); // returns false
624
+ * ```
625
+ */
626
+ export declare function isMockNgDef<T>(directive: Type<T>, ngType: "d"): directive is Type<MockedDirective<T>>;
627
+ /**
628
+ * isMockNgDef verifies whether a class is a mock pipe class.
629
+ *
630
+ * @internal
631
+ *
632
+ * ```ts
633
+ * isMockNgDef(MockPipe, 'p'); // returns true
634
+ * isMockNgDef(RealPipe, 'p'); // returns false
635
+ * isMockNgDef(ArbitraryClass, 'p'); // returns false
636
+ * ```
637
+ */
638
+ export declare function isMockNgDef<T>(pipe: Type<T>, ngType: "p"): pipe is Type<MockedPipe<T>>;
639
+ /**
640
+ * isMockNgDef verifies whether a class is a mock module class.
641
+ *
642
+ * @internal
643
+ *
644
+ * ```ts
645
+ * isMockNgDef(MockModule, 'm'); // returns true
646
+ * isMockNgDef(RealModule, 'm'); // returns false
647
+ * isMockNgDef(ArbitraryClass, 'm'); // returns false
648
+ * ```
649
+ */
650
+ export declare function isMockNgDef<T>(module: Type<T>, ngType: "m"): module is Type<MockedModule<T>>;
651
+ /**
652
+ * isMockNgDef verifies whether a class is a mock class.
653
+ *
654
+ * @internal
655
+ *
656
+ * ```ts
657
+ * isMockNgDef(MockComponent); // returns true
658
+ * isMockNgDef(RealModule); // returns false
659
+ * isMockNgDef(ArbitraryClass); // returns false
660
+ * ```
661
+ */
662
+ export declare function isMockNgDef<T>(module: Type<T>): module is Type<T>;
663
+ /**
664
+ * Checks whether the instance derives from a mock module.
665
+ *
666
+ * @see https://ng-mocks.sudo.eu/api/helpers/isMockOf
667
+ *
668
+ * ```ts
669
+ * isMockOf(moduleInstance, RealModule, 'm'); // returns true
670
+ * isMockOf(moduleInstance, ArbitraryClass, 'm'); // returns false
671
+ * ```
672
+ */
673
+ export declare function isMockOf<T>(instance: any, declaration: Type<T>, ngType: "m"): instance is MockedModule<T>;
674
+ /**
675
+ * Checks whether the instance derives from a mock component.
676
+ *
677
+ * @see https://ng-mocks.sudo.eu/api/helpers/isMockOf
678
+ *
679
+ * ```ts
680
+ * isMockOf(componentInstance, RealComponent, 'c'); // returns true
681
+ * isMockOf(componentInstance, ArbitraryClass, 'c'); // returns false
682
+ * ```
683
+ */
684
+ export declare function isMockOf<T>(instance: any, declaration: Type<T>, ngType: "c"): instance is MockedComponent<T>;
685
+ /**
686
+ * Checks whether the instance derives from a mock directive.
687
+ *
688
+ * @see https://ng-mocks.sudo.eu/api/helpers/isMockOf
689
+ *
690
+ * ```ts
691
+ * isMockOf(directiveInstance, RealDirective, 'd'); // returns true
692
+ * isMockOf(directiveInstance, ArbitraryClass, 'd'); // returns false
693
+ * ```
694
+ */
695
+ export declare function isMockOf<T>(instance: any, declaration: Type<T>, ngType: "d"): instance is MockedDirective<T>;
696
+ /**
697
+ * Checks whether the instance derives from a mock pipe.
698
+ *
699
+ * @see https://ng-mocks.sudo.eu/api/helpers/isMockOf
700
+ *
701
+ * ```ts
702
+ * isMockOf(pipeInstance, RealPipe, 'p'); // returns true
703
+ * isMockOf(pipeInstance, ArbitraryClass, 'p'); // returns false
704
+ * ```
705
+ */
706
+ export declare function isMockOf<T extends PipeTransform>(instance: any, declaration: Type<T>, ngType: "p"): instance is MockedPipe<T>;
707
+ /**
708
+ * Checks whether the instance derives from a mock type.
709
+ *
710
+ * @see https://ng-mocks.sudo.eu/api/helpers/isMockOf
711
+ *
712
+ * ```ts
713
+ * isMockOf(componentInstance, RealComponent); // returns true
714
+ * isMockOf(pipeInstance, RealPipe); // returns true
715
+ * isMockOf(pipeInstance, ArbitraryClass); // returns false
716
+ * ```
717
+ */
718
+ export declare function isMockOf<T>(instance: any, declaration: Type<T>): instance is T;
719
+ /**
720
+ * isMockValidator helps to assert that an instance is a mock Validator
721
+ * to perform validationChange simulations.
722
+ * Usually, it is used in if statements.
723
+ *
724
+ * @see https://ng-mocks.sudo.eu/api/helpers/isMockValidator
725
+ */
726
+ export declare const isMockValidator: <T>(value: T) => value is T & MockValidator;
727
+ /**
728
+ * Checks whether a declaration is the mock class of a module.
729
+ *
730
+ * @see https://ng-mocks.sudo.eu/api/helpers/isMockedNgDefOf
731
+ *
732
+ * ```ts
733
+ * isMockedNgDefOf(MockModule, RealModule, 'm'); // returns true
734
+ * isMockedNgDefOf(MockModule, ArbitraryModule, 'm'); // returns false
735
+ * isMockedNgDefOf(MockModule, ArbitraryClass, 'm'); // returns false
736
+ * ```
737
+ */
738
+ export declare function isMockedNgDefOf<T>(declaration: any, type: Type<T>, ngType: "m"): declaration is Type<MockedModule<T>>;
739
+ /**
740
+ * Checks whether a declaration is the mock class of a component.
741
+ *
742
+ * @see https://ng-mocks.sudo.eu/api/helpers/isMockedNgDefOf
743
+ *
744
+ * ```ts
745
+ * isMockedNgDefOf(MockComponent, RealComponent, 'c'); // returns true
746
+ * isMockedNgDefOf(MockComponent, ArbitraryComponent, 'c'); // returns false
747
+ * isMockedNgDefOf(MockComponent, ArbitraryClass, 'c'); // returns false
748
+ * ```
749
+ */
750
+ export declare function isMockedNgDefOf<T>(declaration: any, type: Type<T>, ngType: "c"): declaration is Type<MockedComponent<T>>;
751
+ /**
752
+ * Checks whether a declaration is the mock class of a directive.
753
+ *
754
+ * @see https://ng-mocks.sudo.eu/api/helpers/isMockedNgDefOf
755
+ *
756
+ * ```ts
757
+ * isMockedNgDefOf(MockDirective, RealDirective, 'd'); // returns true
758
+ * isMockedNgDefOf(MockDirective, ArbitraryDirective, 'd'); // returns false
759
+ * isMockedNgDefOf(MockDirective, ArbitraryClass, 'd'); // returns false
760
+ * ```
761
+ */
762
+ export declare function isMockedNgDefOf<T>(declaration: any, type: Type<T>, ngType: "d"): declaration is Type<MockedDirective<T>>;
763
+ /**
764
+ * Checks whether a declaration is the mock class of a pipe.
765
+ *
766
+ * @see https://ng-mocks.sudo.eu/api/helpers/isMockedNgDefOf
767
+ *
768
+ * ```ts
769
+ * isMockedNgDefOf(MockPipe, RealPipe, 'p'); // returns true
770
+ * isMockedNgDefOf(MockPipe, ArbitraryPipe, 'p'); // returns false
771
+ * isMockedNgDefOf(MockPipe, ArbitraryClass, 'p'); // returns false
772
+ * ```
773
+ */
774
+ export declare function isMockedNgDefOf<T extends PipeTransform>(declaration: any, type: Type<T>, ngType: "p"): declaration is Type<MockedPipe<T>>;
775
+ /**
776
+ * Checks whether a declaration is the mock class of a thing.
777
+ *
778
+ * @see https://ng-mocks.sudo.eu/api/helpers/isMockedNgDefOf
779
+ *
780
+ * ```ts
781
+ * isMockedNgDefOf(MockPipe, RealPipe); // returns true
782
+ * isMockedNgDefOf(MockComponent, ArbitraryComponent); // returns false
783
+ * isMockedNgDefOf(MockPipe, ArbitraryClass); // returns false
784
+ * ```
785
+ */
786
+ export declare function isMockedNgDefOf<T>(declaration: any, type: Type<T>): declaration is Type<T>;
787
+ /**
788
+ * Checks whether a class has been decorated by @NgModule.
789
+ *
790
+ * @see https://ng-mocks.sudo.eu/api/helpers/isNgDef
791
+ *
792
+ * ```ts
793
+ * isNgDef(RealModule, 'm'); // returns true
794
+ * isNgDef(MockModule, 'm'); // returns true
795
+ * isNgDef(ArbitraryModule, 'm'); // returns true
796
+ * isNgDef(ArbitraryClass, 'm'); // returns false
797
+ * ```
798
+ */
799
+ export declare function isNgDef(declaration: any, ngType: "m"): declaration is Type<any>;
800
+ /**
801
+ * Checks whether a class has been decorated by @Component.
802
+ *
803
+ * @see https://ng-mocks.sudo.eu/api/helpers/isNgDef
804
+ *
805
+ * ```ts
806
+ * isNgDef(RealComponent, 'c'); // returns true
807
+ * isNgDef(MockComponent, 'c'); // returns true
808
+ * isNgDef(ArbitraryComponent, 'c'); // returns true
809
+ * isNgDef(ArbitraryClass, 'c'); // returns false
810
+ * ```
811
+ */
812
+ export declare function isNgDef(declaration: any, ngType: "c"): declaration is Type<any>;
813
+ /**
814
+ * Checks whether a class has been decorated by @Directive.
815
+ *
816
+ * @see https://ng-mocks.sudo.eu/api/helpers/isNgDef
817
+ *
818
+ * ```ts
819
+ * isNgDef(RealDirective, 'd'); // returns true
820
+ * isNgDef(MockDirective, 'd'); // returns true
821
+ * isNgDef(ArbitraryDirective, 'd'); // returns true
822
+ * isNgDef(ArbitraryClass, 'd'); // returns false
823
+ * ```
824
+ */
825
+ export declare function isNgDef(declaration: any, ngType: "d"): declaration is Type<any>;
826
+ /**
827
+ * Checks whether a class has been decorated by @Pipe.
828
+ *
829
+ * @see https://ng-mocks.sudo.eu/api/helpers/isNgDef
830
+ *
831
+ * ```ts
832
+ * isNgDef(RealPipe, 'p'); // returns true
833
+ * isNgDef(MockPipe, 'p'); // returns true
834
+ * isNgDef(ArbitraryPipe, 'p'); // returns true
835
+ * isNgDef(ArbitraryClass, 'p'); // returns false
836
+ * ```
837
+ */
838
+ export declare function isNgDef(declaration: any, ngType: "p"): declaration is Type<PipeTransform>;
839
+ /**
840
+ * Checks whether a class has been decorated by @Injectable.
841
+ *
842
+ * @see https://ng-mocks.sudo.eu/api/helpers/isNgDef
843
+ *
844
+ * ```ts
845
+ * isNgDef(RealService, 'i'); // returns true
846
+ * isNgDef(MockService, 'i'); // returns true
847
+ * isNgDef(ArbitraryService, 'i'); // returns true
848
+ * isNgDef(ArbitraryClass, 'i'); // returns false
849
+ * ```
850
+ */
851
+ export declare function isNgDef(declaration: any, ngType: "i"): declaration is Type<any>;
852
+ /**
853
+ * Checks whether a variable is a token.
854
+ *
855
+ * @see https://ng-mocks.sudo.eu/api/helpers/isNgDef
856
+ *
857
+ * ```ts
858
+ * isNgDef(realToken, 't'); // returns true
859
+ * isNgDef(mockToken, 't'); // returns true
860
+ * isNgDef(arbitraryToken, 't'); // returns true
861
+ * isNgDef(arbitraryObject, 't'); // returns false
862
+ * ```
863
+ */
864
+ export declare function isNgDef(declaration: any, ngType: "t"): declaration is InjectionToken<any>;
865
+ /**
866
+ * Checks whether a class or variable has been decorated by a ng type.
867
+ *
868
+ * @see https://ng-mocks.sudo.eu/api/helpers/isNgDef
869
+ *
870
+ * ```ts
871
+ * isNgDef(RealModule); // returns true
872
+ * isNgDef(MockComponent); // returns true
873
+ * isNgDef(ArbitraryDirective); // returns true
874
+ * isNgDef(token); // returns true
875
+ * isNgDef(ArbitraryClass); // returns false
876
+ * ```
877
+ */
878
+ export declare function isNgDef(declaration: any): declaration is Type<any>;
879
+ /**
880
+ * Checks whether a variable is an Angular token.
881
+ *
882
+ * @see https://ng-mocks.sudo.eu/api/helpers/isNgInjectionToken
883
+ *
884
+ * ```ts
885
+ * isNgInjectionToken(APP_ID); // returns true
886
+ * isNgInjectionToken(arbitraryVariable); // returns false
887
+ * ```
888
+ */
889
+ export declare const isNgInjectionToken: (token: any) => token is InjectionToken<any>;
890
+ /**
891
+ * This signature of MockInstance lets customize the getter of a property.
892
+ *
893
+ * @see https://ng-mocks.sudo.eu/api/MockInstance
894
+ *
895
+ * ```ts
896
+ * MockInstance(ArbitraryComponent, 'currentUser$', () => mockUser$, 'get');
897
+ * MockInstance(ArbitraryService, 'enabled', () => false, 'get');
898
+ * ```
899
+ */
900
+ export declare function MockInstance<T extends object, K extends keyof T, S extends () => T[K]>(instance: Type<T> | AbstractType<T>, name: K, stub: S, encapsulation: "get"): S;
901
+ /**
902
+ * This signature of MockInstance lets customize the setters of a property.
903
+ *
904
+ * @see https://ng-mocks.sudo.eu/api/MockInstance
905
+ *
906
+ * ```ts
907
+ * const currentUserSetterSpy = jasmine.createSpy();
908
+ * MockInstance(ArbitraryComponent, 'currentUser', currentUserSetterSpy, 'set');
909
+ *
910
+ * let relServiceEnabled: boolean;
911
+ * MockInstance(ArbitraryService, 'enabled', value => relServiceEnabled = value, 'set');
912
+ * ```
913
+ */
914
+ export declare function MockInstance<T extends object, K extends keyof T, S extends (value: T[K]) => void>(instance: Type<T> | AbstractType<T>, name: K, stub: S, encapsulation: "set"): S;
915
+ /**
916
+ * This signature of MockInstance lets customize the properties and methods.
917
+ *
918
+ * @see https://ng-mocks.sudo.eu/api/MockInstance
919
+ *
920
+ * ```ts
921
+ * MockInstance(ArbitraryComponent, 'onInit', onInitSpy);
922
+ * MockInstance(ArbitraryDirective, 'onDestroy', () => {});
923
+ * MockInstance(ArbitraryService, 'currentDate', new Date());
924
+ * MockInstance(ArbitraryModule, 'currentUser', mockUser);
925
+ * ```
926
+ */
927
+ export declare function MockInstance<T extends object, K extends keyof T, S extends T[K]>(instance: Type<T> | AbstractType<T>, name: K, stub: S): S;
928
+ /**
929
+ * This signature of MockInstance lets customize tokens with a callback.
930
+ *
931
+ * @see https://ng-mocks.sudo.eu/api/MockInstance
932
+ *
933
+ * ```ts
934
+ * MockInstance(webSocketToken, () => mockWebSocket);
935
+ * ```
936
+ */
937
+ export declare function MockInstance<T>(declaration: InjectionToken<T>, init?: (instance: T | undefined, injector: Injector | undefined) => Partial<T>): void;
938
+ /**
939
+ * This signature of MockInstance lets customize tokens with a callback.
940
+ *
941
+ * @deprecated please pass the callback directly instead of config.
942
+ * @see https://ng-mocks.sudo.eu/api/MockInstance
943
+ *
944
+ * ```ts
945
+ * MockInstance(webSocketToken, {
946
+ * init: () => mockWebSocket,
947
+ * });
948
+ * ```
949
+ */
950
+ export declare function MockInstance<T>(declaration: InjectionToken<T>, config?: {
951
+ init?: (instance: T | undefined, injector: Injector | undefined) => Partial<T>;
952
+ }): void;
953
+ /**
954
+ * This signature of MockInstance lets customize the instances of mock classes with a callback.
955
+ * You can return a shape or change the instance.
956
+ *
957
+ * @see https://ng-mocks.sudo.eu/api/MockInstance
958
+ *
959
+ * ```ts
960
+ * MockInstance(ArbitraryComponent, (instance, injector) => {
961
+ * instance.enabled = true;
962
+ * instance.db = injector.get(DatabaseService);
963
+ * });
964
+ * MockInstance(ArbitraryDirective, () => {
965
+ * return {
966
+ * someProperty: true,
967
+ * };
968
+ * });
969
+ * ```
970
+ */
971
+ export declare function MockInstance<T>(declaration: Type<T> | AbstractType<T>, init?: (instance: T, injector: Injector | undefined) => void | Partial<T>): void;
972
+ /**
973
+ * This signature of MockInstance lets customize the instances of mock classes with a callback.
974
+ * You can return a shape or change the instance.
975
+ *
976
+ * @deprecated please pass the callback directly instead of config.
977
+ * @see https://ng-mocks.sudo.eu/api/MockInstance
978
+ *
979
+ * ```ts
980
+ * MockInstance(ArbitraryComponent, {
981
+ * init: (instance, injector) => {
982
+ * instance.enabled = true;
983
+ * instance.db = injector.get(DatabaseService);
984
+ * },
985
+ * });
986
+ * MockInstance(ArbitraryDirective, {
987
+ * init: () => {
988
+ * return {
989
+ * someProperty: true,
990
+ * };
991
+ * },
992
+ * });
993
+ * ```
994
+ */
995
+ export declare function MockInstance<T>(declaration: Type<T> | AbstractType<T>, config?: {
996
+ init?: (instance: T, injector: Injector | undefined) => void | Partial<T>;
997
+ }): void;
998
+ /**
999
+ * Interface describes how to configure scopes for MockInstance.
1000
+ *
1001
+ * @see https://ng-mocks.sudo.eu/api/MockInstance#customization-scopes
1002
+ */
1003
+ export declare namespace MockInstance {
1004
+ /**
1005
+ * Creates a scope which remembers all future customizations of MockInstance.
1006
+ * It allows to reset them afterwards.
1007
+ *
1008
+ * @see https://ng-mocks.sudo.eu/api/MockInstance#remember
1009
+ */
1010
+ function remember(): void;
1011
+ /**
1012
+ * Resets all changes in the current scope.
1013
+ *
1014
+ * @see https://ng-mocks.sudo.eu/api/MockInstance#restore
1015
+ */
1016
+ function restore(): void;
1017
+ /**
1018
+ * Creates a local scope in `beforeEach` and `afterEach`.
1019
+ * If `suite` has been passed, then `beforeAll` and `afterAll` are used.
1020
+ *
1021
+ * @see https://ng-mocks.sudo.eu/api/MockInstance#scope
1022
+ */
1023
+ function scope(scope?: "all" | "suite" | "case"): void;
1024
+ }
1025
+ /**
1026
+ * MockReset resets everything what has been configured in MockInstance.
1027
+ * Please consider using MockInstance.scope() instead,
1028
+ * which respects customizations between tests.
1029
+ *
1030
+ * https://ng-mocks.sudo.eu/api/MockInstance#resetting-customization
1031
+ * https://ng-mocks.sudo.eu/api/MockInstance#scope
1032
+ */
1033
+ export declare function MockReset(): void;
1034
+ interface NgModuleWithProviders<T = any> {
1035
+ ngModule: Type<T>;
1036
+ providers?: Provider[];
1037
+ }
1038
+ declare type MockBuilderParam = string | AnyType<any> | InjectionToken<any> | NgModuleWithProviders;
1039
+ /**
1040
+ * MockBuilder provides reach and simple interfaces of chain functions
1041
+ * to build desired mock environment for tests.
1042
+ *
1043
+ * @see https://ng-mocks.sudo.eu/api/MockBuilder
1044
+ */
1045
+ export declare function MockBuilder(keepDeclaration?: MockBuilderParam | MockBuilderParam[] | null | undefined, itsModuleToMock?: MockBuilderParam | MockBuilderParam[] | null | undefined): IMockBuilder;
1046
+ /**
1047
+ * MockModule creates a mock module class out of an arbitrary module.
1048
+ * All declarations, imports, exports and providers will be mocked too.
1049
+ *
1050
+ * @see https://ng-mocks.sudo.eu/api/MockModule
1051
+ *
1052
+ * ```ts
1053
+ * TestBed.configureTestingModule({
1054
+ * imports: [
1055
+ * MockModule(SharedModule),
1056
+ * ],
1057
+ * });
1058
+ * ```
1059
+ */
1060
+ export declare function MockModule<T>(ngModule: Type<T>): Type<T>;
1061
+ /**
1062
+ * MockModule creates a mock module class with mock provides out of an arbitrary module with providers.
1063
+ * All declarations, imports, exports and providers will be mocked too.
1064
+ *
1065
+ * @see https://ng-mocks.sudo.eu/api/MockModule
1066
+ *
1067
+ * ```ts
1068
+ * TestBed.configureTestingModule({
1069
+ * imports: [
1070
+ * MockModule(StoreModule.forRoot()),
1071
+ * ],
1072
+ * });
1073
+ * ```
1074
+ */
1075
+ export declare function MockModule<T>(ngModule: NgModuleWithProviders<T>): NgModuleWithProviders<T>;
1076
+ /**
1077
+ * MockComponents creates an array of mock component classes out of components passed as parameters.
1078
+ *
1079
+ * @see https://ng-mocks.sudo.eu/api/MockComponent
1080
+ *
1081
+ * ```ts
1082
+ * TestBed.configureTestingModule({
1083
+ * declarations: MockComponents(
1084
+ * Dep1Component,
1085
+ * Dep2Component,
1086
+ * ),
1087
+ * });
1088
+ * ```
1089
+ */
1090
+ export declare function MockComponents(...components: Array<Type<any>>): Array<Type<MockedComponent<any>>>;
1091
+ /**
1092
+ * MockComponent creates a mock component class out of an arbitrary component.
1093
+ *
1094
+ * @see https://ng-mocks.sudo.eu/api/MockComponent
1095
+ *
1096
+ * ```ts
1097
+ * TestBed.configureTestingModule({
1098
+ * declarations: [
1099
+ * MockComponent(Dep1Component),
1100
+ * MockComponent(Dep2Component),
1101
+ * ],
1102
+ * });
1103
+ * ```
1104
+ */
1105
+ export declare function MockComponent<TComponent>(component: Type<TComponent>): Type<MockedComponent<TComponent>>;
1106
+ /**
1107
+ * MockDirectives creates an array of mock directive classes out of directives passed as parameters.
1108
+ *
1109
+ * @see https://ng-mocks.sudo.eu/api/MockDirective
1110
+ *
1111
+ * ```ts
1112
+ * TestBed.configureTestingModule({
1113
+ * declarations: MockDirectives(
1114
+ * Dep1Directive,
1115
+ * Dep2Directive,
1116
+ * ),
1117
+ * });
1118
+ * ```
1119
+ */
1120
+ export declare function MockDirectives(...directives: Array<Type<any>>): Array<Type<MockedDirective<any>>>;
1121
+ /**
1122
+ * MockDirective creates a mock directive class out of an arbitrary directive.
1123
+ *
1124
+ * @see https://ng-mocks.sudo.eu/api/MockDirective
1125
+ *
1126
+ * ```ts
1127
+ * TestBed.configureTestingModule({
1128
+ * declarations: [
1129
+ * MockDirective(Dep1Directive),
1130
+ * MockDirective(Dep2Directive),
1131
+ * ],
1132
+ * });
1133
+ * ```
1134
+ */
1135
+ export declare function MockDirective<TDirective>(directive: Type<TDirective>): Type<MockedDirective<TDirective>>;
1136
+ /**
1137
+ * MockPipes creates an array of mock pipe classes out of pipes passed as parameters.
1138
+ *
1139
+ * @see https://ng-mocks.sudo.eu/api/MockPipe
1140
+ *
1141
+ * ```ts
1142
+ * TestBed.configureTestingModule({
1143
+ * declarations: MockPipes(
1144
+ * Dep1Pipe,
1145
+ * Dep2Pipe,
1146
+ * ),
1147
+ * });
1148
+ * ```
1149
+ */
1150
+ export declare function MockPipes(...pipes: Array<Type<PipeTransform>>): Array<Type<PipeTransform>>;
1151
+ /**
1152
+ * MockPipe creates a mock pipe class out of an arbitrary pipe.
1153
+ *
1154
+ * @see https://ng-mocks.sudo.eu/api/MockPipe
1155
+ *
1156
+ * ```ts
1157
+ * TestBed.configureTestingModule({
1158
+ * declarations: [
1159
+ * MockPipe(Dep1Pipe),
1160
+ * MockPipe(Dep2Pipe),
1161
+ * ],
1162
+ * });
1163
+ * ```
1164
+ */
1165
+ export declare function MockPipe<TPipe extends PipeTransform>(pipe: Type<TPipe>, transform?: TPipe["transform"]): Type<MockedPipe<TPipe>>;
1166
+ /**
1167
+ * MockDeclarations creates an array of mock declaration classes out of declarations passed as parameters.
1168
+ *
1169
+ * @see https://ng-mocks.sudo.eu/api/MockComponent
1170
+ * @see https://ng-mocks.sudo.eu/api/MockDirective
1171
+ * @see https://ng-mocks.sudo.eu/api/MockPipe
1172
+ *
1173
+ * ```ts
1174
+ * TestBed.configureTestingModule({
1175
+ * declarations: MockDeclarations(
1176
+ * Dep1Component,
1177
+ * Dep2Directive,
1178
+ * Dep3Pipe,
1179
+ * ),
1180
+ * });
1181
+ * ```
1182
+ */
1183
+ export declare function MockDeclarations(...declarations: Array<Type<any>>): Array<Type<any>>;
1184
+ /**
1185
+ * MockDeclaration creates a mock declaration class out of an arbitrary declaration.
1186
+ *
1187
+ * @see https://ng-mocks.sudo.eu/api/MockComponent
1188
+ * @see https://ng-mocks.sudo.eu/api/MockDirective
1189
+ * @see https://ng-mocks.sudo.eu/api/MockPipe
1190
+ *
1191
+ * ```ts
1192
+ * TestBed.configureTestingModule({
1193
+ * declarations: [
1194
+ * MockDeclaration(Dep1Component),
1195
+ * MockDeclaration(Dep2Directive),
1196
+ * MockDeclaration(Dep3Pipe),
1197
+ * ],
1198
+ * });
1199
+ * ```
1200
+ */
1201
+ export declare function MockDeclaration<T>(declaration: Type<T>): Type<MockedPipe<T> | MockedDirective<T> | MockedComponent<T>>;
1202
+ /**
1203
+ * MockProviders creates an array of mock providers out of passed as parameters.
1204
+ *
1205
+ * @see https://ng-mocks.sudo.eu/api/MockProvider
1206
+ *
1207
+ * ```ts
1208
+ * TestBed.configureTestingModule({
1209
+ * providers: MockProviders(
1210
+ * Dep1Service,
1211
+ * Dep2Service,
1212
+ * ),
1213
+ * });
1214
+ * ```
1215
+ */
1216
+ export declare function MockProviders(...providers: Array<AnyType<any> | InjectionToken<any>>): FactoryProvider[];
1217
+ /**
1218
+ * MockProvider creates a mock provider out of passed an arbitrary service.
1219
+ *
1220
+ * @see https://ng-mocks.sudo.eu/api/MockProvider
1221
+ *
1222
+ * ```ts
1223
+ * TestBed.configureTestingModule({
1224
+ * providers: [
1225
+ * MockProvider(Dep1Service),
1226
+ * MockProvider(Dep2Service, {
1227
+ * prop: true,
1228
+ * func: () => 'mock',
1229
+ * }),
1230
+ * ],
1231
+ * });
1232
+ * ```
1233
+ */
1234
+ export declare function MockProvider<I extends object>(instance: AnyType<I>, overrides?: Partial<I>): FactoryProvider;
1235
+ /**
1236
+ * MockProvider creates a mock provider out of passed an arbitrary token.
1237
+ *
1238
+ * @see https://ng-mocks.sudo.eu/api/MockProvider
1239
+ *
1240
+ * ```ts
1241
+ * TestBed.configureTestingModule({
1242
+ * providers: [
1243
+ * MockProvider(APP_ID),
1244
+ * MockProvider(WEB_SOCKET, {
1245
+ * prop: true,
1246
+ * func: () => 'mock',
1247
+ * }),
1248
+ * ],
1249
+ * });
1250
+ * ```
1251
+ */
1252
+ export declare function MockProvider<I>(provider: InjectionToken<I>, useValue?: Partial<I>): FactoryProvider;
1253
+ /**
1254
+ * MockProvider creates a mock provider out of passed an arbitrary string token.
1255
+ *
1256
+ * @see https://ng-mocks.sudo.eu/api/MockProvider
1257
+ *
1258
+ * ```ts
1259
+ * TestBed.configureTestingModule({
1260
+ * providers: [
1261
+ * MockProvider('web_socket', {
1262
+ * prop: true,
1263
+ * func: () => 'mock',
1264
+ * }),
1265
+ * ],
1266
+ * });
1267
+ * ```
1268
+ */
1269
+ export declare function MockProvider<I = any>(provider: string, useValue?: Partial<I>): FactoryProvider;
1270
+ /**
1271
+ * MockService creates a mock instance out of an object or a class.
1272
+ * Primitives are converted to undefined.
1273
+ *
1274
+ * @see https://ng-mocks.sudo.eu/api/MockService
1275
+ */
1276
+ export declare function MockService(service: boolean | number | string | null | undefined): undefined;
1277
+ /**
1278
+ * MockService creates a mock instance out of an object or a class.
1279
+ * The second parameter can be used as overrides.
1280
+ *
1281
+ * @see https://ng-mocks.sudo.eu/api/MockService
1282
+ *
1283
+ * ```ts
1284
+ * const service = MockService(AuthService, {
1285
+ * loggedIn: true,
1286
+ * });
1287
+ * service.login(); // does nothing, it's dummy.
1288
+ * ```
1289
+ */
1290
+ export declare function MockService<T>(service: AnyType<T>, overrides?: Partial<T>, mockNamePrefix?: string): T;
1291
+ /**
1292
+ * MockService creates a mock instance out of an object or a class.
1293
+ *
1294
+ * @see https://ng-mocks.sudo.eu/api/MockService
1295
+ *
1296
+ * ```ts
1297
+ * const service = MockService(AuthService);
1298
+ * service.login(); // does nothing, it's dummy.
1299
+ */
1300
+ export declare function MockService<T>(service: AnyType<T>, mockNamePrefix?: string): T;
1301
+ /**
1302
+ * MockService creates a mock instance out of an object or a class.
1303
+ *
1304
+ * @see https://ng-mocks.sudo.eu/api/MockService
1305
+ *
1306
+ * ```ts
1307
+ * const mockUser = MockService(currentUser);
1308
+ * mockUser.save(); // does nothing, it's dummy.
1309
+ */
1310
+ export declare function MockService<T = any>(service: object, mockNamePrefix?: string): T;
1311
+ /**
1312
+ * MockedDebugNode is a way to simply the type of DebugNode.
1313
+ * Usually, it should not be used externally.
1314
+ */
1315
+ export interface MockedDebugNode<T = any> extends DebugNode {
1316
+ componentInstance: T;
1317
+ }
1318
+ /**
1319
+ * MockedDebugElement is a way to simply the type of DebugElement.
1320
+ * Usually, it should not be used externally.
1321
+ */
1322
+ export interface MockedDebugElement<T = any> extends DebugElement, MockedDebugNode<T> {
1323
+ componentInstance: T;
1324
+ }
1325
+ /**
1326
+ * IMockRenderOptions describes parameters for MockRender.
1327
+ *
1328
+ * @see https://ng-mocks.sudo.eu/api/MockRender
1329
+ */
1330
+ export interface IMockRenderOptions {
1331
+ /**
1332
+ * Pass false to suppress the change detection.
1333
+ */
1334
+ detectChanges?: boolean;
1335
+ /**
1336
+ * Extra providers for the testing environment.
1337
+ */
1338
+ providers?: Provider[];
1339
+ /**
1340
+ * Pass true to reset TestBed before render.
1341
+ * Usually, it's done automatically.
1342
+ */
1343
+ reset?: boolean;
1344
+ /**
1345
+ * Extra providers for the testing environment.
1346
+ */
1347
+ viewProviders?: Provider[];
1348
+ }
1349
+ /**
1350
+ * IMockRenderFactoryOptions describes parameters for MockRenderFactory.
1351
+ * By default, it doesn't configure TestBed, but if you need it, you can pass
1352
+ * configureTestBed as true.
1353
+ *
1354
+ * @see https://ng-mocks.sudo.eu/api/MockRender#factory
1355
+ */
1356
+ export interface IMockRenderFactoryOptions extends IMockRenderOptions {
1357
+ configureTestBed?: boolean;
1358
+ }
1359
+ /**
1360
+ * MockedComponentFixture replaces ComponentFixture if MockRender is used.
1361
+ * MockRender provides `fixture.point` to access the rendered component.
1362
+ * MockedComponentFixture helps to define its type correctly.
1363
+ *
1364
+ * @see https://ng-mocks.sudo.eu/api/MockRender
1365
+ */
1366
+ export interface MockedComponentFixture<C = any, F = DefaultRenderComponent<C>> extends ComponentFixture<F> {
1367
+ point: MockedDebugElement<C>;
1368
+ }
1369
+ /**
1370
+ * DefaultRenderComponent described a middleware component `fixture.componentInstance`,
1371
+ * which is used to manipulate `fixture.point.componentInstance`.
1372
+ *
1373
+ * @see https://ng-mocks.sudo.eu/api/MockRender
1374
+ */
1375
+ export declare type DefaultRenderComponent<MComponent extends Record<keyof any, any>> = {
1376
+ [K in keyof MComponent]: MComponent[K];
1377
+ };
1378
+ /**
1379
+ * MockedFunction describes the interface of a function which can be used as a spy.
1380
+ * For example, jasmine.createSpy() and jest.fn() are MockedFunction.
1381
+ *
1382
+ * @see https://ng-mocks.sudo.eu/extra/auto-spy
1383
+ */
1384
+ export declare type MockedFunction = (...args: any[]) => any;
1385
+ /**
1386
+ * CustomMockFunction describes the interface of a factory which should produce MockFunction.
1387
+ * It accepts a label / name and should return a spy / mock function.
1388
+ *
1389
+ * @see https://ng-mocks.sudo.eu/extra/auto-spy
1390
+ */
1391
+ export declare type CustomMockFunction = (mockName: string) => MockedFunction;
1392
+ declare type FORMAT_SINGLE = string | HTMLElement | {
1393
+ nativeNode: any;
1394
+ } | {
1395
+ nativeElement: any;
1396
+ } | {
1397
+ debugElement: any;
1398
+ };
1399
+ declare type FORMAT_SET = string[] | HTMLElement[] | Array<{
1400
+ nativeNode: any;
1401
+ }> | Array<{
1402
+ nativeElement: any;
1403
+ }> | Array<{
1404
+ debugElement: any;
1405
+ }>;
1406
+ /**
1407
+ * ngMocks provides a lot of tools to simply testing.
1408
+ *
1409
+ * @see https://ng-mocks.sudo.eu/api/ngMocks
1410
+ */
1411
+ export declare const ngMocks: {
1412
+ /**
1413
+ * ngMocks.autoSpy installs proper spies instead of empty functions.
1414
+ *
1415
+ * @see https://ng-mocks.sudo.eu/extra/auto-spy
1416
+ */
1417
+ autoSpy(type: "jasmine" | "jest" | "default" | "reset"): void;
1418
+ /**
1419
+ * ngMocks.autoSpy installs proper spies instead of empty functions.
1420
+ *
1421
+ * @see https://ng-mocks.sudo.eu/extra/auto-spy
1422
+ */
1423
+ autoSpy(type: CustomMockFunction): void;
1424
+ /**
1425
+ * ngMocks.defaultConfig sets the default config of declarations for MockBuilder.
1426
+ *
1427
+ * @see https://ng-mocks.sudo.eu/api/ngMocks/defaultConfig
1428
+ */
1429
+ defaultConfig<T>(token: string | InjectionToken<T> | AnyType<T>, config?: IMockBuilderConfig): void;
1430
+ /**
1431
+ * ngMocks.defaultMock sets default customizations of mock tokens.
1432
+ * It helps to avoid repetitions from test to test.
1433
+ *
1434
+ * @see https://ng-mocks.sudo.eu/api/ngMocks/defaultMock
1435
+ */
1436
+ defaultMock<T>(token: InjectionToken<T>, handler?: (value: undefined | T, injector: Injector) => undefined | Partial<T>, config?: IMockBuilderConfig): void;
1437
+ /**
1438
+ * ngMocks.defaultMock sets default customizations of mock string tokens.
1439
+ * It helps to avoid repetitions from test to test.
1440
+ *
1441
+ * @see https://ng-mocks.sudo.eu/api/ngMocks/defaultMock
1442
+ */
1443
+ defaultMock<T = any>(token: string, handler?: (value: undefined | T, injector: Injector) => undefined | Partial<T>, config?: IMockBuilderConfig): void;
1444
+ /**
1445
+ * ngMocks.defaultMock sets default customizations of mock declarations.
1446
+ * It helps to avoid repetitions from test to test.
1447
+ *
1448
+ * @see https://ng-mocks.sudo.eu/api/ngMocks/defaultMock
1449
+ */
1450
+ defaultMock<T>(def: AnyType<T>, handler?: (value: T, injector: Injector) => void | Partial<T>, config?: IMockBuilderConfig): void;
1451
+ /**
1452
+ * ngMocks.defaultMock sets default customizations of mock declarations and tokens.
1453
+ * It helps to avoid repetitions from test to test.
1454
+ *
1455
+ * @see https://ng-mocks.sudo.eu/api/ngMocks/defaultMock
1456
+ */
1457
+ defaultMock<T = any>(defs: Array<AnyType<T> | InjectionToken<T>>, handler?: (value: undefined | T, injector: Injector) => undefined | Partial<T>, config?: IMockBuilderConfig): void;
1458
+ /**
1459
+ * ngMocks.globalExclude configures which declarations, providers and tokens
1460
+ * should be excluded from mocks.
1461
+ *
1462
+ * @see https://ng-mocks.sudo.eu/api/ngMocks/globalExclude
1463
+ *
1464
+ * ```ts
1465
+ * ngMocks.globalExclude(TranslationModule);
1466
+ * ```
1467
+ */
1468
+ globalExclude(source: AnyType<any> | InjectionToken<any>): void;
1469
+ /**
1470
+ * ngMocks.globalKeep configures which declarations, providers and tokens
1471
+ * should not be mocked and will stay as they are in mocks.
1472
+ *
1473
+ * @see https://ng-mocks.sudo.eu/api/ngMocks/globalKeep
1474
+ *
1475
+ * ```ts
1476
+ * ngMocks.globalKeep(TranslationModule);
1477
+ * ```
1478
+ */
1479
+ globalKeep(source: AnyType<any> | InjectionToken<any>): void;
1480
+ /**
1481
+ * ngMocks.globalMock configures which declarations, providers and tokens
1482
+ * should be mocked in kept declarations.
1483
+ *
1484
+ * @see https://ng-mocks.sudo.eu/api/ngMocks/globalMock
1485
+ *
1486
+ * ```ts
1487
+ * ngMocks.globalMock(TranslationModule);
1488
+ * ```
1489
+ */
1490
+ globalMock(source: AnyType<any> | InjectionToken<any>): void;
1491
+ /**
1492
+ * ngMocks.globalReplace configures which declarations, providers and tokens
1493
+ * should be substituted in mocks.
1494
+ *
1495
+ * @see https://ng-mocks.sudo.eu/api/ngMocks/globalReplace
1496
+ *
1497
+ * ```ts
1498
+ * ngMocks.globalReplace(BrowserAnimationsModule, NoopAnimationsModule);
1499
+ * ```
1500
+ */
1501
+ globalReplace(source: AnyType<any>, destination: AnyType<any>): void;
1502
+ /**
1503
+ * ngMocks.globalWipe resets all customizations of ngMocks.global* and mgMocks.default* functions.
1504
+ *
1505
+ * @see https://ng-mocks.sudo.eu/api/ngMocks/globalWipe
1506
+ *
1507
+ * ```ts
1508
+ * ngMocks.globalWipe(TranslationModule);
1509
+ * ngMocks.globalWipe(BrowserAnimationsModule);
1510
+ * ```
1511
+ */
1512
+ globalWipe(source: AnyType<any> | InjectionToken<any>): void;
1513
+ /**
1514
+ * ngMocks.change triggers ControlValueAccessor update.
1515
+ *
1516
+ * @see https://ng-mocks.sudo.eu/api/ngMocks/change
1517
+ */
1518
+ change(elSelector: DebugNodeSelector, value: any): void;
1519
+ /**
1520
+ * ngMocks.touch triggers ControlValueAccessor touch.
1521
+ *
1522
+ * @see https://ng-mocks.sudo.eu/api/ngMocks/touch
1523
+ */
1524
+ touch(elSelector: DebugNode | DebugNodeSelector): void;
1525
+ /**
1526
+ * ngMocks.click properly simulates a click on an element.
1527
+ *
1528
+ * @see https://ng-mocks.sudo.eu/api/ngMocks/click
1529
+ */
1530
+ click(elSelector: HTMLElement | DebugNodeSelector, payload?: Partial<MouseEvent>): void;
1531
+ /**
1532
+ * ngMocks.trigger lets trigger custom events on DebugElements.
1533
+ *
1534
+ * @see https://ng-mocks.sudo.eu/api/ngMocks/trigger
1535
+ *
1536
+ * ```ts
1537
+ * ngMocks.trigger(el, new CustomEvent('my-event'));
1538
+ * ```
1539
+ */
1540
+ trigger(elSelector: DebugNodeSelector, event: Event): void;
1541
+ /**
1542
+ * ngMocks.trigger lets trigger custom events on DebugElements.
1543
+ *
1544
+ * @see https://ng-mocks.sudo.eu/api/ngMocks/trigger
1545
+ *
1546
+ * ```ts
1547
+ * ngMocks.trigger(el, 'click');
1548
+ * ngMocks.trigger(el, 'keydown.control.shift.z');
1549
+ * ```
1550
+ */
1551
+ trigger(elSelector: HTMLElement | DebugNodeSelector, event: string, payload?: Partial<UIEvent | KeyboardEvent | MouseEvent | TouchEvent>): void;
1552
+ /**
1553
+ * ngMocks.event builds correct event objects.
1554
+ *
1555
+ * @see https://ng-mocks.sudo.eu/api/ngMocks/event
1556
+ */
1557
+ event(event: string, init?: EventInit, overrides?: Partial<UIEvent | KeyboardEvent | MouseEvent | TouchEvent | Event>): Event;
1558
+ /**
1559
+ * ngMocks.render renders a templateRef or DebugElement.
1560
+ *
1561
+ * @see https://ng-mocks.sudo.eu/api/ngMocks/render
1562
+ *
1563
+ * ```ts
1564
+ * ngMocks.header(component, headerEl);
1565
+ * ```
1566
+ */
1567
+ render(instance: object, template: TemplateRef<any> | DebugNode, $implicit?: any, variables?: Record<keyof any, any>): void;
1568
+ /**
1569
+ * ngMocks.render renders a structural directive.
1570
+ *
1571
+ * @see https://ng-mocks.sudo.eu/api/ngMocks/render
1572
+ *
1573
+ * ```ts
1574
+ * ngMocks.render(component, directiveInstance);
1575
+ * ```
1576
+ */
1577
+ render(instance: object, directive: object, $implicit?: any, variables?: Record<keyof any, any>): void;
1578
+ /**
1579
+ * ngMocks.hide hides a rendered templateRef or DebugElement.
1580
+ *
1581
+ * @see https://ng-mocks.sudo.eu/api/ngMocks/hide
1582
+ *
1583
+ * ```ts
1584
+ * ngMocks.hide(component, headerEl);
1585
+ * ```
1586
+ */
1587
+ hide(instance: object, tpl?: TemplateRef<any> | DebugNode): void;
1588
+ /**
1589
+ * ngMocks.hide hides a rendered structural directive.
1590
+ *
1591
+ * @see https://ng-mocks.sudo.eu/api/ngMocks/hide
1592
+ *
1593
+ * ```ts
1594
+ * ngMocks.hide(component, directiveInstance);
1595
+ * ```
1596
+ */
1597
+ hide(instance: object, directive: object): void;
1598
+ /**
1599
+ * ngMocks.input allows to get an input value without knowing
1600
+ * which component / directive it belongs to.
1601
+ *
1602
+ * @see https://ng-mocks.sudo.eu/api/ngMocks/input
1603
+ *
1604
+ * ```ts
1605
+ * const input = ngMocks.input('app-component', 'version');
1606
+ * ```
1607
+ */
1608
+ input<T = any>(elSelector: DebugNodeSelector, input: string): T;
1609
+ /**
1610
+ * ngMocks.input allows to get an input value without knowing
1611
+ * which component / directive it belongs to, otherwise the notFoundValue.
1612
+ *
1613
+ * @see https://ng-mocks.sudo.eu/api/ngMocks/input
1614
+ *
1615
+ * ```ts
1616
+ * const input = ngMocks.input('app-component', 'version', undefined);
1617
+ * ```
1618
+ */
1619
+ input<T = any, D = undefined>(elSelector: DebugNodeSelector, input: string, notFoundValue: D): D | T;
1620
+ /**
1621
+ * ngMocks.output allows to get an output emitter without knowing
1622
+ * which component / directive it belongs to.
1623
+ *
1624
+ * @see https://ng-mocks.sudo.eu/api/ngMocks/output
1625
+ *
1626
+ * ```ts
1627
+ * const outputEmitter = ngMocks.output('app-component', 'update');
1628
+ * ```
1629
+ */
1630
+ output<T = any>(elSelector: DebugNodeSelector, output: string): EventEmitter<T>;
1631
+ /**
1632
+ * ngMocks.output allows to get an output emitter without knowing
1633
+ * which component / directive it belongs to, otherwise the notFoundValue.
1634
+ *
1635
+ * @see https://ng-mocks.sudo.eu/api/ngMocks/output
1636
+ *
1637
+ * ```ts
1638
+ * const outputEmitter = ngMocks.output('app-component', 'update', undefined);
1639
+ * ```
1640
+ */
1641
+ output<T = any, D = undefined>(elSelector: DebugNodeSelector, output: string, notFoundValue: D): D | EventEmitter<T>;
1642
+ /**
1643
+ * ngMocks.find searches for the DebugElement of a particular component,
1644
+ * and returns the first found.
1645
+ *
1646
+ * @see https://ng-mocks.sudo.eu/api/ngMocks/find
1647
+ *
1648
+ * ```ts
1649
+ * const el = ngMocks.find(MyComponent);
1650
+ * ```
1651
+ */
1652
+ find<T>(component: Type<T>): MockedDebugElement<T>;
1653
+ /**
1654
+ * ngMocks.find searches for the DebugElement of a particular component
1655
+ * starting from an element, and returns the first found.
1656
+ *
1657
+ * @see https://ng-mocks.sudo.eu/api/ngMocks/find
1658
+ *
1659
+ * ```ts
1660
+ * const el = ngMocks.find(fixture.debugElement, MyComponent);
1661
+ * ```
1662
+ */
1663
+ find<T>(debugElement: MockedDebugElement | ComponentFixture<any> | undefined | null, component: Type<T>): MockedDebugElement<T>;
1664
+ /**
1665
+ * ngMocks.find searches for the DebugElement of a particular component,
1666
+ * and returns the first found, otherwise the notFoundValue.
1667
+ *
1668
+ * @see https://ng-mocks.sudo.eu/api/ngMocks/find
1669
+ *
1670
+ * ```ts
1671
+ * const el = ngMocks.find(MyComponent, undefined);
1672
+ * ```
1673
+ */
1674
+ find<T, D>(component: Type<T>, notFoundValue: D): D | MockedDebugElement<T>;
1675
+ /**
1676
+ * ngMocks.find searches for the DebugElement of a particular component
1677
+ * starting from an element, and returns the first found, otherwise the notFoundValue.
1678
+ *
1679
+ * @see https://ng-mocks.sudo.eu/api/ngMocks/find
1680
+ *
1681
+ * ```ts
1682
+ * const el = ngMocks.find(fixture, MyComponent, undefined);
1683
+ * ```
1684
+ */
1685
+ find<T, D>(debugElement: MockedDebugElement | ComponentFixture<any> | undefined | null, component: Type<T>, notFoundValue: D): D | MockedDebugElement<T>;
1686
+ /**
1687
+ * ngMocks.find searches for the DebugElement based on css selector,
1688
+ * and returns the first found.
1689
+ *
1690
+ * @see https://ng-mocks.sudo.eu/api/ngMocks/find
1691
+ *
1692
+ * ```ts
1693
+ * const el = ngMocks.find('.header');
1694
+ * const el = ngMocks.find('[data-key=5]');
1695
+ * const el = ngMocks.find(['data-key', 5]);
1696
+ * ```
1697
+ */
1698
+ find<T = any>(cssSelector: string | [
1699
+ string
1700
+ ] | [
1701
+ string,
1702
+ string | number
1703
+ ]): MockedDebugElement<T>;
1704
+ /**
1705
+ * ngMocks.find searches for the DebugElement based on css selector
1706
+ * starting from an element, and returns the first found.
1707
+ *
1708
+ * @see https://ng-mocks.sudo.eu/api/ngMocks/find
1709
+ *
1710
+ * ```ts
1711
+ * const el = ngMocks.find(fixture.debugElement, '.header');
1712
+ * const el = ngMocks.find(fixture, '[data-key=5]');
1713
+ * const el = ngMocks.find(debugElement, ['data-key', 5]);
1714
+ * ```
1715
+ */
1716
+ find<T = any>(debugElement: MockedDebugElement | ComponentFixture<any> | undefined | null, cssSelector: string | [
1717
+ string
1718
+ ] | [
1719
+ string,
1720
+ string | number
1721
+ ]): MockedDebugElement<T>;
1722
+ /**
1723
+ * ngMocks.find searches for the DebugElement based on css selector,
1724
+ * and returns the first found, otherwise the notFoundValue.
1725
+ *
1726
+ * @see https://ng-mocks.sudo.eu/api/ngMocks/find
1727
+ *
1728
+ * ```ts
1729
+ * const el = ngMocks.find('.header', undefined);
1730
+ * const el = ngMocks.find('[data-key=5]', null);
1731
+ * const el = ngMocks.find(['data-key', 5], null);
1732
+ * ```
1733
+ */
1734
+ find<T = any, D = undefined>(cssSelector: string | [
1735
+ string
1736
+ ] | [
1737
+ string,
1738
+ string | number
1739
+ ], notFoundValue: D): D | MockedDebugElement<T>;
1740
+ /**
1741
+ * ngMocks.find searches for the DebugElement based on css selector
1742
+ * starting from an element, and returns the first found, otherwise the notFoundValue.
1743
+ *
1744
+ * @see https://ng-mocks.sudo.eu/api/ngMocks/find
1745
+ *
1746
+ * ```ts
1747
+ * const el = ngMocks.find(fixture.debugElement, '.header', undefined);
1748
+ * const el = ngMocks.find(fixture, '[data-key=5]', null);
1749
+ * const el = ngMocks.find(debugElement, ['data-key', 5], null);
1750
+ * ```
1751
+ */
1752
+ find<T = any, D = undefined>(debugElement: MockedDebugElement | ComponentFixture<any> | undefined | null, cssSelector: string | [
1753
+ string
1754
+ ] | [
1755
+ string,
1756
+ string | number
1757
+ ], notFoundValue: D): D | MockedDebugElement<T>;
1758
+ /**
1759
+ * ngMocks.findAll searches for all DebugElements of a particular component,
1760
+ * and returns an array of them.
1761
+ *
1762
+ * @see https://ng-mocks.sudo.eu/api/ngMocks/findAll
1763
+ *
1764
+ * ```ts
1765
+ * const all = ngMocks.findAll(MyComponent);
1766
+ * ```
1767
+ */
1768
+ findAll<T>(component: Type<T>): Array<MockedDebugElement<T>>;
1769
+ /**
1770
+ * ngMocks.findAll searches for all DebugElements of a particular component
1771
+ * starting from an element, and returns an array of them.
1772
+ *
1773
+ * @see https://ng-mocks.sudo.eu/api/ngMocks/findAll
1774
+ *
1775
+ * ```ts
1776
+ * const all = ngMocks.findAll(fixture.debugElement, MyComponent);
1777
+ * ```
1778
+ */
1779
+ findAll<T>(debugElement: MockedDebugElement | ComponentFixture<any> | undefined | null, component: Type<T>): Array<MockedDebugElement<T>>;
1780
+ /**
1781
+ * ngMocks.findAll searches for all DebugElements based on css selector,
1782
+ * and returns an array of them.
1783
+ *
1784
+ * @see https://ng-mocks.sudo.eu/api/ngMocks/findAll
1785
+ *
1786
+ * ```ts
1787
+ * const all = ngMocks.findAll('.header');
1788
+ * const all = ngMocks.findAll('[data-key=5]');
1789
+ * const all = ngMocks.findAll(['data-key', 5]);
1790
+ * ```
1791
+ */
1792
+ findAll<T = any>(cssSelector: string | [
1793
+ string
1794
+ ] | [
1795
+ string,
1796
+ string | number
1797
+ ]): Array<MockedDebugElement<T>>;
1798
+ /**
1799
+ * ngMocks.findAll searches for all DebugElements based on css selector
1800
+ * starting from an element, and returns an array of them.
1801
+ *
1802
+ * @see https://ng-mocks.sudo.eu/api/ngMocks/findAll
1803
+ *
1804
+ * ```ts
1805
+ * const all = ngMocks.findAll(fixture.debugElement, '.header');
1806
+ * const all = ngMocks.findAll(fixture, '[data-key=5]');
1807
+ * const all = ngMocks.findAll(debugElement, ['data-key', 5]);
1808
+ * ```
1809
+ */
1810
+ findAll<T = any>(debugElement: MockedDebugElement | ComponentFixture<any> | undefined | null, cssSelector: string | [
1811
+ string
1812
+ ] | [
1813
+ string,
1814
+ string | number
1815
+ ]): Array<MockedDebugElement<T>>;
1816
+ /**
1817
+ * ngMocks.reveal allows finding DebugNodes which belong to ng-container or ng-template.
1818
+ *
1819
+ * @see https://ng-mocks.sudo.eu/api/ngMocks/reveal
1820
+ *
1821
+ * ```ts
1822
+ * const ngContainer = ngMocks.reveal(HeaderComponent);
1823
+ * ```
1824
+ */
1825
+ reveal<T>(selector: AnyType<T>): MockedDebugNode<T> | MockedDebugElement<T>;
1826
+ /**
1827
+ * ngMocks.reveal allows finding DebugNodes which belong to ng-container or ng-template
1828
+ * starting from an element.
1829
+ *
1830
+ * @see https://ng-mocks.sudo.eu/api/ngMocks/reveal
1831
+ *
1832
+ * ```ts
1833
+ * const ngContainer = ngMocks.reveal('header', HeaderComponent);
1834
+ * ```
1835
+ */
1836
+ reveal<T>(elSelector: DebugNodeSelector, selector: AnyType<T>): MockedDebugNode<T> | MockedDebugElement<T>;
1837
+ /**
1838
+ * ngMocks.reveal allows finding DebugNodes which belong to ng-container or ng-template.
1839
+ *
1840
+ * @see https://ng-mocks.sudo.eu/api/ngMocks/reveal
1841
+ *
1842
+ * ```ts
1843
+ * const ngContainer = ngMocks.reveal(['tpl', 'header']);
1844
+ * ```
1845
+ */
1846
+ reveal<T = any>(selector: string | [
1847
+ string
1848
+ ] | [
1849
+ string,
1850
+ any
1851
+ ]): MockedDebugNode<T> | MockedDebugElement<T>;
1852
+ /**
1853
+ * ngMocks.reveal allows finding DebugNodes which belong to ng-container or ng-template
1854
+ * starting from an element.
1855
+ *
1856
+ * @see https://ng-mocks.sudo.eu/api/ngMocks/reveal
1857
+ *
1858
+ * ```ts
1859
+ * const ngContainer = ngMocks.reveal('header', ['tpl', 'header']);
1860
+ * ```
1861
+ */
1862
+ reveal<T = any>(elSelector: DebugNodeSelector, selector: string | [
1863
+ string
1864
+ ] | [
1865
+ string,
1866
+ any
1867
+ ]): MockedDebugNode<T> | MockedDebugElement<T>;
1868
+ /**
1869
+ * ngMocks.reveal allows finding DebugNodes which belong to ng-container or ng-template,
1870
+ * otherwise the notFoundValue.
1871
+ *
1872
+ * @see https://ng-mocks.sudo.eu/api/ngMocks/reveal
1873
+ *
1874
+ * ```ts
1875
+ * const ngContainer = ngMocks.reveal(HeaderComponent, undefined);
1876
+ * ```
1877
+ */
1878
+ reveal<T, D>(selector: AnyType<T>, notFoundValue: D): D | MockedDebugNode<T> | MockedDebugElement<T>;
1879
+ /**
1880
+ * ngMocks.reveal allows finding DebugNodes which belong to ng-container or ng-template
1881
+ * starting from an element, otherwise the notFoundValue.
1882
+ *
1883
+ * @see https://ng-mocks.sudo.eu/api/ngMocks/reveal
1884
+ *
1885
+ * ```ts
1886
+ * const ngContainer = ngMocks.reveal('sidebar', HeaderComponent, undefined);
1887
+ * ```
1888
+ */
1889
+ reveal<T, D>(elSelector: DebugNodeSelector, selector: AnyType<T>, notFoundValue: D): D | MockedDebugNode<T> | MockedDebugElement<T>;
1890
+ /**
1891
+ * ngMocks.reveal allows finding DebugNodes which belong to ng-container or ng-template,
1892
+ * otherwise the notFoundValue.
1893
+ *
1894
+ * @see https://ng-mocks.sudo.eu/api/ngMocks/reveal
1895
+ *
1896
+ * ```ts
1897
+ * const ngContainer = ngMocks.reveal(['tpl', 'header'], undefined);
1898
+ * ```
1899
+ */
1900
+ reveal<T = any, D = undefined>(selector: string | [
1901
+ string
1902
+ ] | [
1903
+ string,
1904
+ any
1905
+ ], notFoundValue: D): D | MockedDebugNode<T> | MockedDebugElement<T>;
1906
+ /**
1907
+ * ngMocks.reveal allows finding DebugNodes which belong to ng-container or ng-template
1908
+ * starting from an element, otherwise the notFoundValue.
1909
+ *
1910
+ * @see https://ng-mocks.sudo.eu/api/ngMocks/reveal
1911
+ *
1912
+ * ```ts
1913
+ * const ngContainer = ngMocks.reveal('sidebar', ['tpl', 'header'], undefined);
1914
+ * ```
1915
+ */
1916
+ reveal<T = any, D = undefined>(elSelector: DebugNodeSelector, selector: string | [
1917
+ string
1918
+ ] | [
1919
+ string,
1920
+ any
1921
+ ], notFoundValue: D): D | MockedDebugNode<T> | MockedDebugElement<T>;
1922
+ /**
1923
+ * ngMocks.revealAll allows finding all DebugNodes which belong to ng-container or ng-template.
1924
+ *
1925
+ * @see https://ng-mocks.sudo.eu/api/ngMocks/revealAll
1926
+ *
1927
+ * ```ts
1928
+ * const ngContainers = ngMocks.revealAll(HeaderComponent);
1929
+ * ```
1930
+ */
1931
+ revealAll<T>(selector: AnyType<T>): Array<MockedDebugNode<T> | MockedDebugElement<T>>;
1932
+ /**
1933
+ * ngMocks.reveal allows finding all DebugNodes which belong to ng-container or ng-template.
1934
+ *
1935
+ * @see https://ng-mocks.sudo.eu/api/ngMocks/revealAll
1936
+ *
1937
+ * ```ts
1938
+ * const ngContainers = ngMocks.revealAll(['tpl', 'header']);
1939
+ * ```
1940
+ */
1941
+ revealAll<T = any>(selector: string | [
1942
+ string
1943
+ ] | [
1944
+ string,
1945
+ any
1946
+ ]): Array<MockedDebugNode<T> | MockedDebugElement<T>>;
1947
+ /**
1948
+ * ngMocks.reveal allows finding all DebugNodes which belong to ng-container or ng-template
1949
+ * starting from an element.
1950
+ *
1951
+ * @see https://ng-mocks.sudo.eu/api/ngMocks/revealAll
1952
+ *
1953
+ * ```ts
1954
+ * const ngContainers = ngMocks.revealAll('sidebar', HeaderComponent);
1955
+ * ```
1956
+ */
1957
+ revealAll<T>(elSelector: DebugNodeSelector, selector: AnyType<T>): Array<MockedDebugNode<T> | MockedDebugElement<T>>;
1958
+ /**
1959
+ * ngMocks.reveal allows finding all DebugNodes which belong to ng-container or ng-template
1960
+ * starting from an element.
1961
+ *
1962
+ * @see https://ng-mocks.sudo.eu/api/ngMocks/revealAll
1963
+ *
1964
+ * ```ts
1965
+ * const ngContainers = ngMocks.revealAll('sidebar', ['tpl', 'header']);
1966
+ * ```
1967
+ */
1968
+ revealAll<T = any>(elSelector: DebugNodeSelector, selector: string | [
1969
+ string
1970
+ ] | [
1971
+ string,
1972
+ any
1973
+ ]): Array<MockedDebugNode<T> | MockedDebugElement<T>>;
1974
+ /**
1975
+ * ngMocks.get tries to get an instance of declaration, provider or token
1976
+ * from the element which is matching a selector.
1977
+ *
1978
+ * @see https://ng-mocks.sudo.eu/api/ngMocks/get
1979
+ *
1980
+ * ```ts
1981
+ * const myComponent = ngMocks.get('my-component', MyComponent);
1982
+ * const myDirective = ngMocks.get('my-component', MyDirective);
1983
+ * ```
1984
+ */
1985
+ get<T>(elSelector: DebugNodeSelector, provider: AnyType<T> | InjectionToken<T>): T;
1986
+ /**
1987
+ * ngMocks.get tries to get an instance of declaration, provider or token
1988
+ * from the element which is matching a selector, otherwise the notFoundValue.
1989
+ *
1990
+ * @see https://ng-mocks.sudo.eu/api/ngMocks/get
1991
+ *
1992
+ * ```ts
1993
+ * const myComponent = ngMocks.get('my-component', MyComponent, undefined);
1994
+ * const myDirective = ngMocks.get('my-component', MyDirective, null);
1995
+ * ```
1996
+ */
1997
+ get<T, D>(elSelector: DebugNodeSelector, provider: AnyType<T> | InjectionToken<T>, notFoundValue: D): D | T;
1998
+ /**
1999
+ * ngMocks.findInstance searches for an instance of declaration, provider or token,
2000
+ * and returns the first one.
2001
+ *
2002
+ * @see https://ng-mocks.sudo.eu/api/ngMocks/findInstance
2003
+ *
2004
+ * ```ts
2005
+ * const component = ngMocks.findInstance(SidebarComponent);
2006
+ * const service = ngMocks.findInstance(AuthService);
2007
+ * const config = ngMocks.findInstance(APP_CONFIG);
2008
+ * ```
2009
+ */
2010
+ findInstance<T>(instanceClass: AnyType<T> | InjectionToken<T>): T;
2011
+ /**
2012
+ * ngMocks.findInstance searches for an instance of declaration, provider or token
2013
+ * starting from an element, and returns the first one.
2014
+ *
2015
+ * @see https://ng-mocks.sudo.eu/api/ngMocks/findInstance
2016
+ *
2017
+ * ```ts
2018
+ * const component = ngMocks.findInstance(fixture, SidebarComponent);
2019
+ * const service = ngMocks.findInstance('header', AuthService);
2020
+ * const config = ngMocks.findInstance(debugElement, APP_CONFIG);
2021
+ * ```
2022
+ */
2023
+ findInstance<T>(elSelector: DebugNodeSelector, instanceClass: AnyType<T> | InjectionToken<T>): T;
2024
+ /**
2025
+ * ngMocks.findInstance searches for an instance of declaration, provider or token,
2026
+ * and returns the first one, otherwise the notFoundValue.
2027
+ *
2028
+ * @see https://ng-mocks.sudo.eu/api/ngMocks/findInstance
2029
+ *
2030
+ * ```ts
2031
+ * const component = ngMocks.findInstance(SidebarComponent, undefined);
2032
+ * const service = ngMocks.findInstance(AuthService, null);
2033
+ * const config = ngMocks.findInstance(APP_CONFIG, false);
2034
+ */
2035
+ findInstance<T, D>(instanceClass: AnyType<T> | InjectionToken<T>, notFoundValue: D): D | T;
2036
+ /**
2037
+ * ngMocks.findInstance searches for an instance of declaration, provider or token
2038
+ * starting from an element, and returns the first one, otherwise the notFoundValue.
2039
+ *
2040
+ * @see https://ng-mocks.sudo.eu/api/ngMocks/findInstance
2041
+ *
2042
+ * ```ts
2043
+ * const component = ngMocks.findInstance(fixture, SidebarComponent, undefined);
2044
+ * const service = ngMocks.findInstance('header', AuthService, null);
2045
+ * const config = ngMocks.findInstance(debugElement, APP_CONFIG, false);
2046
+ * ```
2047
+ */
2048
+ findInstance<T, D>(elSelector: DebugNodeSelector, instanceClass: AnyType<T> | InjectionToken<T>, notFoundValue: D): D | T;
2049
+ /**
2050
+ * ngMocks.findInstances searches for all instances of declaration, provider or token,
2051
+ * and returns an array of them.
2052
+ *
2053
+ * @see https://ng-mocks.sudo.eu/api/ngMocks/findInstances
2054
+ *
2055
+ * ```ts
2056
+ * const components = ngMocks.findInstances(SidebarComponent);
2057
+ * const services = ngMocks.findInstances(AuthService);
2058
+ * const configs = ngMocks.findInstances(APP_CONFIG);
2059
+ * ```
2060
+ */
2061
+ findInstances<T>(instanceClass: AnyType<T> | InjectionToken<T>): T[];
2062
+ /**
2063
+ * ngMocks.findInstances searches for all instances of declaration, provider or token
2064
+ * starting from an element, and returns an array of them.
2065
+ *
2066
+ * @see https://ng-mocks.sudo.eu/api/ngMocks/findInstances
2067
+ *
2068
+ * ```ts
2069
+ * const components = ngMocks.findInstances(fixture, SidebarComponent);
2070
+ * const services = ngMocks.findInstances('header', AuthService);
2071
+ * const configs = ngMocks.findInstances(debugElement, APP_CONFIG);
2072
+ * ```
2073
+ */
2074
+ findInstances<T>(elSelector: DebugNodeSelector, instanceClass: AnyType<T> | InjectionToken<T>): T[];
2075
+ /**
2076
+ * ngMocks.findTemplateRef searches for a TemplateRef which is matching the selector,
2077
+ * and returns the first found, otherwise the notFoundValue.
2078
+ * The TemplateRef can be rendered later on.
2079
+ *
2080
+ * @see https://ng-mocks.sudo.eu/api/ngMocks/findTemplateRef
2081
+ *
2082
+ * ```ts
2083
+ * const templateRef = ngMocks.findTemplateRef('sidebar', StructuralDirective, undefined);
2084
+ * ```
2085
+ */
2086
+ findTemplateRef<T = any, D = undefined>(elSelector: DebugNodeSelector, selector: string | [
2087
+ string
2088
+ ] | [
2089
+ string,
2090
+ any
2091
+ ] | AnyType<any>, notFoundValue: D): D | TemplateRef<T>;
2092
+ /**
2093
+ * ngMocks.findTemplateRef searches for a TemplateRef which is matching the selector,
2094
+ * and returns the first found.
2095
+ * The TemplateRef can be rendered later on.
2096
+ *
2097
+ * @see https://ng-mocks.sudo.eu/api/ngMocks/findTemplateRef
2098
+ *
2099
+ * ```ts
2100
+ * const templateRef = ngMocks.findTemplateRef('sidebar', StructuralDirective);
2101
+ * ```
2102
+ */
2103
+ findTemplateRef<T = any>(elSelector: DebugNodeSelector, selector: string | [
2104
+ string
2105
+ ] | [
2106
+ string,
2107
+ any
2108
+ ] | AnyType<any>): TemplateRef<T>;
2109
+ /**
2110
+ * ngMocks.findTemplateRef searches for a TemplateRef which is matching the selector,
2111
+ * and returns the first found, otherwise the notFoundValue.
2112
+ * The TemplateRef can be rendered later on.
2113
+ *
2114
+ * @see https://ng-mocks.sudo.eu/api/ngMocks/findTemplateRef
2115
+ *
2116
+ * ```ts
2117
+ * const templateRef = ngMocks.findTemplateRef(['mat-row'], null);
2118
+ * ```
2119
+ */
2120
+ findTemplateRef<T = any, D = undefined>(selector: string | [
2121
+ string
2122
+ ] | [
2123
+ string,
2124
+ any
2125
+ ] | AnyType<any>, notFoundValue: D): D | TemplateRef<T>;
2126
+ /**
2127
+ * ngMocks.findTemplateRef searches for a TemplateRef which is matching the selector,
2128
+ * and returns the first found.
2129
+ * The TemplateRef can be rendered later on.
2130
+ *
2131
+ * @see https://ng-mocks.sudo.eu/api/ngMocks/findTemplateRef
2132
+ *
2133
+ * ```ts
2134
+ * const templateRef = ngMocks.findTemplateRef(['mat-row']);
2135
+ * ```
2136
+ */
2137
+ findTemplateRef<T = any>(selector: string | [
2138
+ string
2139
+ ] | [
2140
+ string,
2141
+ any
2142
+ ] | AnyType<any>): TemplateRef<T>;
2143
+ /**
2144
+ * ngMocks.findTemplateRefs searches for all TemplateRefs which is matching the selector
2145
+ * starting from an element, and returns an array of them.
2146
+ * The TemplateRef can be rendered later on.
2147
+ *
2148
+ * @see https://ng-mocks.sudo.eu/api/ngMocks/findTemplateRefs
2149
+ *
2150
+ * ```ts
2151
+ * const templateRefs = ngMocks.findTemplateRefs('header', StructuralDirective);
2152
+ * ```
2153
+ */
2154
+ findTemplateRefs<T = any>(elSelector: DebugNodeSelector, selector: string | [
2155
+ string
2156
+ ] | [
2157
+ string,
2158
+ any
2159
+ ] | AnyType<any>): Array<TemplateRef<T>>;
2160
+ /**
2161
+ * ngMocks.findTemplateRefs searches for all TemplateRefs which is matching the selector,
2162
+ * and returns an array of them.
2163
+ * The TemplateRef can be rendered later on.
2164
+ *
2165
+ * @see https://ng-mocks.sudo.eu/api/ngMocks/findTemplateRefs
2166
+ *
2167
+ * ```ts
2168
+ * const templateRefs = ngMocks.findTemplateRefs(['mat-row']);
2169
+ * ```
2170
+ */
2171
+ findTemplateRefs<T = any>(selector: string | [
2172
+ string
2173
+ ] | [
2174
+ string,
2175
+ any
2176
+ ] | AnyType<any>): Array<TemplateRef<T>>;
2177
+ /**
2178
+ * ngMocks.crawl correctly crawls through Angular DOM with respect of TemplateRefs and ng-containers.
2179
+ * Usually, it's used internally.
2180
+ *
2181
+ * @see https://ng-mocks.sudo.eu/api/ngMocks/crawl
2182
+ */
2183
+ crawl(elSelector: DebugNodeSelector, callback: (node: MockedDebugNode | MockedDebugElement, parent?: MockedDebugNode | MockedDebugElement) => boolean | void, includeTextNodes?: boolean): void;
2184
+ /**
2185
+ * ngMocks.stub lets replace a method, getter or setter with a dummy callback.
2186
+ *
2187
+ * @see https://ng-mocks.sudo.eu/api/ngMocks/stub
2188
+ *
2189
+ * ```ts
2190
+ * ngMocks.stub(instance, 'save'); // save is an empty callback now.
2191
+ * ngMocks.stub(instance, 'user', 'get'); // getter is an empty callback now.
2192
+ * ngMocks.stub(instance, 'user', 'set'); // setter is an empty callback now.
2193
+ * ```
2194
+ */
2195
+ stub<T = MockedFunction, I = any>(instance: I, name: keyof I, style?: "get" | "set"): T;
2196
+ /**
2197
+ * ngMocks.stub lets apply partial customizations to an instance.
2198
+ *
2199
+ * @see https://ng-mocks.sudo.eu/api/ngMocks/stub
2200
+ *
2201
+ * ```ts
2202
+ * ngMocks.stub(instance, {
2203
+ * save: () => undefined,
2204
+ * user: null,
2205
+ * });
2206
+ * ```
2207
+ */
2208
+ stub<I extends object>(instance: I, overrides: Partial<I>): I;
2209
+ /**
2210
+ * ngMocks.stubMember lets inject spies it to getters of properties of an instance.
2211
+ *
2212
+ * @see https://ng-mocks.sudo.eu/api/ngMocks/stubMember
2213
+ *
2214
+ * ```ts
2215
+ * ngMocks.stubMember(instance, 'user', jasmine.createSpy(), 'get')
2216
+ * .and.returnValue(null);
2217
+ * ```
2218
+ */
2219
+ stubMember<T extends object, K extends keyof T, S extends () => T[K]>(instance: T, name: K, stub: S, encapsulation: "get"): S;
2220
+ /**
2221
+ * ngMocks.stubMember lets inject spies it to setters of properties of an instance.
2222
+ *
2223
+ * @see https://ng-mocks.sudo.eu/api/ngMocks/stubMember
2224
+ *
2225
+ * ```ts
2226
+ * ngMocks.stubMember(instance, 'user', jasmine.createSpy(), 'set')
2227
+ * .and.throwError('setter is forbidden');
2228
+ * ```
2229
+ */
2230
+ stubMember<T extends object, K extends keyof T, S extends (value: T[K]) => void>(instance: T, name: K, stub: S, encapsulation: "set"): S;
2231
+ /**
2232
+ * ngMocks.stubMember lets inject spies it to an instance.
2233
+ *
2234
+ * @see https://ng-mocks.sudo.eu/api/ngMocks/stubMember
2235
+ *
2236
+ * ```ts
2237
+ * ngMocks.stubMember(instance, 'save', jasmine.createSpy());
2238
+ * ngMocks.stubMember(instance, 'user', null);
2239
+ * ```
2240
+ */
2241
+ stubMember<T extends object, K extends keyof T, S extends T[K]>(instance: T, name: K, stub: S): S;
2242
+ /**
2243
+ * ngMocks.guts provides a simple way to configure complex mocks.
2244
+ * Please check documentation.
2245
+ *
2246
+ * @see https://ng-mocks.sudo.eu/api/ngMocks/guts
2247
+ */
2248
+ guts(keep: AnyType<any> | InjectionToken<any> | Provider | Array<AnyType<any> | InjectionToken<any> | Provider> | null | undefined, mock?: AnyType<any> | InjectionToken<any> | NgModuleWithProviders | Provider | Array<AnyType<any> | InjectionToken<any> | NgModuleWithProviders | Provider> | null | undefined, exclude?: AnyType<any> | InjectionToken<any> | Array<AnyType<any> | InjectionToken<any>> | null | undefined): TestModuleMetadata;
2249
+ /**
2250
+ * ngMocks.faster lets reuse the same TestBed between tests instead of resetting it.
2251
+ *
2252
+ * @see https://ng-mocks.sudo.eu/api/ngMocks/faster
2253
+ */
2254
+ faster(): void;
2255
+ /**
2256
+ * ignoreOnConsole suppresses any log calls, other methods can be suppressed too.
2257
+ *
2258
+ * @see https://ng-mocks.sudo.eu/api/ngMocks/ignoreOnConsole
2259
+ */
2260
+ ignoreOnConsole(...args: Array<keyof typeof console>): void;
2261
+ /**
2262
+ * Thanks Ivy, it does not throw an error, and we have to use injector.
2263
+ *
2264
+ * @see https://ng-mocks.sudo.eu/api/ngMocks/throwOnConsole
2265
+ */
2266
+ throwOnConsole(...args: Array<keyof typeof console>): void;
2267
+ /**
2268
+ * ngMocks.formatHtml normalizes html for a DebugElement, fixture or html string.
2269
+ * It removes redundant spaces, comments etc.
2270
+ *
2271
+ * @see https://ng-mocks.sudo.eu/api/ngMocks/formatHtml
2272
+ *
2273
+ * ```ts
2274
+ * const html = ngMocks.formatHTML(fixture);
2275
+ * const html = ngMocks.formatHTML(debugElement);
2276
+ * const html = ngMocks.formatHTML('<div> </div>');
2277
+ * ```
2278
+ */
2279
+ formatHtml(html: FORMAT_SINGLE, outer?: boolean): string;
2280
+ /**
2281
+ * ngMocks.formatHtml normalizes html for an array of DebugElements, fixtures or html strings.
2282
+ * It removes redundant spaces, comments etc.
2283
+ *
2284
+ * @see https://ng-mocks.sudo.eu/api/ngMocks/formatHtml
2285
+ *
2286
+ * const [html1, html2] = ngMocks.formatHTML([fixture1, fixture2]);
2287
+ * const htmlStrings = ngMocks.formatHTML(debugElements);
2288
+ */
2289
+ formatHtml(html: FORMAT_SET, outer?: boolean): string[];
2290
+ /**
2291
+ * ngMocks.formatText normalizes text for a DebugElement, fixture or html string.
2292
+ * It removes tags, redundant spaces, comments etc.
2293
+ *
2294
+ * @see https://ng-mocks.sudo.eu/api/ngMocks/formatText
2295
+ *
2296
+ * ```ts
2297
+ * const txt = ngMocks.formatText(fixture);
2298
+ * const txt = ngMocks.formatText(debugElement);
2299
+ * const txt = ngMocks.formatText('<div> </div>');
2300
+ * ```
2301
+ */
2302
+ formatText(text: FORMAT_SINGLE, outer?: boolean): string;
2303
+ /**
2304
+ * ngMocks.formatText normalizes text for an array of DebugElements, fixtures or html strings.
2305
+ * It removes tags, redundant spaces, comments etc.
2306
+ *
2307
+ * @see https://ng-mocks.sudo.eu/api/ngMocks/formatText
2308
+ *
2309
+ * const [txt1, txt2] = ngMocks.formatText([fixture1, fixture2]);
2310
+ * const txtStrings = ngMocks.formatText(debugElements);
2311
+ */
2312
+ formatText(text: FORMAT_SET, outer?: boolean): string[];
2313
+ /**
2314
+ * ngMocks.flushTestBed resets TestBed.
2315
+ *
2316
+ * @see https://ng-mocks.sudo.eu/api/ngMocks/flushTestBed
2317
+ */
2318
+ flushTestBed(): void;
2319
+ /**
2320
+ * ngMocks.reset resets cache of ng-mocks.
2321
+ *
2322
+ * @see https://ng-mocks.sudo.eu/api/ngMocks/reset
2323
+ */
2324
+ reset(): void;
2325
+ /**
2326
+ * ngMocks.config lets customize default behavior of error reporting.
2327
+ */
2328
+ config(config: {
2329
+ mockRenderCacheSize?: number | null;
2330
+ onMockInstanceRestoreNeed?: "throw" | "warn" | "i-know-but-disable" | null;
2331
+ onTestBedFlushNeed?: "throw" | "warn" | "i-know-but-disable" | null;
2332
+ }): void;
2333
+ };
2334
+ /**
2335
+ * This signature of MockRender lets create a fixture to access a token.
2336
+ *
2337
+ * @see https://ng-mocks.sudo.eu/api/MockRender
2338
+ */
2339
+ export declare function MockRender<MComponent>(template: InjectionToken<MComponent>, params?: undefined | null, detectChangesOrOptions?: boolean | IMockRenderOptions): MockedComponentFixture<MComponent, void>;
2340
+ /**
2341
+ * This signature of MockRender lets create a fixture to access a component without parameters.
2342
+ *
2343
+ * @see https://ng-mocks.sudo.eu/api/MockRender
2344
+ */
2345
+ export declare function MockRender<MComponent>(template: AnyType<MComponent>, params: undefined | null, detectChangesOrOptions?: boolean | IMockRenderOptions): MockedComponentFixture<MComponent, MComponent>;
2346
+ /**
2347
+ * This signature of MockRender lets create a fixture with parameters to access a component.
2348
+ *
2349
+ * @see https://ng-mocks.sudo.eu/api/MockRender
2350
+ */
2351
+ export declare function MockRender<MComponent, TComponent extends object>(template: AnyType<MComponent>, params: TComponent, detectChangesOrOptions?: boolean | IMockRenderOptions): MockedComponentFixture<MComponent, TComponent>;
2352
+ /**
2353
+ * This signature of MockRender lets create a fixture with parameters to access a component.
2354
+ *
2355
+ * @see https://ng-mocks.sudo.eu/api/MockRender
2356
+ */
2357
+ export declare function MockRender<MComponent, TComponent extends object = Record<keyof any, any>>(template: AnyType<MComponent>, params: TComponent, detectChangesOrOptions?: boolean | IMockRenderOptions): MockedComponentFixture<MComponent, TComponent>;
2358
+ /**
2359
+ * This signature of MockRender without params should not autocomplete any keys of any types.
2360
+ *
2361
+ * @see https://ng-mocks.sudo.eu/api/MockRender
2362
+ */
2363
+ export declare function MockRender<MComponent>(template: AnyType<MComponent>): MockedComponentFixture<MComponent, MComponent>;
2364
+ /**
2365
+ * This signature of MockRender with an empty template does not have the point.
2366
+ *
2367
+ * @see https://ng-mocks.sudo.eu/api/MockRender
2368
+ */
2369
+ export declare function MockRender(template: ""): ComponentFixture<void> & {
2370
+ point: undefined;
2371
+ };
2372
+ /**
2373
+ * This signature of MockRender without params should not autocomplete any keys of any types.
2374
+ *
2375
+ * @see https://ng-mocks.sudo.eu/api/MockRender
2376
+ */
2377
+ export declare function MockRender<MComponent = void>(template: string): MockedComponentFixture<MComponent>;
2378
+ /**
2379
+ * This signature of MockRender lets create a fixture based on string template.
2380
+ *
2381
+ * @see https://ng-mocks.sudo.eu/api/MockRender
2382
+ */
2383
+ export declare function MockRender<MComponent = void>(template: string, params: undefined | null, detectChangesOrOptions?: boolean | IMockRenderOptions): MockedComponentFixture<MComponent, void>;
2384
+ /**
2385
+ * This signature of MockRender lets create a fixture with parameters to access a string based template.
2386
+ *
2387
+ * @see https://ng-mocks.sudo.eu/api/MockRender
2388
+ */
2389
+ export declare function MockRender<MComponent = void, TComponent extends Record<keyof any, any> = Record<keyof any, any>>(template: string, params: TComponent, detectChangesOrOptions?: boolean | IMockRenderOptions): MockedComponentFixture<MComponent, TComponent>;
2390
+ /**
2391
+ * This signature of MockRender lets create a fixture with parameters to access a string based template.
2392
+ *
2393
+ * @see https://ng-mocks.sudo.eu/api/MockRender
2394
+ */
2395
+ export declare function MockRender<MComponent, TComponent extends Record<keyof any, any> = Record<keyof any, any>>(template: string, params: TComponent, detectChangesOrOptions?: boolean | IMockRenderOptions): MockedComponentFixture<MComponent, TComponent>;
2396
+ export interface MockRenderFactory<C = any, F extends keyof any = keyof C> {
2397
+ bindings: keyof F;
2398
+ configureTestBed: () => void;
2399
+ declaration: AnyType<never>;
2400
+ <T extends Record<F, any>>(params?: Partial<T>, detectChanges?: boolean): MockedComponentFixture<C, T>;
2401
+ }
2402
+ /**
2403
+ * @see https://ng-mocks.sudo.eu/api/MockRender#factory
2404
+ */
2405
+ export declare function MockRenderFactory<MComponent>(template: InjectionToken<MComponent>, bindings?: undefined | null, options?: IMockRenderFactoryOptions): MockRenderFactory<MComponent, never>;
2406
+ /**
2407
+ * MockRenderFactory is a delayed version of MockRender.
2408
+ *
2409
+ * @see https://ng-mocks.sudo.eu/api/MockRender#factory
2410
+ */
2411
+ export declare function MockRenderFactory<MComponent>(template: AnyType<MComponent>, bindings: undefined | null, options?: IMockRenderFactoryOptions): MockRenderFactory<MComponent, keyof MComponent>;
2412
+ /**
2413
+ * MockRenderFactory is a delayed version of MockRender.
2414
+ *
2415
+ * @see https://ng-mocks.sudo.eu/api/MockRender#factory
2416
+ */
2417
+ export declare function MockRenderFactory<MComponent, TKeys extends keyof any>(template: AnyType<MComponent>, bindings: TKeys[], options?: IMockRenderFactoryOptions): MockRenderFactory<MComponent, TKeys>;
2418
+ /**
2419
+ * MockRenderFactory is a delayed version of MockRender.
2420
+ *
2421
+ * @see https://ng-mocks.sudo.eu/api/MockRender#factory
2422
+ */
2423
+ export declare function MockRenderFactory<MComponent, TKeys extends keyof any = keyof any>(template: AnyType<MComponent>, bindings: TKeys[], options?: IMockRenderFactoryOptions): MockRenderFactory<MComponent, TKeys>;
2424
+ /**
2425
+ * Without params we should not autocomplete any keys of any types.
2426
+ *
2427
+ * @see https://ng-mocks.sudo.eu/api/MockRender#factory
2428
+ */
2429
+ export declare function MockRenderFactory<MComponent>(template: AnyType<MComponent>): MockRenderFactory<MComponent, keyof MComponent>;
2430
+ /**
2431
+ * An empty string does not have point.
2432
+ *
2433
+ * @see https://ng-mocks.sudo.eu/api/MockRender#factory
2434
+ */
2435
+ export declare function MockRenderFactory(template: ""): MockRenderFactory<void, never>;
2436
+ /**
2437
+ * Without params we should not autocomplete any keys of any types.
2438
+ *
2439
+ * @see https://ng-mocks.sudo.eu/api/MockRender#factory
2440
+ */
2441
+ export declare function MockRenderFactory<MComponent = void>(template: string): MockRenderFactory<MComponent>;
2442
+ /**
2443
+ * MockRenderFactory is a delayed version of MockRender.
2444
+ *
2445
+ * @see https://ng-mocks.sudo.eu/api/MockRender#factory
2446
+ */
2447
+ export declare function MockRenderFactory<MComponent = void, TKeys extends keyof any = keyof any>(template: string, bindings: TKeys[], options?: IMockRenderFactoryOptions): MockRenderFactory<MComponent, TKeys>;
2448
+
2449
+ export {};