@testforgejs/vue-test-plugin-primevue 1.0.0-beta.2 → 1.0.0-beta.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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @testforgejs/vue-test-plugin-primevue
2
2
 
3
- Official TestForge plugin for PrimeVue integration in component tests.
3
+ PrimeVue integration for TestForge component tests.
4
4
 
5
5
  ## Installation
6
6
 
@@ -28,12 +28,61 @@ yarn add -D @testforgejs/vue-test-plugin-primevue@beta
28
28
 
29
29
  ## Usage
30
30
 
31
- Register `primeVuePlugin` in the TestForge plugin manifest.
31
+ ### Using plugin defaults
32
+
33
+ The plugin provides a project-independent default configuration through `getDefaultOptions()`:
32
34
 
33
35
  ```typescript
34
36
  import { createTestFramework } from "@testforgejs/vue-test-core";
35
37
  import { primeVuePlugin } from "@testforgejs/vue-test-plugin-primevue";
36
38
 
39
+ const framework = createTestFramework({
40
+ presets: {
41
+ default: {
42
+ manifest: [
43
+ {
44
+ module: primeVuePlugin,
45
+ enabled: true,
46
+ },
47
+ ],
48
+ defaults: {
49
+ primevue: primeVuePlugin.getDefaultOptions(),
50
+ },
51
+ },
52
+ },
53
+ });
54
+
55
+ const factory = framework.testComponentFactory(MyComponent);
56
+
57
+ const wrapper = factory();
58
+ ```
59
+
60
+ `getDefaultOptions()` returns an options factory suitable for use in a preset.
61
+
62
+ The plugin-provided defaults enable PrimeVue unstyled mode:
63
+
64
+ ```typescript
65
+ {
66
+ unstyled: true,
67
+ }
68
+ ```
69
+
70
+ Unstyled mode provides a project-independent baseline without requiring a theme preset. PrimeVue components retain their functionality and accessibility, while PrimeVue's built-in styled-mode theme rules are not applied.
71
+
72
+ Plugin defaults are **not applied automatically**. Adding the plugin to a preset manifest declares that the plugin is available and whether it is enabled; the preset explicitly decides whether to use the plugin-provided defaults or provide its own configuration.
73
+
74
+ ### Providing custom options
75
+
76
+ You can define the PrimeVue configuration directly in the preset instead.
77
+
78
+ For example, a project that uses PrimeVue styled mode can provide its theme configuration:
79
+
80
+ ```typescript
81
+ import Aura from "@primeuix/themes/aura";
82
+
83
+ import { createTestFramework } from "@testforgejs/vue-test-core";
84
+ import { primeVuePlugin } from "@testforgejs/vue-test-plugin-primevue";
85
+
37
86
  const framework = createTestFramework({
38
87
  presets: {
39
88
  default: {
@@ -53,20 +102,109 @@ const framework = createTestFramework({
53
102
  },
54
103
  },
55
104
  });
105
+ ```
56
106
 
57
- const factory = framework.testComponentFactory(MyComponent);
107
+ Using `getDefaultOptions()` is optional. Define custom defaults when tests need to reproduce application-specific PrimeVue configuration such as a theme preset, pass-through configuration, locale settings, ripple effects, or other PrimeVue behavior.
58
108
 
59
- const wrapper = factory();
109
+ If the configuration references a PrimeVue theme preset such as Aura, the corresponding PrimeVue theme package must also be available in the project.
110
+
111
+ ## Configuration
112
+
113
+ ### PrimeVue options
114
+
115
+ The plugin integrates TestForge with PrimeVue by registering the PrimeVue Vue plugin with the provided configuration.
116
+
117
+ Configuration fields such as `unstyled`, `theme`, `pt`, `ptOptions`, `locale`, `ripple`, `zIndex`, and other PrimeVue options belong to PrimeVue.
118
+
119
+ TestForge does not define an alternative configuration format for PrimeVue. The integration passes the provided configuration to the PrimeVue plugin during installation.
120
+
121
+ Refer to the PrimeVue documentation for the complete set of supported configuration options and their behavior.
122
+
123
+ ### Styled and unstyled modes
124
+
125
+ The plugin-provided defaults use:
126
+
127
+ ```typescript
128
+ {
129
+ unstyled: true,
130
+ }
60
131
  ```
61
132
 
62
- `defaults.primevue` is an options factory. Each invocation produces a fresh PrimeVue options object for the current pipeline context.
133
+ This is intended as a project-independent testing baseline and does not attempt to reproduce an application's visual theme.
134
+
135
+ If a component test depends on the application's PrimeVue theme or other styled-mode configuration, provide that configuration explicitly in a project-specific preset instead of relying on the plugin defaults.
136
+
137
+ For example:
138
+
139
+ ```typescript
140
+ defaults: {
141
+ primevue: () => ({
142
+ theme: {
143
+ preset: Aura,
144
+ },
145
+ }),
146
+ },
147
+ ```
148
+
149
+ This keeps application-specific presentation policy in the project preset while the plugin provides a minimal reusable baseline.
150
+
151
+ ### Options factories
152
+
153
+ Preset defaults are defined as factories:
154
+
155
+ ```typescript
156
+ defaults: {
157
+ primevue: () => ({
158
+ theme: {
159
+ preset: Aura,
160
+ },
161
+ }),
162
+ },
163
+ ```
164
+
165
+ Each invocation of the factory produces a fresh options object for the current TestForge pipeline execution.
166
+
167
+ `primeVuePlugin.getDefaultOptions()` follows the same contract: it returns an options factory rather than a shared options object.
168
+
169
+ This allows presets to choose explicitly between:
170
+
171
+ - the project-independent defaults provided by the plugin; and
172
+ - a custom PrimeVue configuration defined by the preset.
173
+
174
+ ## Package exports
175
+
176
+ The package provides both descriptive and standardized plugin exports:
177
+
178
+ ```typescript
179
+ import { primeVuePlugin, plugin, PLUGIN_NAME } from "@testforgejs/vue-test-plugin-primevue";
180
+ ```
181
+
182
+ ### `primeVuePlugin`
183
+
184
+ The descriptive PrimeVue plugin module export.
185
+
186
+ ### `plugin`
187
+
188
+ The standardized plugin module export.
189
+
190
+ It references the same plugin module as `primeVuePlugin` and provides a consistent package-level API across TestForge plugin packages.
191
+
192
+ ### `PLUGIN_NAME`
193
+
194
+ The standardized plugin identifier export.
195
+
196
+ For this package:
197
+
198
+ ```typescript
199
+ PLUGIN_NAME === "primevue";
200
+ ```
63
201
 
64
- The plugin provides PrimeVue integration for components mounted through TestForge.
202
+ The standardized `plugin` and `PLUGIN_NAME` exports are useful for tooling and other code that works with TestForge plugin packages generically.
65
203
 
66
204
  ## Supported versions
67
205
 
68
- - Vue: 3.x
69
- - PrimeVue: 3.x and 4.x
206
+ - Vue: 3.3.0 or higher
207
+ - PrimeVue: 4.x
70
208
 
71
209
  ## Documentation
72
210
 
package/dist/index.cjs CHANGED
@@ -30,6 +30,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
30
30
  // src/index.ts
31
31
  var index_exports = {};
32
32
  __export(index_exports, {
33
+ PLUGIN_NAME: () => PRIMEVUE_PLUGIN_NAME,
34
+ plugin: () => primeVuePlugin,
33
35
  primeVuePlugin: () => primeVuePlugin
34
36
  });
35
37
  module.exports = __toCommonJS(index_exports);
@@ -41,24 +43,25 @@ function createPrimeVuePlugin(options) {
41
43
  return (0, import_vue_test_core.createVuePlugin)(import_config.default, options);
42
44
  }
43
45
 
46
+ // src/defaults.ts
47
+ var defaultOptions = () => () => ({
48
+ unstyled: true
49
+ });
50
+
51
+ // src/constants/constants.ts
52
+ var PRIMEVUE_PLUGIN_NAME = "primevue";
53
+
44
54
  // src/module/primeVuePlugin.ts
45
55
  var primeVuePlugin = {
46
- /**
47
- * Returns the plugin identifier used in TestForge configuration.
48
- *
49
- * @returns The plugin registration key (`"primevue"`).
50
- */
51
- getName: () => "primevue",
52
- /**
53
- * Returns the PrimeVue plugin lifecycle definition.
54
- *
55
- * @returns Plugin lifecycle hooks consumed by the TestForge kernel.
56
- */
56
+ getName: () => PRIMEVUE_PLUGIN_NAME,
57
57
  getDefinition: () => ({
58
58
  create: createPrimeVuePlugin
59
- })
59
+ }),
60
+ getDefaultOptions: defaultOptions
60
61
  };
61
62
  // Annotate the CommonJS export names for ESM import in node:
62
63
  0 && (module.exports = {
64
+ PLUGIN_NAME,
65
+ plugin,
63
66
  primeVuePlugin
64
67
  });
package/dist/index.d.cts CHANGED
@@ -1,69 +1,73 @@
1
1
  import PrimeVue, { PrimeVueConfiguration } from 'primevue/config';
2
- import { PluginModule } from '@testforgejs/vue-test-core';
2
+ import { PluginModuleWithDefaults } from '@testforgejs/vue-test-core';
3
3
 
4
4
  /**
5
- * Vue Test Utils compatible plugin tuple for PrimeVue.
5
+ * Stable TestForge identifier for the managed PrimeVue plugin.
6
6
  *
7
- * PrimeVue is an install-based Vue plugin and therefore integrates
8
- * through a standard `[plugin, options]` tuple instead of a runtime instance.
7
+ * Use this identifier when declaring PrimeVue configuration
8
+ * in presets and other plugin-aware TestForge APIs.
9
+ */
10
+ declare const PRIMEVUE_PLUGIN_NAME: "primevue";
11
+
12
+ /**
13
+ * Vue Test Utils-compatible plugin tuple for PrimeVue.
14
+ *
15
+ * Represents the install-based PrimeVue plugin together with its configuration,
16
+ * as accepted by Vue Test Utils through `global.plugins`.
9
17
  *
10
- * @see {@link PrimeVue}
11
- * @see {@link PrimeVueConfiguration}
18
+ * @see `PrimeVueConfiguration` from `primevue/config`.
12
19
  */
13
20
  type PrimeVueMountPlugin = [typeof PrimeVue, PrimeVueConfiguration];
14
21
  /**
15
- * Configuration options for the PrimeVue TestForge plugin.
22
+ * Configuration options for the managed PrimeVue plugin.
16
23
  *
17
- * This type maps directly to the official PrimeVue configuration object
18
- * and intentionally does not include TestForge runtime controls such as
19
- * `expose()` or `__meta.instance`, because PrimeVue does not create
20
- * a reusable runtime instance.
24
+ * Maps directly to the standard PrimeVue configuration.
21
25
  *
22
- * @see {@link PrimeVueConfiguration}
26
+ * Unlike plugins that create a dedicated runtime instance, PrimeVue uses
27
+ * an install-based Vue plugin integration and therefore does not support
28
+ * TestForge instance controls such as `expose`.
29
+ *
30
+ * @example
31
+ * Configure the managed PrimeVue plugin for a component test:
32
+ *
33
+ * ```ts
34
+ * factory({}, {
35
+ * plugins: {
36
+ * primevue: {
37
+ * ripple: true,
38
+ * },
39
+ * },
40
+ * });
41
+ * ```
42
+ *
43
+ * @see `PrimeVueConfiguration` from `primevue/config`.
23
44
  */
24
45
  type VueTestPrimeVueOptions = PrimeVueConfiguration;
25
46
 
26
47
  /**
27
- * Extends TestForge kernel types for PrimeVue integration.
28
- *
29
- * Registers the `primevue` configuration key inside the global
30
- * plugin options map, enabling strict typing and IDE autocompletion
31
- * when configuring PrimeVue in component tests.
48
+ * TestForge core type augmentation for PrimeVue integration.
32
49
  *
33
- * @module Augmentation
50
+ * Registers the public plugin configuration type
51
+ * used by TestForge's managed plugin APIs.
34
52
  */
35
53
  declare module "@testforgejs/vue-test-core" {
36
54
  /**
37
- * Global TestForge plugin configuration registry.
55
+ * Global map for TestForge plugin configuration options.
38
56
  */
39
57
  interface PluginOptionsMap {
40
58
  /**
41
- * Configuration for the `primevue` plugin.
42
- *
43
- * Accepts standard {@link VueTestPrimeVueOptions}
44
- * which correspond directly to PrimeVue configuration options.
45
- *
46
- * @example
47
- * ```ts
48
- * factory({}, {
49
- * plugins: {
50
- * primevue: {
51
- * ripple: true
52
- * }
53
- * }
54
- * })
55
- * ```
59
+ * Configuration accepted by the managed `primevue` plugin.
56
60
  */
57
- primevue: VueTestPrimeVueOptions;
61
+ [PRIMEVUE_PLUGIN_NAME]: VueTestPrimeVueOptions;
58
62
  }
59
63
  }
60
64
 
61
65
  /**
62
- * Official TestForge integration module for PrimeVue.
66
+ * Managed PrimeVue plugin module for TestForge.
63
67
  *
64
- * Registers PrimeVue in the TestForge plugin pipeline and exposes
65
- * the `primevue` configuration key for presets and mount options.
68
+ * Provides the runtime integration for mounting PrimeVue as an install-based
69
+ * Vue plugin and exposes the default configuration used by TestForge-managed presets.
66
70
  */
67
- declare const primeVuePlugin: PluginModule<PrimeVueMountPlugin, VueTestPrimeVueOptions>;
71
+ declare const primeVuePlugin: PluginModuleWithDefaults<PrimeVueMountPlugin, VueTestPrimeVueOptions>;
68
72
 
69
- export { type PrimeVueMountPlugin, type VueTestPrimeVueOptions, primeVuePlugin };
73
+ export { PRIMEVUE_PLUGIN_NAME as PLUGIN_NAME, type PrimeVueMountPlugin, type VueTestPrimeVueOptions, primeVuePlugin as plugin, primeVuePlugin };
package/dist/index.d.ts CHANGED
@@ -1,69 +1,73 @@
1
1
  import PrimeVue, { PrimeVueConfiguration } from 'primevue/config';
2
- import { PluginModule } from '@testforgejs/vue-test-core';
2
+ import { PluginModuleWithDefaults } from '@testforgejs/vue-test-core';
3
3
 
4
4
  /**
5
- * Vue Test Utils compatible plugin tuple for PrimeVue.
5
+ * Stable TestForge identifier for the managed PrimeVue plugin.
6
6
  *
7
- * PrimeVue is an install-based Vue plugin and therefore integrates
8
- * through a standard `[plugin, options]` tuple instead of a runtime instance.
7
+ * Use this identifier when declaring PrimeVue configuration
8
+ * in presets and other plugin-aware TestForge APIs.
9
+ */
10
+ declare const PRIMEVUE_PLUGIN_NAME: "primevue";
11
+
12
+ /**
13
+ * Vue Test Utils-compatible plugin tuple for PrimeVue.
14
+ *
15
+ * Represents the install-based PrimeVue plugin together with its configuration,
16
+ * as accepted by Vue Test Utils through `global.plugins`.
9
17
  *
10
- * @see {@link PrimeVue}
11
- * @see {@link PrimeVueConfiguration}
18
+ * @see `PrimeVueConfiguration` from `primevue/config`.
12
19
  */
13
20
  type PrimeVueMountPlugin = [typeof PrimeVue, PrimeVueConfiguration];
14
21
  /**
15
- * Configuration options for the PrimeVue TestForge plugin.
22
+ * Configuration options for the managed PrimeVue plugin.
16
23
  *
17
- * This type maps directly to the official PrimeVue configuration object
18
- * and intentionally does not include TestForge runtime controls such as
19
- * `expose()` or `__meta.instance`, because PrimeVue does not create
20
- * a reusable runtime instance.
24
+ * Maps directly to the standard PrimeVue configuration.
21
25
  *
22
- * @see {@link PrimeVueConfiguration}
26
+ * Unlike plugins that create a dedicated runtime instance, PrimeVue uses
27
+ * an install-based Vue plugin integration and therefore does not support
28
+ * TestForge instance controls such as `expose`.
29
+ *
30
+ * @example
31
+ * Configure the managed PrimeVue plugin for a component test:
32
+ *
33
+ * ```ts
34
+ * factory({}, {
35
+ * plugins: {
36
+ * primevue: {
37
+ * ripple: true,
38
+ * },
39
+ * },
40
+ * });
41
+ * ```
42
+ *
43
+ * @see `PrimeVueConfiguration` from `primevue/config`.
23
44
  */
24
45
  type VueTestPrimeVueOptions = PrimeVueConfiguration;
25
46
 
26
47
  /**
27
- * Extends TestForge kernel types for PrimeVue integration.
28
- *
29
- * Registers the `primevue` configuration key inside the global
30
- * plugin options map, enabling strict typing and IDE autocompletion
31
- * when configuring PrimeVue in component tests.
48
+ * TestForge core type augmentation for PrimeVue integration.
32
49
  *
33
- * @module Augmentation
50
+ * Registers the public plugin configuration type
51
+ * used by TestForge's managed plugin APIs.
34
52
  */
35
53
  declare module "@testforgejs/vue-test-core" {
36
54
  /**
37
- * Global TestForge plugin configuration registry.
55
+ * Global map for TestForge plugin configuration options.
38
56
  */
39
57
  interface PluginOptionsMap {
40
58
  /**
41
- * Configuration for the `primevue` plugin.
42
- *
43
- * Accepts standard {@link VueTestPrimeVueOptions}
44
- * which correspond directly to PrimeVue configuration options.
45
- *
46
- * @example
47
- * ```ts
48
- * factory({}, {
49
- * plugins: {
50
- * primevue: {
51
- * ripple: true
52
- * }
53
- * }
54
- * })
55
- * ```
59
+ * Configuration accepted by the managed `primevue` plugin.
56
60
  */
57
- primevue: VueTestPrimeVueOptions;
61
+ [PRIMEVUE_PLUGIN_NAME]: VueTestPrimeVueOptions;
58
62
  }
59
63
  }
60
64
 
61
65
  /**
62
- * Official TestForge integration module for PrimeVue.
66
+ * Managed PrimeVue plugin module for TestForge.
63
67
  *
64
- * Registers PrimeVue in the TestForge plugin pipeline and exposes
65
- * the `primevue` configuration key for presets and mount options.
68
+ * Provides the runtime integration for mounting PrimeVue as an install-based
69
+ * Vue plugin and exposes the default configuration used by TestForge-managed presets.
66
70
  */
67
- declare const primeVuePlugin: PluginModule<PrimeVueMountPlugin, VueTestPrimeVueOptions>;
71
+ declare const primeVuePlugin: PluginModuleWithDefaults<PrimeVueMountPlugin, VueTestPrimeVueOptions>;
68
72
 
69
- export { type PrimeVueMountPlugin, type VueTestPrimeVueOptions, primeVuePlugin };
73
+ export { PRIMEVUE_PLUGIN_NAME as PLUGIN_NAME, type PrimeVueMountPlugin, type VueTestPrimeVueOptions, primeVuePlugin as plugin, primeVuePlugin };
package/dist/index.js CHANGED
@@ -5,23 +5,24 @@ function createPrimeVuePlugin(options) {
5
5
  return createVuePlugin(PrimeVue, options);
6
6
  }
7
7
 
8
+ // src/defaults.ts
9
+ var defaultOptions = () => () => ({
10
+ unstyled: true
11
+ });
12
+
13
+ // src/constants/constants.ts
14
+ var PRIMEVUE_PLUGIN_NAME = "primevue";
15
+
8
16
  // src/module/primeVuePlugin.ts
9
17
  var primeVuePlugin = {
10
- /**
11
- * Returns the plugin identifier used in TestForge configuration.
12
- *
13
- * @returns The plugin registration key (`"primevue"`).
14
- */
15
- getName: () => "primevue",
16
- /**
17
- * Returns the PrimeVue plugin lifecycle definition.
18
- *
19
- * @returns Plugin lifecycle hooks consumed by the TestForge kernel.
20
- */
18
+ getName: () => PRIMEVUE_PLUGIN_NAME,
21
19
  getDefinition: () => ({
22
20
  create: createPrimeVuePlugin
23
- })
21
+ }),
22
+ getDefaultOptions: defaultOptions
24
23
  };
25
24
  export {
25
+ PRIMEVUE_PLUGIN_NAME as PLUGIN_NAME,
26
+ primeVuePlugin as plugin,
26
27
  primeVuePlugin
27
28
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@testforgejs/vue-test-plugin-primevue",
3
- "version": "1.0.0-beta.2",
3
+ "version": "1.0.0-beta.4",
4
4
  "type": "module",
5
5
  "description": "Official TestForge plugin for PrimeVue integration in component tests",
6
6
  "homepage": "https://github.com/testforgejs/testforge#readme",
@@ -41,12 +41,18 @@
41
41
  "license": "MIT",
42
42
  "author": "Roman Levchenko",
43
43
  "peerDependencies": {
44
- "primevue": "^3.0.0 || ^4.0.0",
45
- "@testforgejs/vue-test-core": "1.0.0-beta.2"
44
+ "primevue": "^4.0.0",
45
+ "@testforgejs/vue-test-core": "1.0.0-beta.4"
46
46
  },
47
47
  "devDependencies": {
48
48
  "primevue": "^4.0.0",
49
- "@testforgejs/vue-test-core": "1.0.0-beta.2"
49
+ "@testforgejs/vue-test-core": "1.0.0-beta.4"
50
+ },
51
+ "testforge": {
52
+ "plugin": {
53
+ "schemaVersion": 1,
54
+ "displayName": "PrimeVue"
55
+ }
50
56
  },
51
57
  "scripts": {
52
58
  "build": "tsup",