@sprucelabs/spruce-heartwood-utils 19.6.0 → 19.6.1
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/build/__tests__/support/MockRemoteViewControllerFactory.d.ts +3 -1
- package/build/__tests__/support/MockRemoteViewControllerFactory.js +10 -0
- package/build/esm/__tests__/support/MockRemoteViewControllerFactory.d.ts +3 -1
- package/build/esm/__tests__/support/MockRemoteViewControllerFactory.js +10 -0
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ViewControllerMap, ControllerOptions, ViewController } from '@sprucelabs/heartwood-view-controllers';
|
|
1
|
+
import { ViewControllerMap, ControllerOptions, ViewController, SkillViewController } from '@sprucelabs/heartwood-view-controllers';
|
|
2
2
|
import { RemoteFactoryOptions, RemoteViewControllerFactory } from '../../skillViews/RemoteViewControllerFactory';
|
|
3
3
|
export default class MockRemoteViewControllerFactory implements RemoteViewControllerFactory {
|
|
4
4
|
private static instance?;
|
|
@@ -10,6 +10,8 @@ export default class MockRemoteViewControllerFactory implements RemoteViewContro
|
|
|
10
10
|
id: string;
|
|
11
11
|
}>;
|
|
12
12
|
Controller<N extends keyof ViewControllerMap, O extends ControllerOptions<N>>(_name: N, _options: O): ViewControllerMap[N];
|
|
13
|
+
dropInRemoteController(id: string, Class: new (args: any) => ViewController<any>): void;
|
|
14
|
+
assertSkillViewRendersRemoteCard(vc: SkillViewController, id: string): void;
|
|
13
15
|
static reset(): void;
|
|
14
16
|
static getInstance(): MockRemoteViewControllerFactory;
|
|
15
17
|
getTheme(_namespace?: string | undefined): undefined;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const heartwood_view_controllers_1 = require("@sprucelabs/heartwood-view-controllers");
|
|
3
4
|
const test_utils_1 = require("@sprucelabs/test-utils");
|
|
4
5
|
class MockRemoteViewControllerFactory {
|
|
5
6
|
constructor(options) {
|
|
@@ -13,6 +14,15 @@ class MockRemoteViewControllerFactory {
|
|
|
13
14
|
Controller(_name, _options) {
|
|
14
15
|
return {};
|
|
15
16
|
}
|
|
17
|
+
dropInRemoteController(id, Class) {
|
|
18
|
+
this.views.setController(id, Class);
|
|
19
|
+
}
|
|
20
|
+
assertSkillViewRendersRemoteCard(vc, id) {
|
|
21
|
+
const cards = heartwood_view_controllers_1.vcAssert.assertSkillViewRendersCards(vc);
|
|
22
|
+
test_utils_1.assert.isTruthy(
|
|
23
|
+
//@ts-ignore
|
|
24
|
+
cards.find((c) => c.id === id), `Could not find the remote card with the id '${id}'!`);
|
|
25
|
+
}
|
|
16
26
|
static reset() {
|
|
17
27
|
delete this.instance;
|
|
18
28
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ViewControllerMap, ControllerOptions, ViewController } from '@sprucelabs/heartwood-view-controllers';
|
|
1
|
+
import { ViewControllerMap, ControllerOptions, ViewController, SkillViewController } from '@sprucelabs/heartwood-view-controllers';
|
|
2
2
|
import { RemoteFactoryOptions, RemoteViewControllerFactory } from '../../skillViews/RemoteViewControllerFactory';
|
|
3
3
|
export default class MockRemoteViewControllerFactory implements RemoteViewControllerFactory {
|
|
4
4
|
private static instance?;
|
|
@@ -10,6 +10,8 @@ export default class MockRemoteViewControllerFactory implements RemoteViewContro
|
|
|
10
10
|
id: string;
|
|
11
11
|
}>;
|
|
12
12
|
Controller<N extends keyof ViewControllerMap, O extends ControllerOptions<N>>(_name: N, _options: O): ViewControllerMap[N];
|
|
13
|
+
dropInRemoteController(id: string, Class: new (args: any) => ViewController<any>): void;
|
|
14
|
+
assertSkillViewRendersRemoteCard(vc: SkillViewController, id: string): void;
|
|
13
15
|
static reset(): void;
|
|
14
16
|
static getInstance(): MockRemoteViewControllerFactory;
|
|
15
17
|
getTheme(_namespace?: string | undefined): undefined;
|
|
@@ -7,6 +7,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
+
import { vcAssert, } from '@sprucelabs/heartwood-view-controllers';
|
|
10
11
|
import { assert } from '@sprucelabs/test-utils';
|
|
11
12
|
export default class MockRemoteViewControllerFactory {
|
|
12
13
|
constructor(options) {
|
|
@@ -20,6 +21,15 @@ export default class MockRemoteViewControllerFactory {
|
|
|
20
21
|
Controller(_name, _options) {
|
|
21
22
|
return {};
|
|
22
23
|
}
|
|
24
|
+
dropInRemoteController(id, Class) {
|
|
25
|
+
this.views.setController(id, Class);
|
|
26
|
+
}
|
|
27
|
+
assertSkillViewRendersRemoteCard(vc, id) {
|
|
28
|
+
const cards = vcAssert.assertSkillViewRendersCards(vc);
|
|
29
|
+
assert.isTruthy(
|
|
30
|
+
//@ts-ignore
|
|
31
|
+
cards.find((c) => c.id === id), `Could not find the remote card with the id '${id}'!`);
|
|
32
|
+
}
|
|
23
33
|
static reset() {
|
|
24
34
|
delete this.instance;
|
|
25
35
|
}
|