@unframework.dev/testing 0.2.1 → 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/browser/axe.js +1 -2
- package/dist/browser/behaviour.js +1 -2
- package/dist/browser/capabilities.js +2 -3
- package/dist/browser/clock.d.ts +1 -3
- package/dist/browser/clock.js +1 -2
- package/dist/browser/console.d.ts +1 -3
- package/dist/browser/console.js +1 -2
- package/dist/browser/determinism.js +1 -2
- package/dist/browser/element-timeout.js +1 -2
- package/dist/browser/events.js +1 -2
- package/dist/browser/geometry.js +1 -2
- package/dist/browser/keys.js +1 -2
- package/dist/browser/matchers.d.ts +1 -3
- package/dist/browser/matchers.js +4 -5
- package/dist/browser/navigation.js +1 -2
- package/dist/browser/parity.d.ts +3 -5
- package/dist/browser/parity.js +3 -4
- package/dist/browser/spec.d.ts +2 -4
- package/dist/browser/spec.js +6 -7
- package/dist/browser/target.d.ts +1 -3
- package/dist/browser/target.js +1 -2
- package/dist/browser/text-runs.js +1 -2
- package/dist/browser/thrown.js +3 -4
- package/dist/browser/trace.d.ts +1 -3
- package/dist/browser/trace.js +0 -1
- package/dist/browser/user.d.ts +1 -3
- package/dist/browser/user.js +1 -2
- package/dist/browser/view.d.ts +2 -4
- package/dist/browser/view.js +8 -9
- package/dist/browser/visual.d.ts +2 -4
- package/dist/browser/visual.js +1 -2
- package/dist/cli.d.ts +1 -3
- package/dist/cli.js +1 -2
- package/dist/commands.d.ts +1 -3
- package/dist/config/broadcast.js +1 -2
- package/dist/config/cases.d.ts +1 -3
- package/dist/config/cases.js +1 -2
- package/dist/config/index.d.ts +0 -2
- package/dist/config/index.js +2 -3
- package/dist/config/project-vite.d.ts +1 -3
- package/dist/config/project-vite.js +1 -2
- package/dist/diff.d.ts +1 -3
- package/dist/diff.js +1 -2
- package/dist/dom/serialize.js +2 -3
- package/dist/errors.d.ts +1 -3
- package/dist/errors.js +1 -2
- package/dist/harness.d.ts +1 -3
- package/dist/harness.js +1 -2
- package/dist/index.d.ts +3 -5
- package/dist/index.js +1 -2
- package/dist/internal.d.ts +3 -3
- package/dist/internal.js +2 -2
- package/dist/layers.d.ts +1 -3
- package/dist/layers.js +1 -2
- package/dist/node/browser.d.ts +0 -2
- package/dist/node/browser.js +2 -3
- package/dist/node/commands.d.ts +2 -4
- package/dist/node/commands.js +1 -2
- package/dist/node/context.d.ts +1 -3
- package/dist/node/context.js +1 -2
- package/dist/node/events.d.ts +1 -3
- package/dist/node/events.js +1 -2
- package/dist/node/finished.d.ts +1 -3
- package/dist/node/finished.js +1 -2
- package/dist/node/index.d.ts +10 -10
- package/dist/node/index.js +11 -11
- package/dist/node/matrix.d.ts +2 -4
- package/dist/node/matrix.js +1 -2
- package/dist/node/mode.d.ts +2 -4
- package/dist/node/mode.js +1 -2
- package/dist/node/names.d.ts +1 -3
- package/dist/node/names.js +1 -2
- package/dist/node/policy.d.ts +1 -3
- package/dist/node/policy.js +1 -2
- package/dist/node/reporter.d.ts +2 -3
- package/dist/node/reporter.js +2 -3
- package/dist/node/summary.d.ts +2 -4
- package/dist/node/summary.js +3 -4
- package/dist/node/thrown.js +1 -2
- package/dist/node/viewport.d.ts +1 -3
- package/dist/node/viewport.js +1 -2
- package/dist/node/visual.d.ts +1 -3
- package/dist/node/visual.js +2 -3
- package/dist/node_modules/.pnpm/playwright-core@1.63.0/node_modules/playwright-core/types/protocol.d.ts +1 -2
- package/dist/node_modules/.pnpm/playwright-core@1.63.0/node_modules/playwright-core/types/structs.d.ts +16 -3
- package/dist/node_modules/.pnpm/playwright-core@1.63.0/node_modules/playwright-core/types/types.d.ts +16 -2
- package/dist/normalize/display.js +1 -2
- package/dist/normalize/index.d.ts +1 -3
- package/dist/normalize/index.js +2 -3
- package/dist/normalize/pipeline.d.ts +1 -3
- package/dist/normalize/pipeline.js +2 -3
- package/dist/normalize/print.js +1 -2
- package/dist/normalize/rules/angular-hosts.js +1 -2
- package/dist/normalize/rules/aria-hosts.js +1 -2
- package/dist/normalize/rules/comments.js +1 -2
- package/dist/normalize/rules/control-values.js +1 -2
- package/dist/normalize/rules/engine-aliases.js +1 -2
- package/dist/normalize/rules/framework-attributes.js +1 -2
- package/dist/normalize/rules/generated-ids.js +1 -2
- package/dist/normalize/rules/ordering.js +1 -2
- package/dist/normalize/rules/qwik-styles.js +1 -2
- package/dist/normalize/rules/qwik-templates.js +1 -2
- package/dist/normalize/rules/values.js +1 -2
- package/dist/normalize/rules/whitespace.js +2 -3
- package/dist/normalize/style.js +1 -2
- package/dist/normalize/targets.d.ts +1 -3
- package/dist/normalize/targets.js +1 -2
- package/dist/normalize/tree.d.ts +1 -1
- package/dist/normalize/tree.js +1 -2
- package/dist/setup.js +8 -9
- package/dist/ssr/index.d.ts +0 -2
- package/dist/ssr/index.js +4 -5
- package/dist/ssr/spec.js +1 -2
- package/dist/targets/angular.js +1 -2
- package/dist/targets/astro.js +1 -2
- package/dist/targets/qwik.js +1 -2
- package/dist/targets/react.js +1 -2
- package/dist/targets/solid.js +1 -2
- package/dist/targets/svelte.js +1 -2
- package/dist/targets/vue.js +1 -2
- package/dist/visual-types.d.ts +1 -3
- package/dist/visual-types.js +1 -2
- package/package.json +14 -14
package/dist/node/summary.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { isCI } from "./mode.js";
|
|
2
|
-
import { FONT_AUDIT_SKIP, LIVE_REFERENCE_SKIP, REFERENCE_NOT_RUN_SKIP } from "../visual-types.js";
|
|
3
1
|
import { BROWSER_LAYERS, LAYERS, NOT_IN_THIS_RUN_SKIP, NOT_RENDERED_SKIP, NO_INTERACTION_SKIP, NO_OUTPUT_SKIP, NO_OUTPUT_TEST_SKIP, NO_SPEC_SKIP, REQUIRES_SKIP } from "../layers.js";
|
|
2
|
+
import { FONT_AUDIT_SKIP, LIVE_REFERENCE_SKIP, REFERENCE_NOT_RUN_SKIP } from "../visual-types.js";
|
|
4
3
|
import { cellHeadline, mergeMatrices, narrowing, outcomeOfCell, settleQuarantine, stringifyMatrix } from "./matrix.js";
|
|
4
|
+
import { isCI } from "./mode.js";
|
|
5
5
|
import { readPartialMatrices } from "./reporter.js";
|
|
6
6
|
import { appendFileSync, writeFileSync } from "node:fs";
|
|
7
7
|
import { join } from "node:path";
|
|
8
|
-
|
|
8
|
+
// src/node/summary.ts
|
|
9
9
|
/**
|
|
10
10
|
* The skips a live layer may record besides one by capability (plan §7.7, ADR-0050): each has a
|
|
11
11
|
* mechanical cause. Anything else on a live layer would hide a check that never ran.
|
|
@@ -348,5 +348,4 @@ function short(cell) {
|
|
|
348
348
|
function escapeCell(text) {
|
|
349
349
|
return text.replaceAll("|", "\\|");
|
|
350
350
|
}
|
|
351
|
-
//#endregion
|
|
352
351
|
export { coverageOf, renderMarkdown, summarise, summaryName, unacceptedSkip, writeSummary };
|
package/dist/node/thrown.js
CHANGED
|
@@ -2,7 +2,7 @@ import { caseDirectory, caseMainSource, projectHarness } from "./context.js";
|
|
|
2
2
|
import { existsSync, readFileSync, readdirSync } from "node:fs";
|
|
3
3
|
import { dirname, join, sep } from "node:path";
|
|
4
4
|
import { TraceMap, originalPositionFor } from "@jridgewell/trace-mapping";
|
|
5
|
-
|
|
5
|
+
// src/node/thrown.ts
|
|
6
6
|
/**
|
|
7
7
|
* The one line of a case's sources that holds `throw`: the `.uf.tsx` files of its directory and
|
|
8
8
|
* its main source, wherever that lies. Throws unless there is exactly one.
|
|
@@ -74,5 +74,4 @@ async function ufMapStack(context, request) {
|
|
|
74
74
|
const actual = `${position.source?.split("/").pop()}:${position.line}`;
|
|
75
75
|
return actual === expected ? {} : { message: `The top frame in the case maps to ${actual}, not to ${expected}: ${frame.url}:${frame.line}:${frame.column}.` };
|
|
76
76
|
}
|
|
77
|
-
//#endregion
|
|
78
77
|
export { servedFile, stackFrames, throwSite, ufMapStack };
|
package/dist/node/viewport.d.ts
CHANGED
package/dist/node/viewport.js
CHANGED
package/dist/node/visual.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
+
import { Page } from "../node_modules/.pnpm/playwright-core@1.63.0/node_modules/playwright-core/types/types.js";
|
|
1
2
|
import { HarnessContext } from "../harness.js";
|
|
2
3
|
import { CaptureRequest, CaptureResult, GeometryDelta, GeometrySnapshot } from "../visual-types.js";
|
|
3
4
|
import { CommandProject } from "./context.js";
|
|
4
|
-
import { Page } from "../node_modules/.pnpm/playwright-core@1.63.0/node_modules/playwright-core/types/types.js";
|
|
5
|
-
//#region src/node/visual.d.ts
|
|
6
5
|
/** The font file's internal family name that CDP reports for the bundled "UF Test Sans". */
|
|
7
6
|
export declare const ALLOWED_FONTS: readonly string[];
|
|
8
7
|
/** A project of the run, as the visual command looks for the reference's browser project. */
|
|
@@ -81,5 +80,4 @@ export declare function captureAt(context: VisualCommandContext, request: Captur
|
|
|
81
80
|
export declare function diffGeometry(expected: GeometrySnapshot, actual: GeometrySnapshot): GeometryDelta[];
|
|
82
81
|
/** Geometry deltas as message lines, the first `limit` of them. */
|
|
83
82
|
export declare function formatGeometryDiff(deltas: readonly GeometryDelta[], against?: string, limit?: number): string[];
|
|
84
|
-
//#endregion
|
|
85
83
|
export type { GeometryDelta };
|
package/dist/node/visual.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { caseReference } from "../harness.js";
|
|
2
2
|
import { caseDirectory, displayRoot, projectHarness } from "./context.js";
|
|
3
3
|
import { specFinished } from "./finished.js";
|
|
4
|
+
import { BASELINE_ENVIRONMENT } from "./mode.js";
|
|
4
5
|
import { KEBAB_CASE } from "./names.js";
|
|
5
6
|
import { writeIfChanged } from "./policy.js";
|
|
6
|
-
import { BASELINE_ENVIRONMENT } from "./mode.js";
|
|
7
7
|
import { existsSync, readFileSync } from "node:fs";
|
|
8
8
|
import { join, relative, sep } from "node:path";
|
|
9
9
|
import pixelmatch from "pixelmatch";
|
|
10
10
|
import { PNG } from "pngjs";
|
|
11
|
-
|
|
11
|
+
// src/node/visual.ts
|
|
12
12
|
/** The font file's internal family name that CDP reports for the bundled "UF Test Sans". */
|
|
13
13
|
const ALLOWED_FONTS = ["Inter"];
|
|
14
14
|
/** Baseline PNGs are named after the browser and the platform that produced them. */
|
|
@@ -369,5 +369,4 @@ function formatGeometryDiff(deltas, against = "the reference", limit = 12) {
|
|
|
369
369
|
if (deltas.length > limit) lines.push(` … ${deltas.length - limit} more`);
|
|
370
370
|
return [`Geometry and computed styles differ from ${against} (${deltas.length}):`, ...lines];
|
|
371
371
|
}
|
|
372
|
-
//#endregion
|
|
373
372
|
export { ALLOWED_FONTS, baselineFileName, captureAt, caseCaptureLocation, diffGeometry, formatGeometryDiff, ufVisualCapture };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region ../../node_modules/.pnpm/playwright-core@1.63.0/node_modules/playwright-core/types/protocol.d.ts
|
|
2
1
|
// This is generated from /utils/protocol-types-generator/index.js
|
|
3
2
|
type binary = string;
|
|
4
3
|
export declare namespace Protocol {
|
|
@@ -23927,4 +23926,4 @@ Error was thrown.
|
|
|
23927
23926
|
"Schema.getDomains": Schema.getDomainsReturnValue;
|
|
23928
23927
|
}
|
|
23929
23928
|
}
|
|
23930
|
-
|
|
23929
|
+
export {};
|
|
@@ -1,5 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Microsoft Corporation.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
1
16
|
import { BrowserContext, ElementHandle, Frame, JSHandle, Page } from "./types.js";
|
|
2
|
-
//#region ../../node_modules/.pnpm/playwright-core@1.63.0/node_modules/playwright-core/types/structs.d.ts
|
|
3
17
|
/**
|
|
4
18
|
* Can be converted to JSON
|
|
5
19
|
*/
|
|
@@ -18,5 +32,4 @@ export type BindingSource = {
|
|
|
18
32
|
context: BrowserContext;
|
|
19
33
|
page: Page;
|
|
20
34
|
frame: Frame;
|
|
21
|
-
};
|
|
22
|
-
//#endregion
|
|
35
|
+
};
|
package/dist/node_modules/.pnpm/playwright-core@1.63.0/node_modules/playwright-core/types/types.d.ts
CHANGED
|
@@ -1,9 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Microsoft Corporation.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
1
16
|
import { Protocol } from "./protocol.js";
|
|
2
17
|
import { BindingSource, ElementHandleForTag, EvaluationArgument, PageFunction, PageFunctionOn, Serializable, SmartHandle } from "./structs.js";
|
|
3
18
|
import { ChildProcess } from "child_process";
|
|
4
19
|
import { Readable } from "stream";
|
|
5
20
|
import { ReadStream } from "fs";
|
|
6
|
-
//#region ../../node_modules/.pnpm/playwright-core@1.63.0/node_modules/playwright-core/types/types.d.ts
|
|
7
21
|
// Use the global URLPattern type if available (Node.js 22+, modern browsers),
|
|
8
22
|
// otherwise fall back to `never` so it disappears from union types.
|
|
9
23
|
type URLPattern = typeof globalThis extends {
|
|
@@ -22218,4 +22232,4 @@ export interface PageScreenshotOptions {
|
|
|
22218
22232
|
*/
|
|
22219
22233
|
type?: "png" | "jpeg" | "webp";
|
|
22220
22234
|
}
|
|
22221
|
-
|
|
22235
|
+
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { styleValue } from "./style.js";
|
|
2
2
|
import { HTML_NAMESPACE, MATHML_NAMESPACE, SVG_NAMESPACE, getAttribute } from "./tree.js";
|
|
3
|
-
|
|
3
|
+
// src/normalize/display.ts
|
|
4
4
|
/**
|
|
5
5
|
* The live DOM path's side table. It normalises a tree parsed again from serialised HTML
|
|
6
6
|
* (`normalizeDomWithIds`), which carries no computed style, so the walk that checks the parsed
|
|
@@ -305,5 +305,4 @@ function preservesWhitespace(element, inherited) {
|
|
|
305
305
|
function keepsText(element) {
|
|
306
306
|
return element.namespaceURI === HTML_NAMESPACE && KEPT_TEXT_TAGS.has(element.tagName) || element.namespaceURI === SVG_NAMESPACE && SVG_PRESERVING_TAGS.has(element.tagName);
|
|
307
307
|
}
|
|
308
|
-
//#endregion
|
|
309
308
|
export { boxFromDisplay, boxOf, preservesWhitespace, recordComputedLayout };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { NORMALIZE_TARGETS, NormalizeTarget, isNormalizeTarget } from "./targets.js";
|
|
2
1
|
import { NormalizeOptions } from "./pipeline.js";
|
|
3
|
-
|
|
2
|
+
import { NORMALIZE_TARGETS, NormalizeTarget, isNormalizeTarget } from "./targets.js";
|
|
4
3
|
/**
|
|
5
4
|
* Normalises an HTML fragment (a component's server HTML, or `serializeDom` of a mount
|
|
6
5
|
* container) into the canonical text of `print.ts`: one node per line, attributes sorted,
|
|
@@ -30,5 +29,4 @@ import { NormalizeOptions } from "./pipeline.js";
|
|
|
30
29
|
* 7. generated ids become `uf-id-1`, `uf-id-2`… (`canonicalizeGeneratedIds`).
|
|
31
30
|
*/
|
|
32
31
|
export declare function normalizeHtml(html: string, options?: NormalizeOptions): string;
|
|
33
|
-
//#endregion
|
|
34
32
|
export { NORMALIZE_TARGETS, type NormalizeOptions, type NormalizeTarget, isNormalizeTarget };
|
package/dist/normalize/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { checkOptions, normalizeTree } from "./pipeline.js";
|
|
1
2
|
import { parseHtml } from "./tree.js";
|
|
2
3
|
import { NORMALIZE_TARGETS, isNormalizeTarget } from "./targets.js";
|
|
3
|
-
|
|
4
|
-
//#region src/normalize/index.ts
|
|
4
|
+
// src/normalize/index.ts
|
|
5
5
|
/**
|
|
6
6
|
* Normalises an HTML fragment (a component's server HTML, or `serializeDom` of a mount
|
|
7
7
|
* container) into the canonical text of `print.ts`: one node per line, attributes sorted,
|
|
@@ -34,5 +34,4 @@ function normalizeHtml(html, options = {}) {
|
|
|
34
34
|
checkOptions(options);
|
|
35
35
|
return normalizeTree(parseHtml(html), options);
|
|
36
36
|
}
|
|
37
|
-
//#endregion
|
|
38
37
|
export { NORMALIZE_TARGETS, isNormalizeTarget, normalizeHtml };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { BrowserEngine } from "../harness.js";
|
|
2
2
|
import { NormalizeTarget } from "./targets.js";
|
|
3
3
|
import "./tree.js";
|
|
4
|
-
//#region src/normalize/pipeline.d.ts
|
|
5
4
|
export interface NormalizeOptions {
|
|
6
5
|
/**
|
|
7
6
|
* The target that rendered the HTML. Its framework's noise (attributes it adds on its own,
|
|
@@ -15,5 +14,4 @@ export interface NormalizeOptions {
|
|
|
15
14
|
* engine, or in Chromium, no property is renamed.
|
|
16
15
|
*/
|
|
17
16
|
engine?: BrowserEngine;
|
|
18
|
-
}
|
|
19
|
-
//#endregion
|
|
17
|
+
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { BROWSER_ENGINES } from "../harness.js";
|
|
2
2
|
import { printTree } from "./print.js";
|
|
3
|
-
import { removeFrameworkAttributes } from "./rules/framework-attributes.js";
|
|
4
3
|
import { unwrapAngularHosts } from "./rules/angular-hosts.js";
|
|
5
4
|
import { removeComments } from "./rules/comments.js";
|
|
6
5
|
import { removeReactDefaultStates, removeSettledValues } from "./rules/control-values.js";
|
|
7
6
|
import { renameEngineAliases } from "./rules/engine-aliases.js";
|
|
7
|
+
import { removeFrameworkAttributes } from "./rules/framework-attributes.js";
|
|
8
8
|
import { canonicalizeGeneratedIds } from "./rules/generated-ids.js";
|
|
9
9
|
import { canonicalizeClasses, sortAttributes } from "./rules/ordering.js";
|
|
10
10
|
import { removeQwikStyles } from "./rules/qwik-styles.js";
|
|
@@ -12,7 +12,7 @@ import { removeQwikTemplates } from "./rules/qwik-templates.js";
|
|
|
12
12
|
import { canonicalizeBooleanAttributes, canonicalizeStyles } from "./rules/values.js";
|
|
13
13
|
import { collapseWhitespace } from "./rules/whitespace.js";
|
|
14
14
|
import { isNormalizeTarget } from "./targets.js";
|
|
15
|
-
|
|
15
|
+
// src/normalize/pipeline.ts
|
|
16
16
|
/** Refuses a target the normaliser does not know, from an untyped caller. */
|
|
17
17
|
function checkOptions(options) {
|
|
18
18
|
if (options.target !== void 0 && !isNormalizeTarget(options.target)) throw new TypeError(`normalizeHtml: unknown target ${JSON.stringify(options.target)}`);
|
|
@@ -41,5 +41,4 @@ function normalizeTree(root, options, ids) {
|
|
|
41
41
|
canonicalizeGeneratedIds(root, ids);
|
|
42
42
|
return printTree(root);
|
|
43
43
|
}
|
|
44
|
-
//#endregion
|
|
45
44
|
export { checkOptions, normalizeTree };
|
package/dist/normalize/print.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { HTML_NAMESPACE, attributeName, childrenOf, isElement, isText } from "./tree.js";
|
|
2
|
-
|
|
2
|
+
// src/normalize/print.ts
|
|
3
3
|
/**
|
|
4
4
|
* Elements that never have children or an end tag, including the obsolete ones the HTML parser
|
|
5
5
|
* still treats as void.
|
|
@@ -99,5 +99,4 @@ function printElement(element, indent, lines) {
|
|
|
99
99
|
printChildren(element, `${indent} `, lines);
|
|
100
100
|
lines.push(indent + end);
|
|
101
101
|
}
|
|
102
|
-
//#endregion
|
|
103
102
|
export { printTree, quote };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { dedupeDeclarations, parseStyle } from "../style.js";
|
|
2
2
|
import { HTML_NAMESPACE, attributeName, childrenOf, isElement, replaceChildren } from "../tree.js";
|
|
3
3
|
import { isFrameworkAttribute } from "./framework-attributes.js";
|
|
4
|
-
|
|
4
|
+
// src/normalize/rules/angular-hosts.ts
|
|
5
5
|
/**
|
|
6
6
|
* Whether an element is the host of an Angular component under D6: an element selector
|
|
7
7
|
* `uf-<name>` whose only styling is `display: contents`, so it renders no box. A host that
|
|
@@ -49,5 +49,4 @@ function unwrap(root) {
|
|
|
49
49
|
}
|
|
50
50
|
if (changed) replaceChildren(root, unwrapped);
|
|
51
51
|
}
|
|
52
|
-
//#endregion
|
|
53
52
|
export { isAngularHost, unwrapAngularHosts };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/normalize/rules/aria-hosts.ts
|
|
2
2
|
/** The `display` values whose children are flex or grid items, which CSS makes boxes. */
|
|
3
3
|
const ITEM_LAYOUTS = /* @__PURE__ */ new Set([
|
|
4
4
|
"flex",
|
|
@@ -44,5 +44,4 @@ function boxParent(element) {
|
|
|
44
44
|
while (parent.parentElement && getComputedStyle(parent).display === "contents") parent = parent.parentElement;
|
|
45
45
|
return parent;
|
|
46
46
|
}
|
|
47
|
-
//#endregion
|
|
48
47
|
export { inlineHosts };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { childrenOf, isElement, replaceChildren } from "../tree.js";
|
|
2
|
-
|
|
2
|
+
// src/normalize/rules/comments.ts
|
|
3
3
|
/**
|
|
4
4
|
* Rule 1: removes every comment. Comments are never rendered, and every framework uses them as
|
|
5
5
|
* anchors in its own way: Vue `<!--v-if-->` and `<!--[-->…<!--]-->`, Svelte `<!--[-->…<!--]-->`
|
|
@@ -12,5 +12,4 @@ function removeComments(root) {
|
|
|
12
12
|
if (children.some((node) => node.nodeName === "#comment")) replaceChildren(root, children.filter((node) => node.nodeName !== "#comment"));
|
|
13
13
|
for (const node of childrenOf(root)) if (isElement(node)) removeComments(node);
|
|
14
14
|
}
|
|
15
|
-
//#endregion
|
|
16
15
|
export { removeComments };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { HTML_NAMESPACE, attributeName, childrenOf, forEachElement, getAttribute, isText, replaceChildren } from "../tree.js";
|
|
2
|
-
|
|
2
|
+
// src/normalize/rules/control-values.ts
|
|
3
3
|
/**
|
|
4
4
|
* Rule 4d: removes the markup of a form control's initial state where its live state, a `uf:*`
|
|
5
5
|
* pseudo-attribute, says the same (ADR-0058):
|
|
@@ -61,5 +61,4 @@ function removeReactDefaultStates(root, target) {
|
|
|
61
61
|
function removeAttribute(element, name) {
|
|
62
62
|
element.attrs = element.attrs.filter((attribute) => attributeName(attribute) !== name);
|
|
63
63
|
}
|
|
64
|
-
//#endregion
|
|
65
64
|
export { removeReactDefaultStates, removeSettledValues };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { parseStyle, printStyle } from "../style.js";
|
|
2
2
|
import { attributeName, forEachElement } from "../tree.js";
|
|
3
|
-
|
|
3
|
+
// src/normalize/rules/engine-aliases.ts
|
|
4
4
|
/**
|
|
5
5
|
* The properties an engine serialises under its own alias, by engine: each alias and the name
|
|
6
6
|
* Chromium, which writes every committed expectation, serialises. Only an alias that names the
|
|
@@ -30,5 +30,4 @@ function renameEngineAliases(root, engine) {
|
|
|
30
30
|
}
|
|
31
31
|
});
|
|
32
32
|
}
|
|
33
|
-
//#endregion
|
|
34
33
|
export { renameEngineAliases };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { attributeName, forEachElement } from "../tree.js";
|
|
2
|
-
|
|
2
|
+
// src/normalize/rules/framework-attributes.ts
|
|
3
3
|
/**
|
|
4
4
|
* Attributes a framework adds on its own, which no source asks for, by the target whose
|
|
5
5
|
* framework adds them. Authored attributes, the compiler's own scope attributes (`data-uf-*`)
|
|
@@ -81,5 +81,4 @@ function removeFrameworkAttributes(root, target) {
|
|
|
81
81
|
element.attrs = element.attrs.filter((attribute) => !isFrameworkAttribute(attributeName(attribute), target));
|
|
82
82
|
});
|
|
83
83
|
}
|
|
84
|
-
//#endregion
|
|
85
84
|
export { FRAMEWORK_ATTRIBUTES, isFrameworkAttribute, removeFrameworkAttributes };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { attributeName, childrenOf, isElement, isText } from "../tree.js";
|
|
2
2
|
import { GENERATED_ID_PREFIX } from "@unframework.dev/ir";
|
|
3
|
-
|
|
3
|
+
// src/normalize/rules/generated-ids.ts
|
|
4
4
|
/**
|
|
5
5
|
* Generated ids are recognised by where they come from, not by their shape: they carry the
|
|
6
6
|
* prefix only the compiler writes (`GENERATED_ID_PREFIX`), in front of each framework's id on
|
|
@@ -60,5 +60,4 @@ function canonicalizeGeneratedIds(root, names = /* @__PURE__ */ new Map()) {
|
|
|
60
60
|
} else if (isText(node)) node.value = renameGeneratedIds(node.value, names);
|
|
61
61
|
return names;
|
|
62
62
|
}
|
|
63
|
-
//#endregion
|
|
64
63
|
export { canonicalizeGeneratedIds, renameGeneratedIds };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { attributeName, forEachElement } from "../tree.js";
|
|
2
|
-
|
|
2
|
+
// src/normalize/rules/ordering.ts
|
|
3
3
|
/** Compares by UTF-16 code units, so the order never depends on a locale. */
|
|
4
4
|
const byCodeUnits = (a, b) => a < b ? -1 : a > b ? 1 : 0;
|
|
5
5
|
/**
|
|
@@ -35,5 +35,4 @@ function canonicalizeClasses(root) {
|
|
|
35
35
|
});
|
|
36
36
|
});
|
|
37
37
|
}
|
|
38
|
-
//#endregion
|
|
39
38
|
export { canonicalizeClasses, sortAttributes };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { childrenOf, getAttribute, isElement, replaceChildren } from "../tree.js";
|
|
2
|
-
|
|
2
|
+
// src/normalize/rules/qwik-styles.ts
|
|
3
3
|
/**
|
|
4
4
|
* Rule 2c: removes every `<style q:style>` element, with its content, from Qwik's output
|
|
5
5
|
* (ADR-0063). A component's `useStyles$` sheet is written where the component renders by Qwik's
|
|
@@ -17,5 +17,4 @@ function remove(root) {
|
|
|
17
17
|
if (kept.length !== children.length) replaceChildren(root, kept);
|
|
18
18
|
for (const node of kept) if (isElement(node)) remove(node);
|
|
19
19
|
}
|
|
20
|
-
//#endregion
|
|
21
20
|
export { removeQwikStyles };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { childrenOf, isElement, replaceChildren } from "../tree.js";
|
|
2
|
-
|
|
2
|
+
// src/normalize/rules/qwik-templates.ts
|
|
3
3
|
/**
|
|
4
4
|
* Rule 2b: removes every `q:template` element, with its content, from Qwik's output (ADR-0058).
|
|
5
5
|
* Qwik's server render keeps a slot's unclaimed fallback in one, hidden and `aria-hidden`, for
|
|
@@ -16,5 +16,4 @@ function remove(root) {
|
|
|
16
16
|
if (kept.length !== children.length) replaceChildren(root, kept);
|
|
17
17
|
for (const node of kept) if (isElement(node)) remove(node);
|
|
18
18
|
}
|
|
19
|
-
//#endregion
|
|
20
19
|
export { removeQwikTemplates };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { parseStyle, printStyle, sortDeclarations } from "../style.js";
|
|
2
2
|
import { HTML_NAMESPACE, attributeName, forEachElement } from "../tree.js";
|
|
3
|
-
|
|
3
|
+
// src/normalize/rules/values.ts
|
|
4
4
|
/**
|
|
5
5
|
* Rule 4a: rewrites every `style` attribute in the CSSOM's format (`a: b; c: d;`): comments and
|
|
6
6
|
* spacing go and property names are lowercased (see `style.ts`). Then (ADR-0044, amending
|
|
@@ -121,5 +121,4 @@ function canonicalizeBooleanAttributes(root, target) {
|
|
|
121
121
|
}
|
|
122
122
|
});
|
|
123
123
|
}
|
|
124
|
-
//#endregion
|
|
125
124
|
export { canonicalizeBooleanAttributes, canonicalizeStyles };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { HTML_NAMESPACE, childrenOf, isElement, isText, replaceChildren } from "../tree.js";
|
|
2
1
|
import { boxOf, preservesWhitespace } from "../display.js";
|
|
3
|
-
|
|
2
|
+
import { HTML_NAMESPACE, childrenOf, isElement, isText, replaceChildren } from "../tree.js";
|
|
3
|
+
// src/normalize/rules/whitespace.ts
|
|
4
4
|
/** The whitespace `white-space: normal` collapses: spaces, tabs and line breaks (not U+00A0). */
|
|
5
5
|
const COLLAPSIBLE = /[ \t\n\r]+/g;
|
|
6
6
|
/** A segment break: a line break in the source text. */
|
|
@@ -377,5 +377,4 @@ function removeEmptyText(parent) {
|
|
|
377
377
|
if (children.some(isRemovable)) replaceChildren(parent, children.filter((node) => !isRemovable(node)));
|
|
378
378
|
for (const node of childrenOf(parent)) if (isElement(node)) removeEmptyText(node);
|
|
379
379
|
}
|
|
380
|
-
//#endregion
|
|
381
380
|
export { collapseWhitespace };
|
package/dist/normalize/style.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { cssPropertiesOverlap } from "@unframework.dev/ir";
|
|
2
|
-
|
|
2
|
+
// src/normalize/style.ts
|
|
3
3
|
/** CSS whitespace (not every Unicode space: U+00A0 is part of a value). */
|
|
4
4
|
const CSS_SPACE = /[ \t\n\r\f]/;
|
|
5
5
|
/**
|
|
@@ -117,5 +117,4 @@ function styleValue(style, ...properties) {
|
|
|
117
117
|
function sortDeclarations(declarations) {
|
|
118
118
|
return declarations.some((declaration, index) => declarations.slice(index + 1).some((other) => cssPropertiesOverlap(declaration.property, other.property))) ? [...declarations] : declarations.toSorted((a, b) => a.property < b.property ? -1 : a.property > b.property ? 1 : 0);
|
|
119
119
|
}
|
|
120
|
-
//#endregion
|
|
121
120
|
export { dedupeDeclarations, parseStyle, printStyle, sortDeclarations, styleValue };
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
//#region src/normalize/targets.d.ts
|
|
2
1
|
/** The seven targets whose output the normaliser knows. */
|
|
3
2
|
export declare const NORMALIZE_TARGETS: readonly ["react", "vue", "svelte", "solid", "angular", "qwik", "astro"];
|
|
4
3
|
/** A target the normaliser knows the framework noise of. */
|
|
5
4
|
export type NormalizeTarget = (typeof NORMALIZE_TARGETS)[number];
|
|
6
5
|
/** Whether `target` names one of the seven targets (a stub or third-party target does not). */
|
|
7
|
-
export declare function isNormalizeTarget(target: string): target is NormalizeTarget;
|
|
8
|
-
//#endregion
|
|
6
|
+
export declare function isNormalizeTarget(target: string): target is NormalizeTarget;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/normalize/targets.ts
|
|
2
2
|
/** The seven targets whose output the normaliser knows. */
|
|
3
3
|
const NORMALIZE_TARGETS = [
|
|
4
4
|
"react",
|
|
@@ -13,5 +13,4 @@ const NORMALIZE_TARGETS = [
|
|
|
13
13
|
function isNormalizeTarget(target) {
|
|
14
14
|
return NORMALIZE_TARGETS.includes(target);
|
|
15
15
|
}
|
|
16
|
-
//#endregion
|
|
17
16
|
export { NORMALIZE_TARGETS, isNormalizeTarget };
|
package/dist/normalize/tree.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import "parse5";
|
package/dist/normalize/tree.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defaultTreeAdapter, html, parseFragment } from "parse5";
|
|
2
|
-
|
|
2
|
+
// src/normalize/tree.ts
|
|
3
3
|
const HTML_NAMESPACE = html.NS.HTML;
|
|
4
4
|
const SVG_NAMESPACE = html.NS.SVG;
|
|
5
5
|
const MATHML_NAMESPACE = html.NS.MATHML;
|
|
@@ -147,5 +147,4 @@ function attributeName(attribute) {
|
|
|
147
147
|
function getAttribute(element, name) {
|
|
148
148
|
return element.attrs.find((attribute) => attributeName(attribute) === name)?.value;
|
|
149
149
|
}
|
|
150
|
-
//#endregion
|
|
151
150
|
export { HTML_NAMESPACE, MATHML_NAMESPACE, SVG_NAMESPACE, attributeName, childrenOf, forEachElement, getAttribute, isElement, isText, parseHtml, replaceChildren };
|
package/dist/setup.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { currentTarget } from "./browser/target.js";
|
|
3
|
-
import { beginSpecFileConsole, beginTestConsole, describeConsole, endSpecFileConsole, endTestConsole, installConsoleCapture, unexpectedConsole } from "./browser/console.js";
|
|
4
|
-
import { BROWSER_LAYERS, recordLayer, recordStandIn } from "./layers.js";
|
|
1
|
+
import { judgeTest } from "./browser/behaviour.js";
|
|
5
2
|
import { noOutputReason, requiredSkip, standInCause } from "./browser/capabilities.js";
|
|
6
3
|
import { restoreClock } from "./browser/clock.js";
|
|
4
|
+
import { beginSpecFileConsole, beginTestConsole, describeConsole, endSpecFileConsole, endTestConsole, installConsoleCapture, unexpectedConsole } from "./browser/console.js";
|
|
7
5
|
import { prepareSpecFile } from "./browser/determinism.js";
|
|
6
|
+
import { boundElementTimeout } from "./browser/element-timeout.js";
|
|
7
|
+
import { installMatchers } from "./browser/matchers.js";
|
|
8
8
|
import { installNavigationGuard, takePreventedNavigations } from "./browser/navigation.js";
|
|
9
|
+
import { currentTarget } from "./browser/target.js";
|
|
9
10
|
import { closeTraces } from "./browser/trace.js";
|
|
10
11
|
import { releaseKeys } from "./browser/user.js";
|
|
11
12
|
import { cleanup } from "./browser/view.js";
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import { boundElementTimeout } from "./browser/element-timeout.js";
|
|
13
|
+
import { caseOfFile } from "./harness.js";
|
|
14
|
+
import { BROWSER_LAYERS, recordLayer, recordStandIn } from "./layers.js";
|
|
15
15
|
import { afterAll, afterEach, aroundAll, aroundEach, beforeAll, beforeEach, inject } from "vitest";
|
|
16
16
|
import { commands, userEvent } from "vitest/browser";
|
|
17
|
-
|
|
17
|
+
// src/setup.ts
|
|
18
18
|
installConsoleCapture();
|
|
19
19
|
beginSpecFileConsole();
|
|
20
20
|
boundElementTimeout();
|
|
@@ -146,4 +146,3 @@ async function settleTeardown() {
|
|
|
146
146
|
await new Promise((resolve) => setTimeout(resolve, 0));
|
|
147
147
|
await new Promise((resolve) => requestAnimationFrame(() => resolve()));
|
|
148
148
|
}
|
|
149
|
-
//#endregion
|
package/dist/ssr/index.d.ts
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { SsrCase } from "../harness.js";
|
|
2
|
-
//#region src/ssr/index.d.ts
|
|
3
2
|
/**
|
|
4
3
|
* Declares the server render's tests for `cases`, in a `describe` titled `ssr [<target>]`, as
|
|
5
4
|
* `describeTargets` titles its own. It reads the project's provided `target`, `ufHarness` and
|
|
6
5
|
* `ufServer`, and throws in a project that lacks them.
|
|
7
6
|
*/
|
|
8
7
|
export declare function describeServerRender(cases: readonly SsrCase[]): void;
|
|
9
|
-
//#endregion
|
|
10
8
|
export type { SsrCase };
|
package/dist/ssr/index.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
+
import { formatConsoleArgs } from "../browser/console.js";
|
|
2
|
+
import { diffLines } from "../diff.js";
|
|
1
3
|
import { ssrScenarios } from "../harness.js";
|
|
4
|
+
import { checkLayers } from "../layers.js";
|
|
2
5
|
import { sharedArtefactContext } from "../node/context.js";
|
|
3
|
-
import { diffLines } from "../diff.js";
|
|
4
6
|
import { settleArtefact } from "../node/policy.js";
|
|
5
|
-
import { formatConsoleArgs } from "../browser/console.js";
|
|
6
|
-
import { checkLayers } from "../layers.js";
|
|
7
7
|
import { isNormalizeTarget } from "../normalize/targets.js";
|
|
8
8
|
import { normalizeHtml } from "../normalize/index.js";
|
|
9
9
|
import { join } from "node:path";
|
|
10
10
|
import { beforeAll, describe, inject, it } from "vitest";
|
|
11
|
-
|
|
11
|
+
// src/ssr/index.ts
|
|
12
12
|
/**
|
|
13
13
|
* Declares the server render's tests for `cases`, in a `describe` titled `ssr [<target>]`, as
|
|
14
14
|
* `describeTargets` titles its own. It reads the project's provided `target`, `ufHarness` and
|
|
@@ -99,5 +99,4 @@ function rendererOf(server) {
|
|
|
99
99
|
return renderer;
|
|
100
100
|
};
|
|
101
101
|
}
|
|
102
|
-
//#endregion
|
|
103
102
|
export { describeServerRender };
|
package/dist/ssr/spec.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { describeServerRender } from "./index.js";
|
|
2
2
|
import { inject } from "vitest";
|
|
3
|
-
|
|
3
|
+
// src/ssr/spec.ts
|
|
4
4
|
const cases = inject("ufSsrCases");
|
|
5
5
|
if (cases === void 0) throw new Error(`[uf] The ssr:${inject("target")} project provides no "ufSsrCases": this spec runs only in an ssr project of defineTestConfig.`);
|
|
6
6
|
describeServerRender(cases);
|
|
7
|
-
//#endregion
|
package/dist/targets/angular.js
CHANGED
package/dist/targets/astro.js
CHANGED
package/dist/targets/qwik.js
CHANGED
package/dist/targets/react.js
CHANGED
package/dist/targets/solid.js
CHANGED
package/dist/targets/svelte.js
CHANGED