ng-mocks 14.5.2 → 14.6.0
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 +21 -17
- package/index.js +1 -1
- package/index.js.map +1 -1
- package/index.mjs +1 -1
- package/index.mjs.map +1 -1
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ import { ComponentFixture, MetadataOverride, TestBedStatic, TestModuleMetadata }
|
|
|
7
7
|
*
|
|
8
8
|
* @internal
|
|
9
9
|
*/
|
|
10
|
-
export
|
|
10
|
+
export type AbstractType<T> = Function & {
|
|
11
11
|
prototype: T;
|
|
12
12
|
};
|
|
13
13
|
/**
|
|
@@ -24,20 +24,20 @@ export interface Type<T> extends Function {
|
|
|
24
24
|
*
|
|
25
25
|
* @internal
|
|
26
26
|
*/
|
|
27
|
-
export
|
|
27
|
+
export type AnyType<T> = Type<T> | AbstractType<T>;
|
|
28
28
|
/**
|
|
29
29
|
* It matches any declaration in angular.
|
|
30
30
|
*
|
|
31
31
|
* @internal
|
|
32
32
|
*/
|
|
33
|
-
export
|
|
33
|
+
export type AnyDeclaration<T> = AnyType<T> | InjectionToken<T> | string;
|
|
34
34
|
/**
|
|
35
35
|
* DebugNodeSelector describes supported types of selectors
|
|
36
36
|
* to search elements and instances in fixtures.
|
|
37
37
|
*
|
|
38
38
|
* @internal
|
|
39
39
|
*/
|
|
40
|
-
export
|
|
40
|
+
export type DebugNodeSelector = DebugNode | ComponentFixture<any> | string | [
|
|
41
41
|
string
|
|
42
42
|
] | [
|
|
43
43
|
string,
|
|
@@ -139,6 +139,10 @@ export interface IMockBuilderConfigAll {
|
|
|
139
139
|
* @see https://ng-mocks.sudo.eu/api/MockBuilder#shallow-flag
|
|
140
140
|
*/
|
|
141
141
|
shallow?: boolean;
|
|
142
|
+
/**
|
|
143
|
+
* @see https://ng-mocks.sudo.eu/api/MockBuilder#onroot-flag
|
|
144
|
+
*/
|
|
145
|
+
onRoot?: boolean;
|
|
142
146
|
}
|
|
143
147
|
/**
|
|
144
148
|
* The interface with flags which are suitable for modules in MockBuilder chain functions.
|
|
@@ -197,7 +201,7 @@ export interface IMockBuilderConfigMock {
|
|
|
197
201
|
*
|
|
198
202
|
* @see https://ng-mocks.sudo.eu/api/MockBuilder#config
|
|
199
203
|
*/
|
|
200
|
-
export
|
|
204
|
+
export type IMockBuilderConfig = IMockBuilderConfigAll | IMockBuilderConfigModule | IMockBuilderConfigComponent | IMockBuilderConfigDirective;
|
|
201
205
|
/**
|
|
202
206
|
* IMockBuilder describes chain functions of MockBuilder.
|
|
203
207
|
*
|
|
@@ -283,7 +287,7 @@ export interface IMockBuilder extends Promise<IMockBuilderResult> {
|
|
|
283
287
|
*/
|
|
284
288
|
replace(source: AnyType<any>, destination: AnyType<any>, config?: IMockBuilderConfigAll & IMockBuilderConfigModule): this;
|
|
285
289
|
}
|
|
286
|
-
export
|
|
290
|
+
export type ngMocksMockConfig = {
|
|
287
291
|
config?: IMockBuilderConfig;
|
|
288
292
|
hostBindings?: string[];
|
|
289
293
|
hostListeners?: string[];
|
|
@@ -365,7 +369,7 @@ export interface MockValidator {
|
|
|
365
369
|
*/
|
|
366
370
|
__simulateValidatorChange(): void;
|
|
367
371
|
}
|
|
368
|
-
export
|
|
372
|
+
export type MockedComponentSelector<T> = [
|
|
369
373
|
keyof T
|
|
370
374
|
] | [
|
|
371
375
|
keyof T,
|
|
@@ -450,7 +454,7 @@ export declare type MockedComponentSelector<T> = [
|
|
|
450
454
|
* @see https://ng-mocks.sudo.eu/api/ngMocks/render
|
|
451
455
|
* @see https://ng-mocks.sudo.eu/api/ngMocks/hide
|
|
452
456
|
*/
|
|
453
|
-
export
|
|
457
|
+
export type MockedComponent<T> = T & LegacyControlValueAccessor & {
|
|
454
458
|
/**
|
|
455
459
|
* @deprecated use ngMocks.hide instead (removing in A13)
|
|
456
460
|
* @see https://ng-mocks.sudo.eu/api/ngMocks/hide
|
|
@@ -469,7 +473,7 @@ export declare type MockedComponent<T> = T & LegacyControlValueAccessor & {
|
|
|
469
473
|
* @see https://ng-mocks.sudo.eu/api/ngMocks/render#render-structural-directives
|
|
470
474
|
* @see https://ng-mocks.sudo.eu/api/ngMocks/hide
|
|
471
475
|
*/
|
|
472
|
-
export
|
|
476
|
+
export type MockedDirective<T> = T & LegacyControlValueAccessor & {
|
|
473
477
|
/**
|
|
474
478
|
* Pointer to ChangeDetectorRef.
|
|
475
479
|
*/
|
|
@@ -504,12 +508,12 @@ export declare type MockedDirective<T> = T & LegacyControlValueAccessor & {
|
|
|
504
508
|
* MockedModule is a legacy representation of an interface of a mock module instance.
|
|
505
509
|
* Please avoid its usage, because, usually, you should not rely on whether it's a mock or not.
|
|
506
510
|
*/
|
|
507
|
-
export
|
|
511
|
+
export type MockedModule<T> = T & Mock;
|
|
508
512
|
/**
|
|
509
513
|
* MockedPipe is a legacy representation of an interface of a mock pipe instance.
|
|
510
514
|
* Please avoid its usage, because, usually, you should not rely on whether it's a mock or not.
|
|
511
515
|
*/
|
|
512
|
-
export
|
|
516
|
+
export type MockedPipe<T> = T & Mock;
|
|
513
517
|
/**
|
|
514
518
|
* Returns the mock class of a mock module based on a mock module or a source module.
|
|
515
519
|
* It works in runtime if the module has been mocked.
|
|
@@ -1081,7 +1085,7 @@ export interface NgModuleWithProviders<T = any> {
|
|
|
1081
1085
|
ngModule: Type<T>;
|
|
1082
1086
|
providers?: NgModule["providers"];
|
|
1083
1087
|
}
|
|
1084
|
-
export
|
|
1088
|
+
export type MockBuilderParam = string | AnyDeclaration<any> | NgModuleWithProviders;
|
|
1085
1089
|
/**
|
|
1086
1090
|
* MockBuilder provides reach and simple interfaces of chain functions
|
|
1087
1091
|
* to build desired mock environment for tests.
|
|
@@ -1494,7 +1498,7 @@ export interface MockedComponentFixture<C = any, F = DefaultRenderComponent<C>>
|
|
|
1494
1498
|
*
|
|
1495
1499
|
* @see https://ng-mocks.sudo.eu/api/MockRender
|
|
1496
1500
|
*/
|
|
1497
|
-
export
|
|
1501
|
+
export type DefaultRenderComponent<MComponent> = {
|
|
1498
1502
|
[K in keyof MComponent]: MComponent[K];
|
|
1499
1503
|
};
|
|
1500
1504
|
/**
|
|
@@ -1503,22 +1507,22 @@ export declare type DefaultRenderComponent<MComponent> = {
|
|
|
1503
1507
|
*
|
|
1504
1508
|
* @see https://ng-mocks.sudo.eu/extra/auto-spy
|
|
1505
1509
|
*/
|
|
1506
|
-
export
|
|
1510
|
+
export type MockedFunction = (...args: any[]) => any;
|
|
1507
1511
|
/**
|
|
1508
1512
|
* CustomMockFunction describes the interface of a factory which should produce MockFunction.
|
|
1509
1513
|
* It accepts a label / name and should return a spy / mock function.
|
|
1510
1514
|
*
|
|
1511
1515
|
* @see https://ng-mocks.sudo.eu/extra/auto-spy
|
|
1512
1516
|
*/
|
|
1513
|
-
export
|
|
1514
|
-
export
|
|
1517
|
+
export type CustomMockFunction = (mockName: string) => MockedFunction;
|
|
1518
|
+
export type FORMAT_SINGLE = string | HTMLElement | {
|
|
1515
1519
|
nativeNode: any;
|
|
1516
1520
|
} | {
|
|
1517
1521
|
nativeElement: any;
|
|
1518
1522
|
} | {
|
|
1519
1523
|
debugElement: any;
|
|
1520
1524
|
};
|
|
1521
|
-
export
|
|
1525
|
+
export type FORMAT_SET = string[] | HTMLElement[] | Array<{
|
|
1522
1526
|
nativeNode: any;
|
|
1523
1527
|
}> | Array<{
|
|
1524
1528
|
nativeElement: any;
|