@augment-vir/test 31.23.3 → 31.24.0
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.
|
@@ -32,6 +32,11 @@ declare function importWebTestApi(this: void): Promise<RuntimeEnvError | {
|
|
|
32
32
|
* @returns A Promise that will resolve to the first child of the rendered HTML.
|
|
33
33
|
*/
|
|
34
34
|
render: typeof import("@open-wc/testing-helpers").fixture;
|
|
35
|
+
/**
|
|
36
|
+
* Accepts an element-vir element definition, requires the elements inputs (if any), renders
|
|
37
|
+
* the element and returns the instance.
|
|
38
|
+
*/
|
|
39
|
+
renderElement: typeof import("../test-web/render-element").renderElement;
|
|
35
40
|
/** Focus the given element and then type the given string. */
|
|
36
41
|
typeIntoInput: typeof import("../test-web/type-into-element").typeStringIntoElement;
|
|
37
42
|
/**
|
|
@@ -7,6 +7,7 @@ async function importWebTestApi() {
|
|
|
7
7
|
const { focusElement } = await import('../test-web/element-test-focus');
|
|
8
8
|
const { deleteAllTextInInput, typeString, typeStringIntoElement } = await import('../test-web/type-into-element');
|
|
9
9
|
const { fixtureCleanup, fixture } = await import('@open-wc/testing-helpers');
|
|
10
|
+
const { renderElement } = await import('../test-web/render-element');
|
|
10
11
|
return {
|
|
11
12
|
/**
|
|
12
13
|
* Cleans up all rendered test HTML by removing the actual wrapper nodes. Common use case is
|
|
@@ -40,6 +41,11 @@ async function importWebTestApi() {
|
|
|
40
41
|
* @returns A Promise that will resolve to the first child of the rendered HTML.
|
|
41
42
|
*/
|
|
42
43
|
render: fixture,
|
|
44
|
+
/**
|
|
45
|
+
* Accepts an element-vir element definition, requires the elements inputs (if any), renders
|
|
46
|
+
* the element and returns the instance.
|
|
47
|
+
*/
|
|
48
|
+
renderElement,
|
|
43
49
|
/** Focus the given element and then type the given string. */
|
|
44
50
|
typeIntoInput: typeStringIntoElement,
|
|
45
51
|
/**
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { type DeclarativeElementDefinition } from 'element-vir';
|
|
2
|
+
import { type EmptyObject } from 'type-fest';
|
|
3
|
+
export declare function renderElement<const Definition extends DeclarativeElementDefinition>(elementDefinition: Definition, ...args: Definition['InputsType'] extends EmptyObject ? [] : [Definition['InputsType']]): Promise<Definition["InstanceType"]>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { fixture } from '@open-wc/testing-helpers';
|
|
2
|
+
import { html } from 'element-vir';
|
|
3
|
+
export async function renderElement(elementDefinition, ...args) {
|
|
4
|
+
const instance = await fixture(html `
|
|
5
|
+
<${elementDefinition.assign(args[0] || {})}></${elementDefinition}>
|
|
6
|
+
`);
|
|
7
|
+
return instance;
|
|
8
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@augment-vir/test",
|
|
3
|
-
"version": "31.
|
|
3
|
+
"version": "31.24.0",
|
|
4
4
|
"description": "A universal testing suite that works with Mocha style test runners _and_ Node.js's built-in test runner.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"test",
|
|
@@ -43,8 +43,8 @@
|
|
|
43
43
|
"test:web": "virmator test --no-deps web 'src/test-web/**/*.test.ts' 'src/augments/universal-testing-suite/**/*.test.ts'"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@augment-vir/assert": "^31.
|
|
47
|
-
"@augment-vir/common": "^31.
|
|
46
|
+
"@augment-vir/assert": "^31.24.0",
|
|
47
|
+
"@augment-vir/common": "^31.24.0",
|
|
48
48
|
"@open-wc/testing-helpers": "^3.0.1",
|
|
49
49
|
"@virmator/test": "^13.15.3",
|
|
50
50
|
"type-fest": "^4.41.0"
|
|
@@ -60,6 +60,9 @@
|
|
|
60
60
|
"istanbul-smart-text-reporter": "^1.1.5",
|
|
61
61
|
"typescript": "^5.8.3"
|
|
62
62
|
},
|
|
63
|
+
"peerDependencies": {
|
|
64
|
+
"element-vir": "*"
|
|
65
|
+
},
|
|
63
66
|
"engines": {
|
|
64
67
|
"node": ">=22"
|
|
65
68
|
},
|