@testforgejs/vue-test-plugin-primevue 1.0.0-beta.2 → 1.0.0-beta.3
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 +146 -8
- package/dist/index.cjs +20 -2
- package/dist/index.d.cts +6 -4
- package/dist/index.d.ts +6 -4
- package/dist/index.js +18 -2
- package/package.json +10 -4
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @testforgejs/vue-test-plugin-primevue
|
|
2
2
|
|
|
3
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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.
|
|
69
|
-
- PrimeVue:
|
|
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,6 +43,14 @@ 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
56
|
/**
|
|
@@ -48,7 +58,7 @@ var primeVuePlugin = {
|
|
|
48
58
|
*
|
|
49
59
|
* @returns The plugin registration key (`"primevue"`).
|
|
50
60
|
*/
|
|
51
|
-
getName: () =>
|
|
61
|
+
getName: () => PRIMEVUE_PLUGIN_NAME,
|
|
52
62
|
/**
|
|
53
63
|
* Returns the PrimeVue plugin lifecycle definition.
|
|
54
64
|
*
|
|
@@ -56,9 +66,17 @@ var primeVuePlugin = {
|
|
|
56
66
|
*/
|
|
57
67
|
getDefinition: () => ({
|
|
58
68
|
create: createPrimeVuePlugin
|
|
59
|
-
})
|
|
69
|
+
}),
|
|
70
|
+
/**
|
|
71
|
+
* Creates the default PrimeVue options used by TestForge.
|
|
72
|
+
*
|
|
73
|
+
* @returns A factory that creates the default PrimeVue options.
|
|
74
|
+
*/
|
|
75
|
+
getDefaultOptions: defaultOptions
|
|
60
76
|
};
|
|
61
77
|
// Annotate the CommonJS export names for ESM import in node:
|
|
62
78
|
0 && (module.exports = {
|
|
79
|
+
PLUGIN_NAME,
|
|
80
|
+
plugin,
|
|
63
81
|
primeVuePlugin
|
|
64
82
|
});
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import PrimeVue, { PrimeVueConfiguration } from 'primevue/config';
|
|
2
|
-
import {
|
|
2
|
+
import { PluginModuleWithDefaults } from '@testforgejs/vue-test-core';
|
|
3
|
+
|
|
4
|
+
declare const PRIMEVUE_PLUGIN_NAME: "primevue";
|
|
3
5
|
|
|
4
6
|
/**
|
|
5
7
|
* Vue Test Utils compatible plugin tuple for PrimeVue.
|
|
@@ -54,7 +56,7 @@ declare module "@testforgejs/vue-test-core" {
|
|
|
54
56
|
* })
|
|
55
57
|
* ```
|
|
56
58
|
*/
|
|
57
|
-
|
|
59
|
+
[PRIMEVUE_PLUGIN_NAME]: VueTestPrimeVueOptions;
|
|
58
60
|
}
|
|
59
61
|
}
|
|
60
62
|
|
|
@@ -64,6 +66,6 @@ declare module "@testforgejs/vue-test-core" {
|
|
|
64
66
|
* Registers PrimeVue in the TestForge plugin pipeline and exposes
|
|
65
67
|
* the `primevue` configuration key for presets and mount options.
|
|
66
68
|
*/
|
|
67
|
-
declare const primeVuePlugin:
|
|
69
|
+
declare const primeVuePlugin: PluginModuleWithDefaults<PrimeVueMountPlugin, VueTestPrimeVueOptions>;
|
|
68
70
|
|
|
69
|
-
export { type PrimeVueMountPlugin, type VueTestPrimeVueOptions, primeVuePlugin };
|
|
71
|
+
export { PRIMEVUE_PLUGIN_NAME as PLUGIN_NAME, type PrimeVueMountPlugin, type VueTestPrimeVueOptions, primeVuePlugin as plugin, primeVuePlugin };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import PrimeVue, { PrimeVueConfiguration } from 'primevue/config';
|
|
2
|
-
import {
|
|
2
|
+
import { PluginModuleWithDefaults } from '@testforgejs/vue-test-core';
|
|
3
|
+
|
|
4
|
+
declare const PRIMEVUE_PLUGIN_NAME: "primevue";
|
|
3
5
|
|
|
4
6
|
/**
|
|
5
7
|
* Vue Test Utils compatible plugin tuple for PrimeVue.
|
|
@@ -54,7 +56,7 @@ declare module "@testforgejs/vue-test-core" {
|
|
|
54
56
|
* })
|
|
55
57
|
* ```
|
|
56
58
|
*/
|
|
57
|
-
|
|
59
|
+
[PRIMEVUE_PLUGIN_NAME]: VueTestPrimeVueOptions;
|
|
58
60
|
}
|
|
59
61
|
}
|
|
60
62
|
|
|
@@ -64,6 +66,6 @@ declare module "@testforgejs/vue-test-core" {
|
|
|
64
66
|
* Registers PrimeVue in the TestForge plugin pipeline and exposes
|
|
65
67
|
* the `primevue` configuration key for presets and mount options.
|
|
66
68
|
*/
|
|
67
|
-
declare const primeVuePlugin:
|
|
69
|
+
declare const primeVuePlugin: PluginModuleWithDefaults<PrimeVueMountPlugin, VueTestPrimeVueOptions>;
|
|
68
70
|
|
|
69
|
-
export { type PrimeVueMountPlugin, type VueTestPrimeVueOptions, primeVuePlugin };
|
|
71
|
+
export { PRIMEVUE_PLUGIN_NAME as PLUGIN_NAME, type PrimeVueMountPlugin, type VueTestPrimeVueOptions, primeVuePlugin as plugin, primeVuePlugin };
|
package/dist/index.js
CHANGED
|
@@ -5,6 +5,14 @@ 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
18
|
/**
|
|
@@ -12,7 +20,7 @@ var primeVuePlugin = {
|
|
|
12
20
|
*
|
|
13
21
|
* @returns The plugin registration key (`"primevue"`).
|
|
14
22
|
*/
|
|
15
|
-
getName: () =>
|
|
23
|
+
getName: () => PRIMEVUE_PLUGIN_NAME,
|
|
16
24
|
/**
|
|
17
25
|
* Returns the PrimeVue plugin lifecycle definition.
|
|
18
26
|
*
|
|
@@ -20,8 +28,16 @@ var primeVuePlugin = {
|
|
|
20
28
|
*/
|
|
21
29
|
getDefinition: () => ({
|
|
22
30
|
create: createPrimeVuePlugin
|
|
23
|
-
})
|
|
31
|
+
}),
|
|
32
|
+
/**
|
|
33
|
+
* Creates the default PrimeVue options used by TestForge.
|
|
34
|
+
*
|
|
35
|
+
* @returns A factory that creates the default PrimeVue options.
|
|
36
|
+
*/
|
|
37
|
+
getDefaultOptions: defaultOptions
|
|
24
38
|
};
|
|
25
39
|
export {
|
|
40
|
+
PRIMEVUE_PLUGIN_NAME as PLUGIN_NAME,
|
|
41
|
+
primeVuePlugin as plugin,
|
|
26
42
|
primeVuePlugin
|
|
27
43
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@testforgejs/vue-test-plugin-primevue",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.3",
|
|
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": "^
|
|
45
|
-
"@testforgejs/vue-test-core": "1.0.0-beta.
|
|
44
|
+
"primevue": "^4.0.0",
|
|
45
|
+
"@testforgejs/vue-test-core": "1.0.0-beta.3"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"primevue": "^4.0.0",
|
|
49
|
-
"@testforgejs/vue-test-core": "1.0.0-beta.
|
|
49
|
+
"@testforgejs/vue-test-core": "1.0.0-beta.3"
|
|
50
|
+
},
|
|
51
|
+
"testforge": {
|
|
52
|
+
"plugin": {
|
|
53
|
+
"schemaVersion": 1,
|
|
54
|
+
"displayName": "PrimeVue"
|
|
55
|
+
}
|
|
50
56
|
},
|
|
51
57
|
"scripts": {
|
|
52
58
|
"build": "tsup",
|