ng-mocks 14.2.3 → 14.2.4

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.
package/index.d.ts CHANGED
@@ -1,15 +1,43 @@
1
1
  import { ChangeDetectorRef, ClassProvider, DebugElement, DebugNode, ElementRef, EventEmitter, ExistingProvider, FactoryProvider, InjectionToken, Injector, PipeTransform, Provider, StaticClassProvider, TemplateRef, ValueProvider, ViewContainerRef } from '@angular/core';
2
2
  import { ComponentFixture, MetadataOverride, TestBedStatic, TestModuleMetadata } from '@angular/core/testing';
3
3
 
4
- declare type AbstractType<T> = Function & {
4
+ /**
5
+ * A5 requires it to be a type, because interface doesn't work with A5.
6
+ * It matches abstract classes.
7
+ *
8
+ * @internal
9
+ */
10
+ export declare type AbstractType<T> = Function & {
5
11
  prototype: T;
6
12
  };
7
- interface Type<T> extends Function {
13
+ /**
14
+ * It has to be an interface.
15
+ * It matches implemented classes.
16
+ *
17
+ * @internal
18
+ */
19
+ export interface Type<T> extends Function {
8
20
  new (...args: any[]): T;
9
21
  }
10
- declare type AnyType<T> = Type<T> | AbstractType<T>;
11
- declare type AnyDeclaration<T> = AnyType<T> | InjectionToken<T> | string;
12
- declare type DebugNodeSelector = DebugNode | ComponentFixture<any> | string | [
22
+ /**
23
+ * It matches abstract or implemented classes.
24
+ *
25
+ * @internal
26
+ */
27
+ export declare type AnyType<T> = Type<T> | AbstractType<T>;
28
+ /**
29
+ * It matches any declaration in angular.
30
+ *
31
+ * @internal
32
+ */
33
+ export declare type AnyDeclaration<T> = AnyType<T> | InjectionToken<T> | string;
34
+ /**
35
+ * DebugNodeSelector describes supported types of selectors
36
+ * to search elements and instances in fixtures.
37
+ *
38
+ * @internal
39
+ */
40
+ export declare type DebugNodeSelector = DebugNode | ComponentFixture<any> | string | [
13
41
  string
14
42
  ] | [
15
43
  string,
@@ -153,7 +181,12 @@ export interface IMockBuilderConfigDirective {
153
181
  variables?: Record<keyof any, any>;
154
182
  };
155
183
  }
156
- interface IMockBuilderConfigMock {
184
+ /**
185
+ * The interface with flags which are suitable for providers in MockBuilder chain functions.
186
+ *
187
+ * @see https://ng-mocks.sudo.eu/api/MockBuilder#config
188
+ */
189
+ export interface IMockBuilderConfigMock {
157
190
  /**
158
191
  * @see https://ng-mocks.sudo.eu/api/MockBuilder#precise-flag
159
192
  */
@@ -250,7 +283,7 @@ export interface IMockBuilder extends Promise<IMockBuilderResult> {
250
283
  */
251
284
  replace(source: AnyType<any>, destination: AnyType<any>, config?: IMockBuilderConfigAll & IMockBuilderConfigModule): this;
252
285
  }
253
- declare type ngMocksMockConfig = {
286
+ export declare type ngMocksMockConfig = {
254
287
  config?: IMockBuilderConfig;
255
288
  hostBindings?: string[];
256
289
  hostListeners?: string[];
@@ -331,7 +364,7 @@ export interface MockValidator {
331
364
  */
332
365
  __simulateValidatorChange(): void;
333
366
  }
334
- declare type MockedComponentSelector<T> = [
367
+ export declare type MockedComponentSelector<T> = [
335
368
  keyof T
336
369
  ] | [
337
370
  keyof T,
@@ -1037,11 +1070,17 @@ export declare namespace MockInstance {
1037
1070
  * https://ng-mocks.sudo.eu/api/MockInstance#scope
1038
1071
  */
1039
1072
  export declare function MockReset(): void;
1040
- interface NgModuleWithProviders<T = any> {
1073
+ /**
1074
+ * NgModuleWithProviders helps to support ModuleWithProviders in all angular versions.
1075
+ * In A5 it was without the generic type.
1076
+ *
1077
+ * @internal remove after removal of A5 support
1078
+ */
1079
+ export interface NgModuleWithProviders<T = any> {
1041
1080
  ngModule: Type<T>;
1042
1081
  providers?: Provider[];
1043
1082
  }
1044
- declare type MockBuilderParam = string | AnyDeclaration<any> | NgModuleWithProviders;
1083
+ export declare type MockBuilderParam = string | AnyDeclaration<any> | NgModuleWithProviders;
1045
1084
  /**
1046
1085
  * MockBuilder provides reach and simple interfaces of chain functions
1047
1086
  * to build desired mock environment for tests.
@@ -1471,14 +1510,14 @@ export declare type MockedFunction = (...args: any[]) => any;
1471
1510
  * @see https://ng-mocks.sudo.eu/extra/auto-spy
1472
1511
  */
1473
1512
  export declare type CustomMockFunction = (mockName: string) => MockedFunction;
1474
- declare type FORMAT_SINGLE = string | HTMLElement | {
1513
+ export declare type FORMAT_SINGLE = string | HTMLElement | {
1475
1514
  nativeNode: any;
1476
1515
  } | {
1477
1516
  nativeElement: any;
1478
1517
  } | {
1479
1518
  debugElement: any;
1480
1519
  };
1481
- declare type FORMAT_SET = string[] | HTMLElement[] | Array<{
1520
+ export declare type FORMAT_SET = string[] | HTMLElement[] | Array<{
1482
1521
  nativeNode: any;
1483
1522
  }> | Array<{
1484
1523
  nativeElement: any;