@kumwe/studio-testkit 0.1.0-alpha.8 → 0.1.0-beta.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/README.md +79 -19
- package/THIRD_PARTY_NOTICES.md +9 -0
- package/conformance/authoring-web/non-drag-move-equivalence.json +199 -0
- package/conformance/renderer-web/blob-default-deny.json +62 -0
- package/conformance/renderer-web/chart-fallback.json +54 -0
- package/conformance/renderer-web/complete-catalog.json +649 -0
- package/conformance/renderer-web/escaped-heading.json +43 -0
- package/conformance/renderer-web/interactive-behaviors.json +284 -0
- package/conformance/renderer-web/presentation-capabilities.json +104 -0
- package/conformance/renderer-web/responsive-grid.json +48 -0
- package/conformance/renderer-web/security-fallbacks.json +184 -0
- package/conformance/rich-text/advanced.first-party.json +67 -0
- package/corpus-manifest.json +190 -2
- package/dist/contextual-conformance.d.ts +81 -0
- package/dist/contextual-conformance.d.ts.map +1 -0
- package/dist/contextual-conformance.js +1 -0
- package/dist/host-testbed.d.ts +47 -4
- package/dist/host-testbed.d.ts.map +1 -1
- package/dist/host-testbed.js +1 -742
- package/dist/http-authoring-contract.d.ts +3 -0
- package/dist/http-authoring-contract.d.ts.map +1 -0
- package/dist/http-authoring-contract.js +1 -0
- package/dist/http-host-adapter.d.ts +12 -64
- package/dist/http-host-adapter.d.ts.map +1 -1
- package/dist/http-host-adapter.js +1 -256
- package/dist/http-host-responder.d.ts +58 -0
- package/dist/http-host-responder.d.ts.map +1 -0
- package/dist/http-host-responder.js +1 -0
- package/dist/index.d.ts +49 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -174
- package/dist/web-conformance.d.ts +112 -0
- package/dist/web-conformance.d.ts.map +1 -0
- package/dist/web-conformance.js +1 -0
- package/fixtures/authoring-message-catalog.en.json +1093 -0
- package/fixtures/authoring-save.plan.example.json +48 -0
- package/fixtures/authoring-session.example.json +212 -0
- package/fixtures/authoring-target.example.json +34 -0
- package/fixtures/host-operations.example.json +77 -0
- package/fixtures/plugin.example.json +12 -0
- package/fixtures/reusable-content-type.example.json +26 -0
- package/fixtures/studio-deployment.hosted.example.json +152 -0
- package/fixtures/studio-deployment.standalone.example.json +9 -0
- package/invalid/authoring-save.plan-missing-coordinates.json +16 -0
- package/invalid/authoring-save.plan-missing-successor-context.json +28 -0
- package/invalid/authoring-save.request-plan-missing-successor-context.json +26 -0
- package/invalid/authoring-session.missing-entry-state.json +9 -0
- package/invalid/authoring-target.missing-resource-types.json +24 -0
- package/invalid/binding-projection-vector.unknown-status.json +85 -0
- package/invalid/host-error.retry-delay-without-retry.json +16 -0
- package/invalid/host-error.retry-delay-wrong-category.json +16 -0
- package/invalid/host-error.revision-without-conflict.json +16 -0
- package/invalid/reusable-content-type.entry-values.json +32 -0
- package/invalid/studio-chart.script-config.json +10 -0
- package/invalid/studio-deployment.long-lived-token.json +24 -0
- package/invalid/studio-deployment.missing-required.json +5 -0
- package/invalid/studio-deployment.unknown-member.json +15 -0
- package/invalid/studio-drawing.svg-payload.json +10 -0
- package/invalid/studio-money.float.json +8 -0
- package/invalid/studio-presentation.css-injection.json +8 -0
- package/invalid/studio-table.html-cell.json +8 -0
- package/package.json +8 -4
- package/studio-release.json +35 -0
- package/vectors/authoring-http/transport-matrix.json +237 -0
- package/vectors/binding-projection/app-content-fields.resolved.json +286 -0
- package/vectors/binding-projection/field-removed.diagnostic.json +135 -0
- package/vectors/binding-projection/model-revision-mismatch.diagnostic.json +124 -0
- package/vectors/host/model.get.stored.json +37 -0
- package/vectors/host/model.list.authorized.json +31 -0
- package/dist/host-testbed.js.map +0 -1
- package/dist/http-host-adapter.js.map +0 -1
- package/dist/index.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,174 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
export { createHostRequestContextFixture, createTestbedHost, TestbedHostError, } from './host-testbed.js';
|
|
4
|
-
export { createHttpHostAdapter, } from './http-host-adapter.js';
|
|
5
|
-
/**
|
|
6
|
-
* Replay a portable `studio.profile/schema-property` vector against the
|
|
7
|
-
* reference implementation. Only each case's input `value` is read from the
|
|
8
|
-
* accepted expectation; expected verdicts and diagnostics are not consulted.
|
|
9
|
-
* Callers compare this independently produced outcome with the published
|
|
10
|
-
* `expect` member.
|
|
11
|
-
*/
|
|
12
|
-
export function runSchemaProfileVector(vector) {
|
|
13
|
-
try {
|
|
14
|
-
const validator = compileStudioPropertySchema(vector.schema);
|
|
15
|
-
const instances = (vector.expect.instances ?? []).map((entry) => {
|
|
16
|
-
const valid = validator.validate(entry.value);
|
|
17
|
-
const first = validator.errors?.[0];
|
|
18
|
-
return {
|
|
19
|
-
...(first === undefined
|
|
20
|
-
? {}
|
|
21
|
-
: { diagnostic: { instancePath: first.instancePath, keyword: first.keyword } }),
|
|
22
|
-
valid,
|
|
23
|
-
value: entry.value,
|
|
24
|
-
};
|
|
25
|
-
});
|
|
26
|
-
return { instances, outcome: 'accepted' };
|
|
27
|
-
}
|
|
28
|
-
catch (error) {
|
|
29
|
-
if (error instanceof StudioSchemaProfileError) {
|
|
30
|
-
return {
|
|
31
|
-
code: error.code,
|
|
32
|
-
outcome: 'rejected',
|
|
33
|
-
schemaPath: error.schemaPath,
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
throw error;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
export function createBlueprintFixture(options = {}) {
|
|
40
|
-
return {
|
|
41
|
-
contractVersion: STUDIO_CONTRACT_VERSION,
|
|
42
|
-
dependencyLock: {
|
|
43
|
-
blocks: cloneValue(options.blockLocks ?? []),
|
|
44
|
-
theme: { id: 'studio.test/theme', revision: 'theme-r1', version: '1.0.0' },
|
|
45
|
-
},
|
|
46
|
-
id: options.id ?? 'test.blueprint',
|
|
47
|
-
kind: 'blueprint',
|
|
48
|
-
label: { defaultMessage: 'Test Blueprint', key: 'studio.test/blueprint' },
|
|
49
|
-
model: { id: 'studio.test/model', revision: 'model-r1', version: '1.0.0' },
|
|
50
|
-
owner: { id: 'studio.test/testkit', version: '0.1.0-alpha.0' },
|
|
51
|
-
revision: options.revision ?? 'blueprint-r1',
|
|
52
|
-
roots: cloneValue(options.roots ?? []),
|
|
53
|
-
status: 'draft',
|
|
54
|
-
version: '1.0.0',
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
export function defineTestBlock(options) {
|
|
58
|
-
const label = options.label ?? 'Test block';
|
|
59
|
-
return {
|
|
60
|
-
accessibility: {
|
|
61
|
-
accessibleName: 'not-applicable',
|
|
62
|
-
category: 'structural',
|
|
63
|
-
keyboard: { defaultMessage: 'Use outline commands.', key: 'studio.test/block-keyboard' },
|
|
64
|
-
outputChecks: ['studio.check/test-block'],
|
|
65
|
-
reducedMotion: 'not-applicable',
|
|
66
|
-
},
|
|
67
|
-
category: 'studio.category/test',
|
|
68
|
-
contractVersion: STUDIO_CONTRACT_VERSION,
|
|
69
|
-
editingModes: ['blueprint', 'content'],
|
|
70
|
-
kind: 'block-definition',
|
|
71
|
-
label: { defaultMessage: label, key: 'studio.test/block-label' },
|
|
72
|
-
owner: { id: 'studio.test/testkit', version: '0.1.0-alpha.0' },
|
|
73
|
-
ports: [],
|
|
74
|
-
propertySchema: cloneValue(options.propertySchema ?? { additionalProperties: false, type: 'object' }),
|
|
75
|
-
rendererRequirements: [
|
|
76
|
-
{ capability: 'studio.renderer/test', surface: 'preview', versions: '^0.1.0' },
|
|
77
|
-
],
|
|
78
|
-
revision: 'block-r1',
|
|
79
|
-
slots: cloneValue(options.slots ?? []),
|
|
80
|
-
themeControls: [],
|
|
81
|
-
type: options.type,
|
|
82
|
-
version: options.version ?? '1.0.0',
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
export function createStudioConfigurationFixture(options = {}) {
|
|
86
|
-
return {
|
|
87
|
-
actor: { displayName: 'Test Author', id: 'users/test-author' },
|
|
88
|
-
artifacts: {},
|
|
89
|
-
blocks: [],
|
|
90
|
-
composite: options.composite ?? 'single',
|
|
91
|
-
contractVersion: STUDIO_CONTRACT_VERSION,
|
|
92
|
-
displayPreferences: {
|
|
93
|
-
calendar: 'gregory',
|
|
94
|
-
hourCycle: 'h23',
|
|
95
|
-
measurementSystem: 'metric',
|
|
96
|
-
numberingSystem: 'latn',
|
|
97
|
-
},
|
|
98
|
-
features: {
|
|
99
|
-
clipboardMediaUpload: false,
|
|
100
|
-
collaboration: false,
|
|
101
|
-
customInspectors: false,
|
|
102
|
-
executablePlugins: false,
|
|
103
|
-
externalMediaImport: false,
|
|
104
|
-
offlineRecovery: false,
|
|
105
|
-
},
|
|
106
|
-
hostCapabilities: {
|
|
107
|
-
capabilities: [],
|
|
108
|
-
contractVersion: STUDIO_CONTRACT_VERSION,
|
|
109
|
-
host: { generation: 'host-r1', id: 'studio.test/host', version: '1.0.0' },
|
|
110
|
-
kind: 'host-capabilities',
|
|
111
|
-
ports: [],
|
|
112
|
-
protocolVersions: [STUDIO_WIRE_PROTOCOL_VERSION],
|
|
113
|
-
},
|
|
114
|
-
limits: {
|
|
115
|
-
maxChildrenPerSlot: 1_000,
|
|
116
|
-
maxCommandBatch: 100,
|
|
117
|
-
maxContributionsPerPlugin: 500,
|
|
118
|
-
maxDepth: 32,
|
|
119
|
-
maxExtensionBytes: 1_048_576,
|
|
120
|
-
maxHistoryEntries: 100,
|
|
121
|
-
maxLocaleBytes: 1_048_576,
|
|
122
|
-
maxMediaBatch: 50,
|
|
123
|
-
maxMediaUploadBytes: 1_073_741_824,
|
|
124
|
-
maxNodes: 5_000,
|
|
125
|
-
maxPluginCount: 20,
|
|
126
|
-
maxPreviewBytes: 10_485_760,
|
|
127
|
-
maxPreviewRequestsPerMinute: 120,
|
|
128
|
-
maxPropertyBytes: 1_048_576,
|
|
129
|
-
maxRichTextBytes: 1_048_576,
|
|
130
|
-
maxRichTextDepth: 32,
|
|
131
|
-
maxSlotsPerNode: 20,
|
|
132
|
-
},
|
|
133
|
-
locale: {
|
|
134
|
-
direction: 'ltr',
|
|
135
|
-
fallbacks: [],
|
|
136
|
-
requested: 'en',
|
|
137
|
-
resolved: 'en',
|
|
138
|
-
timeZone: 'UTC',
|
|
139
|
-
},
|
|
140
|
-
mode: options.mode ?? 'blueprint',
|
|
141
|
-
permissions: [],
|
|
142
|
-
plugins: [],
|
|
143
|
-
protocolVersion: STUDIO_WIRE_PROTOCOL_VERSION,
|
|
144
|
-
preview: { allowApproximateRenderer: false, enabled: false, sameOriginRequired: true },
|
|
145
|
-
sessionGeneration: 'session-r1',
|
|
146
|
-
sessionId: 'session-test',
|
|
147
|
-
sessionState: options.sessionState ?? 'editable',
|
|
148
|
-
resourceContext: {
|
|
149
|
-
key: 'contexts/test',
|
|
150
|
-
scopes: [],
|
|
151
|
-
surface: 'studio.test/fixture',
|
|
152
|
-
},
|
|
153
|
-
};
|
|
154
|
-
}
|
|
155
|
-
export function assertBlueprintConforms(blueprint, definitions) {
|
|
156
|
-
const result = validateBlueprint(blueprint, new BlockRegistry(definitions));
|
|
157
|
-
if (!result.valid) {
|
|
158
|
-
throw new StudioConformanceError(result.diagnostics);
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
export class StudioConformanceError extends Error {
|
|
162
|
-
diagnostics;
|
|
163
|
-
constructor(diagnostics) {
|
|
164
|
-
super(diagnostics
|
|
165
|
-
.map((entry) => `${entry.code}: ${entry.message.defaultMessage ?? entry.message.key}`)
|
|
166
|
-
.join('\n'));
|
|
167
|
-
this.name = 'StudioConformanceError';
|
|
168
|
-
this.diagnostics = cloneValue(diagnostics);
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
function cloneValue(value) {
|
|
172
|
-
return JSON.parse(JSON.stringify(value));
|
|
173
|
-
}
|
|
174
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
import{BlockRegistry as e,compileStudioPropertySchema as t,projectBlueprintFieldBindings as n,StudioSchemaProfileError as r,validateBlueprint as i}from"@kumwe/studio-core";import{STUDIO_CONTRACT_VERSION as a,STUDIO_WIRE_PROTOCOL_VERSION as o}from"@kumwe/studio-protocol";export{createHostRequestContextFixture,createTestbedHost,TestbedHostError}from"./host-testbed.js";export{createHttpHostAdapter,HTTP_HOST_OPERATION_ROUTES}from"./http-host-adapter.js";export{AUTHORING_HTTP_OPERATIONS,AUTHORING_HTTP_OPERATIONS_BY_ROUTE,AUTHORING_HTTP_SCHEMA_ID}from"./http-authoring-contract.js";export{createAuthoringHttpResponder}from"./http-host-responder.js";export{runAuthoringWebVector}from"./web-conformance.js";export{runContextualAuthoringStrideVector}from"./contextual-conformance.js";export function runBindingProjectionVector(e){let t=n(e.blueprint,e.model,e.blockDefinitions);return s({diagnostics:t.diagnostics.map(e=>({code:e.code,...e.location===void 0?{}:{location:e.location},severity:e.severity})),model:t.model,nodes:t.nodes.map(e=>({nodeId:e.nodeId,ports:e.ports.map(e=>({...e.binding===void 0?{}:{bindingSourceKind:e.binding.source.kind},...e.boundFieldPath===void 0?{}:{boundFieldPath:[...e.boundFieldPath]},candidates:e.candidates.map(e=>({cardinality:e.cardinality,...e.control===void 0?{}:{control:e.control},fieldPath:[...e.fieldPath],...e.itemKind===void 0?{}:{itemKind:e.itemKind},kind:e.kind})),...e.multiple===void 0?{}:{multiple:e.multiple},port:e.port,...e.required===void 0?{}:{required:e.required},status:e.status,...e.valueType===void 0?{}:{valueType:e.valueType}}))}))})}export function runSchemaProfileVector(e){try{let n=t(e.schema);return{instances:(e.expect.instances??[]).map(e=>{let t=n.validate(e.value),r=n.errors?.[0];return{...r===void 0?{}:{diagnostic:{instancePath:r.instancePath,keyword:r.keyword}},valid:t,value:e.value}}),outcome:`accepted`}}catch(e){if(e instanceof r)return{code:e.code,outcome:`rejected`,schemaPath:e.schemaPath};throw e}}export function createBlueprintFixture(e={}){return{contractVersion:a,dependencyLock:{blocks:s(e.blockLocks??[]),theme:{id:`studio.test/theme`,revision:`theme-r1`,version:`1.0.0`}},id:e.id??`test.blueprint`,kind:`blueprint`,label:{defaultMessage:`Test Blueprint`,key:`studio.test/blueprint`},model:{id:`studio.test/model`,revision:`model-r1`,version:`1.0.0`},owner:{id:`studio.test/testkit`,version:`0.1.0-alpha.0`},revision:e.revision??`blueprint-r1`,roots:s(e.roots??[]),status:`draft`,version:`1.0.0`}}export function defineTestBlock(e){let t=e.label??`Test block`;return{accessibility:{accessibleName:`not-applicable`,category:`structural`,keyboard:{defaultMessage:`Use outline commands.`,key:`studio.test/block-keyboard`},outputChecks:[`studio.check/test-block`],reducedMotion:`not-applicable`},category:`studio.category/test`,contractVersion:a,editingModes:[`blueprint`,`content`],kind:`block-definition`,label:{defaultMessage:t,key:`studio.test/block-label`},owner:{id:`studio.test/testkit`,version:`0.1.0-alpha.0`},ports:[],propertySchema:s(e.propertySchema??{additionalProperties:!1,type:`object`}),rendererRequirements:[{capability:`studio.renderer/test`,surface:`preview`,versions:`^0.1.0`}],revision:`block-r1`,slots:s(e.slots??[]),themeControls:[],type:e.type,version:e.version??`1.0.0`}}export function createStudioConfigurationFixture(e={}){return{actor:{displayName:`Test Author`,id:`users/test-author`},artifacts:{},blocks:[],composite:e.composite??`single`,contractVersion:a,displayPreferences:{calendar:`gregory`,hourCycle:`h23`,measurementSystem:`metric`,numberingSystem:`latn`},features:{clipboardMediaUpload:!1,collaboration:!1,customInspectors:!1,executablePlugins:!1,externalMediaImport:!1,offlineRecovery:!1},hostCapabilities:{capabilities:[],contractVersion:a,host:{generation:`host-r1`,id:`studio.test/host`,version:`1.0.0`},kind:`host-capabilities`,ports:[],protocolVersions:[o]},limits:{maxChildrenPerSlot:1e3,maxCommandBatch:100,maxContributionsPerPlugin:500,maxDepth:32,maxExtensionBytes:1048576,maxHistoryEntries:100,maxLocaleBytes:1048576,maxMediaBatch:50,maxMediaUploadBytes:1073741824,maxNodes:5e3,maxPluginCount:20,maxPreviewBytes:10485760,maxPreviewRequestsPerMinute:120,maxPropertyBytes:1048576,maxRichTextBytes:1048576,maxRichTextDepth:32,maxSlotsPerNode:20},locale:{direction:`ltr`,fallbacks:[],requested:`en`,resolved:`en`,timeZone:`UTC`},mode:e.mode??`blueprint`,permissions:[],plugins:[],protocolVersion:o,preview:{allowApproximateRenderer:!1,enabled:!1,sameOriginRequired:!0},sessionGeneration:`session-r1`,sessionId:`session-test`,sessionState:e.sessionState??`editable`,resourceContext:{key:`contexts/test`,scopes:[],surface:`studio.test/fixture`}}}export function assertBlueprintConforms(t,n){let r=i(t,new e(n));if(!r.valid)throw new StudioConformanceError(r.diagnostics)}export class StudioConformanceError extends Error{diagnostics;constructor(e){super(e.map(e=>`${e.code}: ${e.message.defaultMessage??e.message.key}`).join(`
|
|
2
|
+
`)),this.name=`StudioConformanceError`,this.diagnostics=s(e)}}function s(e){return JSON.parse(JSON.stringify(e))}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import type { BlueprintDocument, JsonObject, JsonValue, QualifiedName, StableId } from '@kumwe/studio-protocol';
|
|
2
|
+
export type AuthoringWebRegion = 'canvas' | 'command-palette' | 'inspector' | 'outline' | 'palette' | 'preview' | 'viewport';
|
|
3
|
+
export type AuthoringWebAction = {
|
|
4
|
+
kind: 'focus-node';
|
|
5
|
+
nodeId: StableId;
|
|
6
|
+
region: AuthoringWebRegion;
|
|
7
|
+
} | {
|
|
8
|
+
key: 'ArrowDown' | 'ArrowLeft' | 'ArrowRight' | 'ArrowUp' | 'Delete' | 'End' | 'Enter' | 'Escape' | 'Home' | 'Tab' | 'd' | 'y' | 'z';
|
|
9
|
+
kind: 'key';
|
|
10
|
+
modifiers: ('Alt' | 'Control' | 'Meta' | 'Shift')[];
|
|
11
|
+
region: AuthoringWebRegion;
|
|
12
|
+
} | {
|
|
13
|
+
destination: {
|
|
14
|
+
parentNodeId?: StableId;
|
|
15
|
+
position: number;
|
|
16
|
+
slot?: string;
|
|
17
|
+
};
|
|
18
|
+
kind: 'drag-node';
|
|
19
|
+
nodeId: StableId;
|
|
20
|
+
} | {
|
|
21
|
+
kind: 'activate-command';
|
|
22
|
+
payload: JsonObject;
|
|
23
|
+
region: AuthoringWebRegion;
|
|
24
|
+
type: QualifiedName;
|
|
25
|
+
} | {
|
|
26
|
+
kind: 'edit-property';
|
|
27
|
+
nodeId: StableId;
|
|
28
|
+
property: string;
|
|
29
|
+
value: JsonValue;
|
|
30
|
+
viewport?: string;
|
|
31
|
+
};
|
|
32
|
+
export interface AuthoringWebGiven {
|
|
33
|
+
direction: 'ltr' | 'rtl';
|
|
34
|
+
document: BlueprintDocument;
|
|
35
|
+
locale: string;
|
|
36
|
+
readOnly: boolean;
|
|
37
|
+
reducedMotion: boolean;
|
|
38
|
+
selection: StableId | null;
|
|
39
|
+
viewport: {
|
|
40
|
+
height: number;
|
|
41
|
+
width: number;
|
|
42
|
+
zoomPercent: number;
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
export interface AuthoringWebCommandObservation {
|
|
46
|
+
payload: JsonObject;
|
|
47
|
+
type: QualifiedName;
|
|
48
|
+
}
|
|
49
|
+
export interface AuthoringWebObservation {
|
|
50
|
+
announcements: {
|
|
51
|
+
key: QualifiedName;
|
|
52
|
+
politeness: 'assertive' | 'polite';
|
|
53
|
+
}[];
|
|
54
|
+
commands: AuthoringWebCommandObservation[];
|
|
55
|
+
dirty: boolean;
|
|
56
|
+
document: BlueprintDocument;
|
|
57
|
+
focus: {
|
|
58
|
+
nodeId?: StableId;
|
|
59
|
+
region: AuthoringWebRegion;
|
|
60
|
+
};
|
|
61
|
+
selection: StableId | null;
|
|
62
|
+
}
|
|
63
|
+
export interface AuthoringWebLane {
|
|
64
|
+
name: string;
|
|
65
|
+
steps: AuthoringWebAction[];
|
|
66
|
+
surface: 'keyboard' | 'pointer' | 'structural-control';
|
|
67
|
+
}
|
|
68
|
+
export interface AuthoringWebVector {
|
|
69
|
+
contractVersion: string;
|
|
70
|
+
description: string;
|
|
71
|
+
expect: AuthoringWebObservation;
|
|
72
|
+
given: AuthoringWebGiven;
|
|
73
|
+
id: QualifiedName;
|
|
74
|
+
kind: 'authoring-web-vector';
|
|
75
|
+
lanes: AuthoringWebLane[];
|
|
76
|
+
requirements: string[];
|
|
77
|
+
}
|
|
78
|
+
export interface AuthoringWebConformanceSession {
|
|
79
|
+
dispose?(): Promise<void> | void;
|
|
80
|
+
observe(): Promise<AuthoringWebObservation> | AuthoringWebObservation;
|
|
81
|
+
perform(action: Readonly<AuthoringWebAction>): Promise<void> | void;
|
|
82
|
+
}
|
|
83
|
+
export interface AuthoringWebConformanceAdapter {
|
|
84
|
+
open(given: Readonly<AuthoringWebGiven>, lane: Readonly<AuthoringWebLane>): Promise<AuthoringWebConformanceSession> | AuthoringWebConformanceSession;
|
|
85
|
+
}
|
|
86
|
+
export interface AuthoringWebLaneResult {
|
|
87
|
+
mismatches: string[];
|
|
88
|
+
name: string;
|
|
89
|
+
observation: AuthoringWebObservation;
|
|
90
|
+
passed: boolean;
|
|
91
|
+
surface: AuthoringWebLane['surface'];
|
|
92
|
+
}
|
|
93
|
+
export interface AuthoringWebVectorResult {
|
|
94
|
+
/**
|
|
95
|
+
* Blueprint interaction vectors are one executable part of authoring-web,
|
|
96
|
+
* not a claim that the complete contextual product profile has passed.
|
|
97
|
+
*/
|
|
98
|
+
completeProfile: false;
|
|
99
|
+
lanes: AuthoringWebLaneResult[];
|
|
100
|
+
mismatches: string[];
|
|
101
|
+
passed: boolean;
|
|
102
|
+
profile: 'studio.profile/authoring-web';
|
|
103
|
+
requirements: string[];
|
|
104
|
+
vectorId: QualifiedName;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Replay every interaction lane from an independent copy of the same initial
|
|
108
|
+
* state. The adapter owns browser automation; this runner owns fixture
|
|
109
|
+
* isolation and deterministic observation comparison.
|
|
110
|
+
*/
|
|
111
|
+
export declare function runAuthoringWebVector(vector: Readonly<AuthoringWebVector>, adapter: Readonly<AuthoringWebConformanceAdapter>): Promise<AuthoringWebVectorResult>;
|
|
112
|
+
//# sourceMappingURL=web-conformance.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"web-conformance.d.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|
1
|
+
const e=Object.freeze([`keyboard`,`pointer`,`structural-control`]);export async function runAuthoringWebVector(e,t){let i=o(e),s=n(e),c=[];for(let n of e.lanes){let s=await t.open(a(e.given),a(n)),l;try{for(let e of n.steps)await s.perform(a(e));l=a(await s.observe())}finally{await s.dispose?.()}let u=r(l,e.expect);o(e)!==i&&u.push(`adapter mutated the conformance vector`),c.push({mismatches:u,name:n.name,observation:l,passed:u.length===0,surface:n.surface})}return{completeProfile:!1,lanes:c,mismatches:s,passed:s.length===0&&c.every(e=>e.passed),profile:`studio.profile/authoring-web`,requirements:[...e.requirements],vectorId:e.id}}function n(t){let n=[],r=new Set,i=new Set;for(let e of t.lanes)r.has(e.name)&&n.push(`lane name ${e.name} is duplicated`),r.add(e.name),i.add(e.surface);for(let t of e)i.has(t)||n.push(`missing ${t} interaction lane`);return n}function r(e,t){let n=[];return i(n,`announcements`,e.announcements,t.announcements),i(n,`commands`,e.commands,t.commands),i(n,`dirty`,e.dirty,t.dirty),i(n,`document`,e.document,t.document),i(n,`focus`,e.focus,t.focus),i(n,`selection`,e.selection,t.selection),n}function i(e,t,n,r){o(n)!==o(r)&&e.push(`${t} differs from the vector expectation`)}function a(e){return JSON.parse(JSON.stringify(e))}function o(e){return JSON.stringify(s(e))??`undefined`}function s(e){return Array.isArray(e)?e.map(e=>s(e)):typeof e==`object`&&e?Object.fromEntries(Object.entries(e).sort(([e],[t])=>e<t?-1:+(e>t)).map(([e,t])=>[e,s(t)])):e}
|