@vnejs/plugins.views.screens.credits 0.1.16 → 0.1.18
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/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/types.d.ts +4 -4
- package/package.json +14 -5
- package/src/index.ts +2 -2
- package/src/tests/credits.test.ts +31 -0
- package/src/tests/setup.ts +35 -0
- package/src/types.ts +4 -4
- package/tsconfig.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import "@vnejs/
|
|
1
|
+
import "@vnejs/contracts.views.screens.credits";
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import "@vnejs/
|
|
1
|
+
import "@vnejs/contracts.views.screens.credits";
|
|
2
2
|
import { regPlugin } from "@vnejs/shared";
|
|
3
|
-
import { PARAMS, PLUGIN_NAME, SUBSCRIBE_EVENTS } from "@vnejs/
|
|
3
|
+
import { PARAMS, PLUGIN_NAME, SUBSCRIBE_EVENTS } from "@vnejs/contracts.views.screens.credits";
|
|
4
4
|
import { CreditsController } from "./modules/controller.js";
|
|
5
5
|
import { Credits } from "./modules/credits.js";
|
|
6
6
|
import { CreditsView } from "./modules/view.js";
|
package/dist/types.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { ModuleComponentsConstants, ModuleComponentsEvents, ModuleComponentsParams, ModuleComponentsSettings } from "@vnejs/module.components";
|
|
2
|
-
import type { Constants as ControlsConstants, PluginName as ControlsPluginName } from "@vnejs/
|
|
3
|
-
import type { PluginName as ScenarioPluginName, SubscribeEvents as ScenarioSubscribeEvents } from "@vnejs/
|
|
4
|
-
import type { PluginName as StatePluginName, SubscribeEvents as StateSubscribeEvents } from "@vnejs/
|
|
5
|
-
import type { Params, PluginName, SubscribeEvents } from "@vnejs/
|
|
2
|
+
import type { Constants as ControlsConstants, PluginName as ControlsPluginName } from "@vnejs/contracts.controls";
|
|
3
|
+
import type { PluginName as ScenarioPluginName, SubscribeEvents as ScenarioSubscribeEvents } from "@vnejs/contracts.core.scenario";
|
|
4
|
+
import type { PluginName as StatePluginName, SubscribeEvents as StateSubscribeEvents } from "@vnejs/contracts.core.state";
|
|
5
|
+
import type { Params, PluginName, SubscribeEvents } from "@vnejs/contracts.views.screens.credits";
|
|
6
6
|
export type CreditsPluginEvents = ModuleComponentsEvents & Record<PluginName, SubscribeEvents> & Record<ScenarioPluginName, ScenarioSubscribeEvents> & Record<StatePluginName, StateSubscribeEvents>;
|
|
7
7
|
export type CreditsPluginConstants = ModuleComponentsConstants & Record<ControlsPluginName, ControlsConstants>;
|
|
8
8
|
export type CreditsPluginSettings = ModuleComponentsSettings;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vnejs/plugins.views.screens.credits",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.18",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"tsconfig.json"
|
|
19
19
|
],
|
|
20
20
|
"scripts": {
|
|
21
|
-
"test": "
|
|
21
|
+
"test": "npx @vnejs/monorepo test",
|
|
22
22
|
"build": "npx @vnejs/monorepo package",
|
|
23
23
|
"publish:major:plugin": "npm run publish:major",
|
|
24
24
|
"publish:minor:plugin": "npm run publish:minor",
|
|
@@ -30,17 +30,26 @@
|
|
|
30
30
|
"author": "",
|
|
31
31
|
"license": "ISC",
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@vnejs/
|
|
33
|
+
"@vnejs/contracts.views.screens.credits": "~0.1.0"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
36
|
"@vnejs/helpers": "~0.1.0",
|
|
37
37
|
"@vnejs/module.core": "~0.1.0",
|
|
38
38
|
"@vnejs/module.components": "~0.1.0",
|
|
39
|
-
"@vnejs/
|
|
39
|
+
"@vnejs/contracts.controls": "~0.1.0",
|
|
40
40
|
"@vnejs/shared": "~0.1.0",
|
|
41
41
|
"@vnejs/uis.react": "~0.1.0"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"@vnejs/configs.ts-common": "~0.1.0"
|
|
44
|
+
"@vnejs/configs.ts-common": "~0.1.0",
|
|
45
|
+
"@vnejs/configs.vitest": "~0.1.0",
|
|
46
|
+
"@vnejs/test-utils": "~0.1.0",
|
|
47
|
+
"@vnejs/contracts.controls": "~0.1.0",
|
|
48
|
+
"@vnejs/contracts.views.screens.credits": "~0.1.0",
|
|
49
|
+
"@vnejs/helpers": "~0.1.0",
|
|
50
|
+
"@vnejs/module.core": "~0.1.0",
|
|
51
|
+
"@vnejs/module.components": "~0.1.0",
|
|
52
|
+
"@vnejs/shared": "~0.1.0",
|
|
53
|
+
"@vnejs/uis.react": "~0.1.0"
|
|
45
54
|
}
|
|
46
55
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import "@vnejs/
|
|
1
|
+
import "@vnejs/contracts.views.screens.credits";
|
|
2
2
|
|
|
3
3
|
import { regPlugin } from "@vnejs/shared";
|
|
4
|
-
import { PARAMS, PLUGIN_NAME, SUBSCRIBE_EVENTS } from "@vnejs/
|
|
4
|
+
import { PARAMS, PLUGIN_NAME, SUBSCRIBE_EVENTS } from "@vnejs/contracts.views.screens.credits";
|
|
5
5
|
|
|
6
6
|
import { CreditsController } from "./modules/controller.js";
|
|
7
7
|
import { Credits } from "./modules/credits.js";
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { beforeEach, describe, expect, it } from "vitest";
|
|
2
|
+
|
|
3
|
+
import { spyEvent } from "@vnejs/test-utils";
|
|
4
|
+
|
|
5
|
+
import { Credits } from "../modules/credits.js";
|
|
6
|
+
import { createCreditsTestModule, registerCreditsPluginVne, SUBSCRIBE_EVENTS } from "./setup.js";
|
|
7
|
+
|
|
8
|
+
describe("Credits", () => {
|
|
9
|
+
beforeEach(() => {
|
|
10
|
+
registerCreditsPluginVne();
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
it("line exec show emits SHOW", async () => {
|
|
14
|
+
const { module, observer } = createCreditsTestModule(Credits, { subscribe: false });
|
|
15
|
+
const show = spyEvent(observer, SUBSCRIBE_EVENTS.SHOW);
|
|
16
|
+
|
|
17
|
+
await (module as Credits).init();
|
|
18
|
+
await (module as Credits).onLineExec({ line: "show" });
|
|
19
|
+
|
|
20
|
+
expect(show).toHaveBeenCalledOnce();
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
it("line exec hide emits HIDE", async () => {
|
|
24
|
+
const { module, observer } = createCreditsTestModule(Credits, { subscribe: false });
|
|
25
|
+
const hide = spyEvent(observer, SUBSCRIBE_EVENTS.HIDE);
|
|
26
|
+
|
|
27
|
+
await (module as Credits).onLineExec({ line: "hide" });
|
|
28
|
+
|
|
29
|
+
expect(hide).toHaveBeenCalledOnce();
|
|
30
|
+
});
|
|
31
|
+
});
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { CONSTANTS as CONTROLS_CONST, PLUGIN_NAME as CONTROLS, SUBSCRIBE_EVENTS as CONTROLS_EVENTS } from "@vnejs/contracts.controls";
|
|
2
|
+
import { PARAMS, PLUGIN_NAME, SUBSCRIBE_EVENTS } from "@vnejs/contracts.views.screens.credits";
|
|
3
|
+
import {
|
|
4
|
+
createTestModule as baseCreateTestModule,
|
|
5
|
+
registerCoreVne,
|
|
6
|
+
registerVnePlugin,
|
|
7
|
+
stubSilentEvent,
|
|
8
|
+
} from "@vnejs/test-utils";
|
|
9
|
+
|
|
10
|
+
export const registerCreditsPluginVne = () => {
|
|
11
|
+
registerCoreVne();
|
|
12
|
+
registerVnePlugin(CONTROLS, { constants: CONTROLS_CONST, events: CONTROLS_EVENTS });
|
|
13
|
+
registerVnePlugin(PLUGIN_NAME, { events: SUBSCRIBE_EVENTS, params: PARAMS });
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export const createCreditsTestModule = <T extends Parameters<typeof baseCreateTestModule>[0]>(
|
|
17
|
+
ModuleClass: T,
|
|
18
|
+
options: Parameters<typeof baseCreateTestModule>[1] = {},
|
|
19
|
+
) => {
|
|
20
|
+
const result = baseCreateTestModule(ModuleClass, {
|
|
21
|
+
state: {
|
|
22
|
+
credits: { isShow: false },
|
|
23
|
+
...(options.state ?? {}),
|
|
24
|
+
},
|
|
25
|
+
...options,
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
stubSilentEvent(result.observer, SUBSCRIBE_EVENTS.SHOW);
|
|
29
|
+
stubSilentEvent(result.observer, SUBSCRIBE_EVENTS.HIDE);
|
|
30
|
+
stubSilentEvent(result.observer, SUBSCRIBE_EVENTS.UPDATE);
|
|
31
|
+
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export { SUBSCRIBE_EVENTS, PARAMS, PLUGIN_NAME };
|
package/src/types.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { ModuleComponentsConstants, ModuleComponentsEvents, ModuleComponentsParams, ModuleComponentsSettings } from "@vnejs/module.components";
|
|
2
|
-
import type { Constants as ControlsConstants, PluginName as ControlsPluginName } from "@vnejs/
|
|
3
|
-
import type { PluginName as ScenarioPluginName, SubscribeEvents as ScenarioSubscribeEvents } from "@vnejs/
|
|
4
|
-
import type { PluginName as StatePluginName, SubscribeEvents as StateSubscribeEvents } from "@vnejs/
|
|
5
|
-
import type { Params, PluginName, SubscribeEvents } from "@vnejs/
|
|
2
|
+
import type { Constants as ControlsConstants, PluginName as ControlsPluginName } from "@vnejs/contracts.controls";
|
|
3
|
+
import type { PluginName as ScenarioPluginName, SubscribeEvents as ScenarioSubscribeEvents } from "@vnejs/contracts.core.scenario";
|
|
4
|
+
import type { PluginName as StatePluginName, SubscribeEvents as StateSubscribeEvents } from "@vnejs/contracts.core.state";
|
|
5
|
+
import type { Params, PluginName, SubscribeEvents } from "@vnejs/contracts.views.screens.credits";
|
|
6
6
|
|
|
7
7
|
export type CreditsPluginEvents = ModuleComponentsEvents &
|
|
8
8
|
Record<PluginName, SubscribeEvents> &
|
package/tsconfig.json
CHANGED