@vnejs/compatibility.text-with-scenario.autoread 0.2.0 → 0.2.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.
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/package.json +1 -1
- package/src/index.ts +2 -2
- package/src/tests/scenario.autoread.test.ts +4 -4
- package/src/tests/setup.ts +13 -2
- package/src/types.ts +1 -3
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import "@vnejs/contracts.text";
|
|
|
3
3
|
import { ModuleCore } from "@vnejs/module.core";
|
|
4
4
|
import type { AutoreadSourcePayload } from "@vnejs/contracts.scenario.autoread";
|
|
5
5
|
import type { PluginConstants, PluginEvents, PluginParams, PluginSettings } from "./types.js";
|
|
6
|
-
export declare class
|
|
6
|
+
export declare class CompatibilityTextWithScenarioAutoread extends ModuleCore<PluginEvents, PluginConstants, PluginSettings, PluginParams> {
|
|
7
7
|
name: string;
|
|
8
8
|
sourceArg: AutoreadSourcePayload;
|
|
9
9
|
subscribe: () => void;
|
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import "@vnejs/contracts.scenario.autoread";
|
|
|
2
2
|
import "@vnejs/contracts.text";
|
|
3
3
|
import { ModuleCore } from "@vnejs/module.core";
|
|
4
4
|
import { regModule } from "@vnejs/shared";
|
|
5
|
-
export class
|
|
5
|
+
export class CompatibilityTextWithScenarioAutoread extends ModuleCore {
|
|
6
6
|
name = "compatibility.text-with-scenario.autoread";
|
|
7
7
|
sourceArg = { source: this.CONST.TEXT.SOURCE };
|
|
8
8
|
subscribe = () => {
|
|
@@ -12,4 +12,4 @@ export class CompatibilityTextAutoread extends ModuleCore {
|
|
|
12
12
|
onTextEmit = () => this.emit(this.EVENTS.AUTOREAD.PUSH, this.sourceArg);
|
|
13
13
|
onTextEmitEnd = () => this.emit(this.EVENTS.AUTOREAD.POP, this.sourceArg);
|
|
14
14
|
}
|
|
15
|
-
regModule(
|
|
15
|
+
regModule(CompatibilityTextWithScenarioAutoread);
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -7,7 +7,7 @@ import { regModule } from "@vnejs/shared";
|
|
|
7
7
|
|
|
8
8
|
import type { PluginConstants, PluginEvents, PluginParams, PluginSettings } from "./types.js";
|
|
9
9
|
|
|
10
|
-
export class
|
|
10
|
+
export class CompatibilityTextWithScenarioAutoread extends ModuleCore<PluginEvents, PluginConstants, PluginSettings, PluginParams> {
|
|
11
11
|
name = "compatibility.text-with-scenario.autoread";
|
|
12
12
|
|
|
13
13
|
sourceArg: AutoreadSourcePayload = { source: this.CONST.TEXT.SOURCE };
|
|
@@ -21,4 +21,4 @@ export class CompatibilityTextAutoread extends ModuleCore<PluginEvents, PluginCo
|
|
|
21
21
|
onTextEmitEnd = () => this.emit(this.EVENTS.AUTOREAD.POP, this.sourceArg);
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
regModule(
|
|
24
|
+
regModule(CompatibilityTextWithScenarioAutoread);
|
|
@@ -2,16 +2,16 @@ import { beforeEach, describe, expect, it } from "vitest";
|
|
|
2
2
|
|
|
3
3
|
import { spyEvent } from "@vnejs/test-utils";
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { CompatibilityTextWithScenarioAutoread } from "../index.js";
|
|
6
6
|
import { AUTOREAD_EVENTS, createCompatibilityTestModule, registerCompatibilityVne, TEXT_CONST, TEXT_EVENTS } from "./setup.js";
|
|
7
7
|
|
|
8
|
-
describe("
|
|
8
|
+
describe("CompatibilityTextWithScenarioAutoread", () => {
|
|
9
9
|
beforeEach(() => {
|
|
10
10
|
registerCompatibilityVne();
|
|
11
11
|
});
|
|
12
12
|
|
|
13
13
|
it("TEXT.EMIT emits AUTOREAD.PUSH with text source", async () => {
|
|
14
|
-
const { observer } = createCompatibilityTestModule(
|
|
14
|
+
const { observer } = createCompatibilityTestModule(CompatibilityTextWithScenarioAutoread);
|
|
15
15
|
const push = spyEvent(observer, AUTOREAD_EVENTS.PUSH);
|
|
16
16
|
|
|
17
17
|
await observer.emit(TEXT_EVENTS.EMIT);
|
|
@@ -21,7 +21,7 @@ describe("CompatibilityTextAutoread", () => {
|
|
|
21
21
|
});
|
|
22
22
|
|
|
23
23
|
it("TEXT.EMIT_END emits AUTOREAD.POP with text source", async () => {
|
|
24
|
-
const { observer } = createCompatibilityTestModule(
|
|
24
|
+
const { observer } = createCompatibilityTestModule(CompatibilityTextWithScenarioAutoread);
|
|
25
25
|
const pop = spyEvent(observer, AUTOREAD_EVENTS.POP);
|
|
26
26
|
|
|
27
27
|
await observer.emit(TEXT_EVENTS.EMIT_END);
|
package/src/tests/setup.ts
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import {
|
|
2
|
+
PARAMS as AUTOREAD_PARAMS,
|
|
3
|
+
PLUGIN_NAME as AUTOREAD,
|
|
4
|
+
SETTINGS_KEYS as AUTOREAD_SETTINGS,
|
|
5
|
+
SUBSCRIBE_EVENTS as AUTOREAD_EVENTS,
|
|
6
|
+
} from "@vnejs/contracts.scenario.autoread";
|
|
7
|
+
import {
|
|
8
|
+
CONSTANTS as TEXT_CONST,
|
|
9
|
+
PARAMS as TEXT_PARAMS,
|
|
10
|
+
PLUGIN_NAME as TEXT,
|
|
11
|
+
SETTINGS_KEYS as TEXT_SETTINGS,
|
|
12
|
+
SUBSCRIBE_EVENTS as TEXT_EVENTS,
|
|
13
|
+
} from "@vnejs/contracts.text";
|
|
3
14
|
import { createTestModule as baseCreateTestModule, registerCoreVne, registerVnePlugin } from "@vnejs/test-utils";
|
|
4
15
|
|
|
5
16
|
export const registerCompatibilityVne = () => {
|
package/src/types.ts
CHANGED
|
@@ -2,9 +2,7 @@ import type { ModuleCoreConstants, ModuleCoreEvents, ModuleCoreParams, ModuleCor
|
|
|
2
2
|
import type { PluginName as AutoreadPluginName, SubscribeEvents as AutoreadSubscribeEvents } from "@vnejs/contracts.scenario.autoread";
|
|
3
3
|
import type { Constants as TextConstants, PluginName as TextPluginName, SubscribeEvents as TextSubscribeEvents } from "@vnejs/contracts.text";
|
|
4
4
|
|
|
5
|
-
export type PluginEvents = ModuleCoreEvents &
|
|
6
|
-
Record<TextPluginName, TextSubscribeEvents> &
|
|
7
|
-
Record<AutoreadPluginName, AutoreadSubscribeEvents>;
|
|
5
|
+
export type PluginEvents = ModuleCoreEvents & Record<TextPluginName, TextSubscribeEvents> & Record<AutoreadPluginName, AutoreadSubscribeEvents>;
|
|
8
6
|
|
|
9
7
|
export type PluginConstants = ModuleCoreConstants & Record<TextPluginName, TextConstants>;
|
|
10
8
|
|