Skip to content

armgit / core

Public Imported from GitHub
0

100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps

Make simulator replay data a singular input (#3027)

Koende700b123d3a
diff --git a/AGENTS.md b/AGENTS.md
index 0b70dde72..94490f723 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -17,6 +17,10 @@ Running `./gradlew clean` deletes the root `tmp/` directory that is mounted into
## UI
+### Generated model types
+
+`ui/component/model/src/model.ts` is generated from the Java backend by typescript-generator. Do not edit it by hand. When a TypeScript type mirrors a backend class, import it from `@openremote/model` instead of redeclaring a local interface. Regenerate it from the backend rather than patching the output.
+
### Adding a new Vaadin component
Vaadin-based components live in `ui/component/or-vaadin-components/src/` as thin wrappers that extend a Vaadin class and re-register it under an `or-vaadin-<name>` tag, e.g. `export class OrVaadinX extends (X as new () => X & LitElement)` with `@customElement("or-vaadin-x")`. Keep all `@vaadin/*` dependency versions aligned.
@@ -25,9 +29,10 @@ Vaadin-based components live in `ui/component/or-vaadin-components/src/` as thin
Pick the approach by how much of the base component you need to keep. The base + Lumo styles are keyed off the element's `static get is()`, so a wrapper that does *not* override `is` still reports the base tag (e.g. `vaadin-checkbox-group`) and inherits the full base + Lumo theme.
-**Small tweaks to an existing component (preferred default).** For small visual tweaks to an existing component, do NOT override `is`, since that detaches the element from the base + Lumo styles keyed off `is` and strips the inherited theme/layout entirely. Instead, apply the styles in the following ways:
-- Add the rules to a theme module in `ui/component/theme/src/components/or-vaadin-<name>.css` and `@import` it from that dir's `index.css`.
-- Reach shadow parts from *outside* with an external `::part()` rule keyed on the real tag name, e.g. `or-vaadin-<tag>::part(<part>) { … }`. Such a rule is invisible to the `is`-based lookup, so it scopes cleanly to that tag only (see `or-vaadin-toggle-group.ts` and its theme `or-vaadin-toggle-group.css`).
+**Small tweaks to an existing component (preferred default).** Do NOT override `is`, since that detaches the element from the base + Lumo styles keyed off `is` and strips the inherited theme/layout entirely. Do NOT use `static get styles()` — ThemableMixin injects those *before* Lumo, so Lumo wins; and for wrapper classes that don't override `is`, ThemableMixin may not associate the child's `static get styles()` with the finalized element at all. Instead apply styles in one of these ways:
+- **External `::part()` rule (preferred for part properties).** Add the rule in `ui/component/theme/src/components/or-vaadin-<name>.css` (imported from that dir's `index.css`), keyed on the real tag name: `or-vaadin-<tag>::part(<part>) { … }`. This is a plain browser CSS feature — the global stylesheet pierces the shadow DOM boundary through the exposed part with no ThemableMixin involvement. It scopes cleanly to that tag only and is invisible to the `is`-based lookup.
+- **Lumo `@media` module injection (for rules that must live inside the shadow DOM).** Use this only when `::part()` is insufficient — e.g. `:host` pseudo-class selectors, `::slotted`, or pseudo-elements that cannot be reached from outside. Define the rules in a named `@media <module-name>` block in the theme CSS file and add that name to `--_lumo-vaadin-<tag>-inject-modules`. The injector stamps those rules into the shadow DOM *after* Lumo, so they always win.
+- **Slotted native inputs (`<textarea>`, `<input>`) are light DOM, not shadow DOM.** Style them with a normal descendant rule from the surrounding tree (`or-vaadin-<tag> textarea { … }`) or with inline styles from the wrapper class; both win over the base component's `::slotted()` rules in the cascade.
**A component that fully owns its visuals via `registerStyles()`.** Only when the component re-implements the look from scratch (so it has no inherited theme to preserve) override `is` and register styles from its own module; do NOT use `static get styles()`. Vaadin's `ThemableMixin.finalizeStyles()` injects `static` styles *before* the Lumo theme injector, so the theme overrides them and nothing appears to apply; styles registered via `registerStyles()` are injected *after* the injector, so they always win. Recipe (see `or-vaadin-toggle.ts`):
- Call `registerStyles("or-vaadin-<tag>", css\`...\`)` from `@vaadin/vaadin-themable-mixin/register-styles.js` at module top (before the element is finalized).
@@ -52,9 +57,10 @@ Stories call `getORStorybookHelpers(tagName)` (from `ui/component/storybook-util
### Component testing
-Component tests use Playwright component testing (`@sand4rt/experimental-ct-web`). They live in each package's `test/*.test.ts`, import `{ ct, expect }` from `@openremote/test`, and `mount(ComponentClass, { props, slots, on })`. Run them with `npm test` in the package (which does `tsc -b && playwright test`). Prefer web-first, role-based assertions (`getByRole("checkbox", { name }).toBeChecked()`, `toHaveCount(...)`) over poking at JS properties (`toHaveJSProperty`) or internal locators. Some important quirks to know about:
+Component tests use Playwright component testing (`@sand4rt/experimental-ct-web`). They live in each package's `test/*.test.ts`, import `{ ct, expect }` from `@openremote/test`, and `mount(ComponentClass, { props, slots, on })`. Run them with `npm test` in the package (which does `tsc -b && playwright test`). CI runs `./gradlew -p ui/component npmTest`, which only executes packages that register an `npmTest` task, so when adding the first test to a package also register `npmTest` (and `npmTestUI`) in its `build.gradle` file; copy the tasks from a sibling package. Prefer web-first, role-based assertions (`getByRole("checkbox", { name }).toBeChecked()`, `toHaveCount(...)`) over poking at JS properties (`toHaveJSProperty`) or internal locators. Some important quirks to know about:
- **Custom elements used as slotted/appended children must be eagerly registered.** Playwright CT turns each imported component into a *lazy* dynamic import that only runs when that component is `mount()`ed, so a child element that is never mounted itself (e.g. `or-vaadin-toggle` slotted inside `or-vaadin-toggle-group`) never gets `customElements.define`d and stays an inert, unupgraded tag that appends to the DOM but does not render. Declare such components in the test itself via `mount(..., { hooksConfig: { components: [OrVaadinToggle] } })`; the `beforeMount` hook in `ui/test/playwright/index.js` resolves their import refs, which runs their modules and registers them before the mount.
+- **Imports referenced outside a `mount()` call are evaluated in Node, where browser-only modules crash.** Any such usage (a props-building helper, a spread like `...StandardRenderers`) makes Node evaluate the imported module chain, which crashes on the `require("*.css")` calls in `or-mwc-components` (`SyntaxError: Unexpected token '.'`). Pass non-serializable values such as renderer arrays as bare identifiers inline in the `mount()` props. The inverse also holds: imported plain *data* referenced inside `mount()` is mistaken for a component and replaced by an import-ref object, so extract the needed values to a local variable outside the call first (`const id = importedAsset.id`).
- **The `on` handler receives `event.detail`, not the event** (`listener(event.detail)`). This is inherent to `@sand4rt/experimental-ct-web`, which expects components to emit `CustomEvent`s and forwards only their `detail`, while components may also emit native events (like `change`) that carry no detail. So assert event values via events whose detail carries them; for Vaadin fields that is the `<prop>-changed` notify event (detail `{ value }`), while the native `change` event can only be counted. To await a single event's value, use the `shared.promiseEventDispatch()` fixture helper.
- **Vaadin fires an initial `<prop>-changed` at mount** (notify-on-first-commit), so a freshly mounted toggle emits `checked-changed(false)` before any interaction. Assert on the user-driven transitions (e.g. the last two values), not exact-array equality, and prove "emits nothing" with `not.toContain(true)` rather than `toEqual([])`.
- **Vaadin `<prop>-changed` events do not bubble or compose**, so a listener on a parent/group will not catch a child field's event; attach it to the field itself.
diff --git a/agent/src/main/java/org/openremote/agent/protocol/simulator/SimulatorAgentLink.java b/agent/src/main/java/org/openremote/agent/protocol/simulator/SimulatorAgentLink.java
index a326f9307..690525f9e 100644
--- a/agent/src/main/java/org/openremote/agent/protocol/simulator/SimulatorAgentLink.java
+++ b/agent/src/main/java/org/openremote/agent/protocol/simulator/SimulatorAgentLink.java
@@ -39,6 +39,7 @@ public class SimulatorAgentLink extends AgentLink<SimulatorAgentLink> {
" Predicted datapoints can be added by configuring 'Store predicted datapoints' which will insert the datapoints" +
" immediately as determined by the schedule." +
" If a recurring schedule is defined it recurringly inserts the next predicted dataset.")
+ @JsonSchemaFormat("simulator-replay-data")
protected SimulatorReplayDatapoint[] replayData;
@JsonSchemaTitle("Schedule")
diff --git a/ui/app/shared/locales/en/or.json b/ui/app/shared/locales/en/or.json
index 26bd0ce1f..242b3adbb 100644
--- a/ui/app/shared/locales/en/or.json
+++ b/ui/app/shared/locales/en/or.json
@@ -658,6 +658,8 @@
"scheduleRuleActivity": "Schedule Rule Activity",
"scheduleSimulatorActivity": "Simulator Replay Schedule",
"defaultSimulatorSchedule": "Replay today at {{time}}",
+ "simulatorReplayFormatHelper": "Format: seconds, value — one entry per line",
+ "simulatorReplayInvalidLine": "Invalid entry on line {{line}}, expected: seconds, value",
"schedule": {
"count_one": "occurrence",
"count_other": "occurrences",
diff --git a/ui/app/storybook/docs/components/or-vaadin-textarea.mdx b/ui/app/storybook/docs/components/or-vaadin-textarea.mdx
new file mode 100644
index 000000000..4c939e377
--- /dev/null
+++ b/ui/app/storybook/docs/components/or-vaadin-textarea.mdx
@@ -0,0 +1,27 @@
+{/*
+ * Copyright 2026, OpenRemote Inc.
+ *
+ * See the CONTRIBUTORS.txt file in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/}
+
+import { Meta } from '@storybook/addon-docs/blocks';
+import * as ComponentStory from "../../../../component/or-vaadin-components/stories/or-vaadin-text-area.stories"; // stories need relative imports
+import {ComponentDocs} from "../../util/componentdocs.mdx";
+
+<Meta title="Components/Text Area" />
+
+<ComponentDocs story={ComponentStory} options={{displayName: "Text Area"}} elementsjson={ComponentStory.customElements} />
diff --git a/ui/component/core/src/util.ts b/ui/component/core/src/util.ts
index d412bb6e2..a771221ed 100644
--- a/ui/component/core/src/util.ts
+++ b/ui/component/core/src/util.ts
@@ -286,6 +286,10 @@ export function objectsEqual(obj1?: any, obj2?: any, deep = true): boolean {
}
if (deep) {
+ // index-based comparison for arrays; the key-based check below is quadratic there
+ if (Array.isArray(obj1)) {
+ return obj1.every((item, i) => objectsEqual(item, obj2[i]));
+ }
// recursive object equality check
const p = Object.keys(obj1);
return Object.keys(obj2).every((i) => {
diff --git a/ui/component/or-attribute-input/build.gradle b/ui/component/or-attribute-input/build.gradle
index 09a840d61..a071bfbd8 100644
--- a/ui/component/or-attribute-input/build.gradle
+++ b/ui/component/or-attribute-input/build.gradle
@@ -20,3 +20,13 @@ tasks.register('prepareUi') {
tasks.register('publishUi') {
dependsOn clean, npmPublish
}
+
+tasks.register('npmTest', Exec) {
+ dependsOn getYarnInstallTask()
+ commandLine npmCommand("yarn"), "run", "test"
+}
+
+tasks.register('npmTestUI', Exec) {
+ dependsOn getYarnInstallTask()
+ commandLine npmCommand("yarn"), "run", "test", "--ui"
+}
diff --git a/ui/component/or-attribute-input/package.json b/ui/component/or-attribute-input/package.json
index 46cfe062d..6b130f503 100644
--- a/ui/component/or-attribute-input/package.json
+++ b/ui/component/or-attribute-input/package.json
@@ -15,7 +15,7 @@
"types": "lib/index.d.ts",
"scripts": {
"analyze": "npx cem analyze --config ../custom-elements-manifest.config.mjs",
- "test": "echo \"No tests\" && exit 0",
+ "test": "npx tsc -b && npx playwright test",
"prepack": "npx rspack"
},
"author": "OpenRemote",
diff --git a/ui/component/or-attribute-input/playwright.config.ts b/ui/component/or-attribute-input/playwright.config.ts
new file mode 100644
index 000000000..94d454129
--- /dev/null
+++ b/ui/component/or-attribute-input/playwright.config.ts
@@ -0,0 +1,3 @@
+import { defineCtConfig } from "@openremote/test/component.config";
+
+export default defineCtConfig(__dirname);
diff --git a/ui/component/or-attribute-input/src/index.ts b/ui/component/or-attribute-input/src/index.ts
index fb0df273d..dad6e6ff9 100644
--- a/ui/component/or-attribute-input/src/index.ts
+++ b/ui/component/or-attribute-input/src/index.ts
@@ -38,6 +38,7 @@ import {ErrorObject, OrJSONForms, StandardRenderers} from "@openremote/or-json-f
import {type OrInputChangedEventDetail} from "@openremote/or-mwc-components/or-mwc-input";
import {agentIdRendererRegistryEntry} from "./renderers/agent-link";
import {schedulerRendererRegistryEntry} from "./renderers/scheduler";
+import {replayDataRendererRegistryEntry} from "./renderers/replay-data";
export class OrAttributeInputChangedEvent extends CustomEvent<OrAttributeInputChangedEventDetail> {
@@ -111,7 +112,7 @@ export function getHelperText(sending: boolean, error: boolean, timestamp: numbe
return i18next.t("updatedWithDate", { date: new Date(timestamp) });
}
-const jsonFormsAttributeRenderers = [...StandardRenderers, agentIdRendererRegistryEntry, schedulerRendererRegistryEntry];
+export const jsonFormsAttributeRenderers = [...StandardRenderers, agentIdRendererRegistryEntry, schedulerRendererRegistryEntry, replayDataRendererRegistryEntry];
const schemas = new Map<string, unknown>();
const inflightRequests = new Map<string, Promise<unknown>>();
@@ -163,10 +164,15 @@ export const jsonFormsInputTemplateProvider: (fallback: ValueInputProvider, clea
return
}
- if (!Util.objectsEqual(dataAndErrors.data, prevValue)) {
+ if (dataAndErrors.data !== prevValue) {
+ // Reference check first; the deep compare only runs when json-forms hands
+ // out a new object, so unchanged content does not notify a change.
+ const changed = !Util.objectsEqual(dataAndErrors.data, prevValue);
prevValue = dataAndErrors.data;
- const errors = !!dataAndErrors.errors?.length;
- valueChangeNotifier({ value: dataAndErrors.data, errors });
+ if (changed) {
+ const errors = !!dataAndErrors.errors?.length;
+ valueChangeNotifier({ value: dataAndErrors.data, errors });
+ }
}
};
@@ -325,7 +331,7 @@ export class OrAttributeInput extends subscribe(manager)(translate(i18next)(LitE
display: none;
}
- #send-btn {
+ #send-btn {
flex: 0;
margin-left: 4px;
--or-icon-width: 20px;
@@ -438,19 +444,24 @@ export class OrAttributeInput extends subscribe(manager)(translate(i18next)(LitE
}
if (_changedProperties.has("attribute")) {
- const oldAttr = {..._changedProperties.get("attribute") as Attribute<any>};
+ const oldAttr = _changedProperties.get("attribute") as Attribute<any>;
const attr = this.attribute;
if (oldAttr && attr) {
const oldValue = oldAttr.value;
const oldTimestamp = oldAttr.timestamp;
- // Compare attributes ignoring the timestamp and value
- oldAttr.value = attr.value;
- oldAttr.timestamp = attr.timestamp;
- if (Util.objectsEqual(oldAttr, attr)) {
+ // Structural check: name, type, and meta reference must all match.
+ // Live value updates arrive as shallow copies of the attribute ({...attr}),
+ // so meta keeps the same reference and this check is O(1).
+ // A full asset reload produces a new meta reference, which is sufficient
+ // to detect a structural change without deep-comparing large meta values.
+ const structurallyEqual = oldAttr.name === attr.name
+ && oldAttr.type === attr.type
+ && oldAttr.meta === attr.meta;
+ if (structurallyEqual) {
// Compare value and timestamp
- if (!Util.objectsEqual(oldValue, attr.value) || oldTimestamp !== attr.timestamp) {
+ if (oldValue !== attr.value || oldTimestamp !== attr.timestamp) {
this._onAttributeValueChanged(oldValue, attr.value, attr.timestamp);
} else if (_changedProperties.size === 1) {
// Only the attribute has 'changed' and we've handled it so don't perform update
@@ -563,6 +574,8 @@ export class OrAttributeInput extends subscribe(manager)(translate(i18next)(LitE
label: this.getLabel(),
comfortable: this.comfortable,
resizeVertical: this.resizeVertical,
+ minRows: 5,
+ manualresize: true,
inputType: this.inputType
};
diff --git a/ui/component/or-attribute-input/src/renderers/replay-data.ts b/ui/component/or-attribute-input/src/renderers/replay-data.ts
new file mode 100644
index 000000000..384dd8397
--- /dev/null
+++ b/ui/component/or-attribute-input/src/renderers/replay-data.ts
@@ -0,0 +1,162 @@
+/*
+ * Copyright 2026, OpenRemote Inc.
+ *
+ * See the CONTRIBUTORS.txt file in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+import { html } from "lit";
+import { i18next } from "@openremote/or-translate";
+import {
+ JsonFormsStateContext,
+ getTemplateWrapper,
+ JsonFormsRendererRegistryEntry,
+ RankedTester,
+ rankWith,
+ ControlProps,
+ mapStateToControlProps,
+ mapDispatchToControlProps,
+ schemaMatches,
+} from "@openremote/or-json-forms";
+import "@openremote/or-vaadin-components/or-vaadin-text-area";
+import { SimulatorReplayDatapoint } from "@openremote/model";
+
+// Cache keyed by data array reference so re-renders return the same string object.
+// Lit's property binding uses === to detect changes, so an identical reference
+// prevents setting .value on the textarea (and its expensive internal string scan).
+const textCache = new WeakMap<SimulatorReplayDatapoint[], string>();
+
+function datapointsToText(data: SimulatorReplayDatapoint[] | undefined): string {
+ if (!Array.isArray(data) || data.length === 0) return "";
+ const cached = textCache.get(data);
+ if (cached !== undefined) return cached;
+ const parts = new Array<string>(data.length);
+ for (let i = 0; i < data.length; i++) {
+ // JSON-encode the value so non-primitives and typed strings ("5", "true")
+ // survive the text round trip. Numbers/booleans render bare, strings quoted.
+ parts[i] = `${data[i].timestamp}, ${JSON.stringify(data[i].value)}`;
+ }
+ const text = parts.join("\n");
+ textCache.set(data, text);
+ return text;
+}
+
+interface ParseResult {
+ datapoints: SimulatorReplayDatapoint[];
+ /** 1-based line number of the first invalid line, or null when all lines parsed. */
+ invalidLine: number | null;
+}
+
+function textToDatapoints(text: string): ParseResult {
+ const datapoints: SimulatorReplayDatapoint[] = [];
+ const len = text.length;
+ let lineStart = 0;
+ let line = 0;
+
+ while (lineStart < len) {
+ let lineEnd = text.indexOf("\n", lineStart);
+ if (lineEnd === -1) lineEnd = len;
+ line++;
+
+ if (lineEnd > lineStart) {
+ const commaIdx = text.indexOf(",", lineStart);
+ if (commaIdx !== -1 && commaIdx < lineEnd) {
+ const timestampStr = text.slice(lineStart, commaIdx).trim();
+ const timestamp = Number(timestampStr);
+ // Explicit empty check: Number("") is 0, not NaN.
+ if (timestampStr === "" || !Number.isFinite(timestamp)) {
+ return { datapoints, invalidLine: line };
+ }
+ const valueStr = text.slice(commaIdx + 1, lineEnd).trim();
+ const num = Number(valueStr);
+ let value: any;
+ if (valueStr !== "" && !isNaN(num)) {
+ value = num;
+ } else {
+ // JSON covers booleans, quoted strings, objects/arrays;
+ // anything else is treated leniently as a bare string.
+ try {
+ value = JSON.parse(valueStr);
+ } catch {
+ value = valueStr;
+ }
+ }
+ datapoints.push({ timestamp, value });
+ } else if (text.slice(lineStart, lineEnd).trim() !== "") {
+ return { datapoints, invalidLine: line };
+ }
+ }
+
+ lineStart = lineEnd + 1;
+ }
+
+ return { datapoints, invalidLine: null };
+}
+
+const replayDataTester: RankedTester = rankWith(
+ 6,
+ schemaMatches((schema) => schema.format === "simulator-replay-data")
+);
+
+const replayDataRenderer = (state: JsonFormsStateContext, props: ControlProps) => {
+ props = {
+ ...props,
+ ...mapStateToControlProps({jsonforms: {...state}}, props),
+ ...mapDispatchToControlProps(state.dispatch)
+ };
+
+ const onChanged = (event: Event) => {
+ const textArea = event.target as HTMLInputElement & { invalid: boolean; errorMessage: string };
+ const { datapoints, invalidLine } = textToDatapoints(textArea.value);
+ if (invalidLine !== null) {
+ // Don't commit: the data stays untouched and, since no state changes,
+ // the textarea keeps the user's draft instead of dropping bad lines.
+ // Requires manual-validation, otherwise Vaadin's focusout auto-validation
+ // (which runs after this change handler) resets invalid to false.
+ textArea.errorMessage = i18next.t("simulatorReplayInvalidLine", { line: invalidLine });
+ textArea.invalid = true;
+ return;
+ }
+ textArea.invalid = false;
+ props.handleChange(props.path, datapoints.length > 0 ? datapoints : undefined);
+ };
+
+ const textValue = datapointsToText(props.data);
+
+ let deleteHandler: undefined | (() => void);
+ if (!props.required && props.path) {
+ deleteHandler = () => {
+ props.handleChange(props.path, undefined);
+ };
+ }
+
+ return getTemplateWrapper(html`
+ <or-vaadin-text-area
+ label="${props.label}"
+ helper-text="${i18next.t("simulatorReplayFormatHelper")}"
+ style="width: 100%;"
+ min-rows="5"
+ manualresize
+ manual-validation
+ .value="${textValue}"
+ @change="${onChanged}"
+ ></or-vaadin-text-area>
+ `, deleteHandler);
+};
+
+export const replayDataRendererRegistryEntry: JsonFormsRendererRegistryEntry = {
+ tester: replayDataTester,
+ renderer: replayDataRenderer
+};
diff --git a/ui/component/or-attribute-input/test/replay-data.test.ts b/ui/component/or-attribute-input/test/replay-data.test.ts
new file mode 100644
index 000000000..f44e9c1fa
--- /dev/null
+++ b/ui/component/or-attribute-input/test/replay-data.test.ts
@@ -0,0 +1,130 @@
+/*
+ * Copyright 2026, OpenRemote Inc.
+ *
+ * See the CONTRIBUTORS.txt file in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+import { ct, expect } from "@openremote/test";
+
+import { OrJSONForms } from "@openremote/or-json-forms";
+import { jsonFormsAttributeRenderers } from "@openremote/or-attribute-input";
+
+const schema = {
+ type: "array",
+ format: "simulator-replay-data",
+ title: "Replay data",
+} as any;
+
+// `renderers` is intentionally not part of this helper: `jsonFormsAttributeRenderers`
+// must be referenced lexically inside each mount() call so Playwright CT turns the
+// import into a browser-side import ref. Referenced anywhere else, the import is
+// evaluated in Node, which cannot require() the CSS files or-mwc-components pulls in.
+const props = (data: any) => ({
+ uischema: { type: "Control", scope: "#" } as any,
+ schema,
+ data,
+ onChange: () => null,
+ label: "Replay data",
+});
+
+/** Reads the data held by the JSON Forms core (the committed state after change events). */
+function getData(component: any) {
+ return component.evaluate((el: any) => el.core.data);
+}
+
+ct.beforeEach(async ({ shared }) => {
+ await shared.fonts();
+ await shared.locales();
+});
+
+ct("renders datapoints as one 'seconds, value' entry per line", async ({ mount }) => {
+ const component = await mount(OrJSONForms, {
+ props: {
+ ...props([
+ { timestamp: 0, value: 21.5 },
+ { timestamp: 30, value: "on" },
+ { timestamp: 60, value: true },
+ ]),
+ renderers: jsonFormsAttributeRenderers,
+ },
+ on: {},
+ });
+
+ // Strings render JSON-quoted so they round-trip as strings ("on" vs the bare on).
+ await expect(component.getByRole("textbox")).toHaveValue('0, 21.5\n30, "on"\n60, true');
+});
+
+ct("commits parsed datapoints on change, preserving value types", async ({ mount }) => {
+ const component = await mount(OrJSONForms, {
+ props: { ...props([]), renderers: jsonFormsAttributeRenderers },
+ on: {},
+ });
+
+ const input = component.getByRole("textbox");
+ // Covers: number, quoted string of a number (stays a string), boolean,
+ // a skipped blank line, and a bare unquoted string (lenient fallback).
+ await input.fill('0, 5\n30, "5"\n60, true\n\n90, on');
+ await input.blur();
+
+ await expect.poll(() => getData(component)).toEqual([
+ { timestamp: 0, value: 5 },
+ { timestamp: 30, value: "5" },
+ { timestamp: 60, value: true },
+ { timestamp: 90, value: "on" },
+ ]);
+});
+
+ct("flags the first invalid line, keeps the draft and recovers once fixed", async ({ mount }) => {
+ const original = [{ timestamp: 0, value: 5 }];
+ const component = await mount(OrJSONForms, {
+ props: { ...props(original), renderers: jsonFormsAttributeRenderers },
+ on: {},
+ });
+
+ const input = component.getByRole("textbox");
+ await input.fill("0, 5\nabc, 7");
+ await input.blur();
+
+ // The error is shown with the offending line number and nothing is committed:
+ // the draft (including the bad line) stays in the textarea for correction.
+ const textArea = component.locator("or-vaadin-text-area");
+ await expect(textArea).toHaveAttribute("invalid");
+ await expect(component).toContainText("Invalid entry on line 2");
+ await expect(input).toHaveValue("0, 5\nabc, 7");
+ await expect.poll(() => getData(component)).toEqual(original);
+
+ // Fixing the line clears the error and commits the parsed datapoints.
+ await input.fill("0, 5\n10, 7");
+ await input.blur();
+ await expect(textArea).not.toHaveAttribute("invalid");
+ await expect.poll(() => getData(component)).toEqual([
+ { timestamp: 0, value: 5 },
+ { timestamp: 10, value: 7 },
+ ]);
+});
+
+ct("clearing the text removes the data", async ({ mount }) => {
+ const component = await mount(OrJSONForms, {
+ props: { ...props([{ timestamp: 0, value: 5 }]), renderers: jsonFormsAttributeRenderers },
+ on: {},
+ });
+
+ const input = component.getByRole("textbox");
+ await input.fill("");
+ await input.blur();
+
+ await expect.poll(() => getData(component)).toBeUndefined();
+});
diff --git a/ui/component/or-json-forms/src/index.ts b/ui/component/or-json-forms/src/index.ts
index 464fd5463..f7103827a 100644
--- a/ui/component/or-json-forms/src/index.ts
+++ b/ui/component/or-json-forms/src/index.ts
@@ -175,10 +175,14 @@ export class OrJSONForms extends translate(i18next)(LitElement) implements OwnPr
if (_changedProperties.has("core")) {
const data = this.core!.data;
- const errors = this.core!.errors;
-
- if (this.onChange && (!Util.objectsEqual(data, this.previousData, true) || (errors && !Util.objectsEqual(errors, this.previousErrors, true)))) {
- this.previousErrors = errors || [];
+ const errors = this.core!.errors ?? [];
+
+ // Normalize undefined to [] before comparing (previousErrors is always an array),
+ // and treat two empty arrays as equal so a rebuilt empty errors array from a
+ // validation cycle doesn't fire a spurious onChange.
+ const errorsChanged = errors !== this.previousErrors && (errors.length > 0 || this.previousErrors.length > 0);
+ if (this.onChange && (data !== this.previousData || errorsChanged)) {
+ this.previousErrors = errors;
this.previousData = data;
this.onChange({data: data, errors: errors});
}
diff --git a/ui/component/or-json-forms/src/styles.ts b/ui/component/or-json-forms/src/styles.ts
index 110104767..db31cecf3 100644
--- a/ui/component/or-json-forms/src/styles.ts
+++ b/ui/component/or-json-forms/src/styles.ts
@@ -6,7 +6,7 @@ export const baseStyle = css`
:host {
flex: 1;
}
-
+
.item-container {
display: flex;
}
diff --git a/ui/component/or-vaadin-components/build.gradle b/ui/component/or-vaadin-components/build.gradle
index d24127a41..3a54d02c0 100644
--- a/ui/component/or-vaadin-components/build.gradle
+++ b/ui/component/or-vaadin-components/build.gradle
@@ -27,3 +27,13 @@ tasks.register('npmBuild', Exec) {
dependsOn getYarnInstallTask()
commandLine npmCommand("yarn"), "run", "build"
}
+
+tasks.register('npmTest', Exec) {
+ dependsOn getYarnInstallTask()
+ commandLine npmCommand("yarn"), "run", "test"
+}
+
+tasks.register('npmTestUI', Exec) {
+ dependsOn getYarnInstallTask()
+ commandLine npmCommand("yarn"), "run", "test", "--ui"
+}
diff --git a/ui/component/or-vaadin-components/custom-elements-manifest.config.mjs b/ui/component/or-vaadin-components/custom-elements-manifest.config.mjs
index 93ceffb92..3de8cbf36 100644
--- a/ui/component/or-vaadin-components/custom-elements-manifest.config.mjs
+++ b/ui/component/or-vaadin-components/custom-elements-manifest.config.mjs
@@ -98,6 +98,27 @@ const VaadinSuperclassParserPlugin = {
}
}
+/**
+ * Custom plugin that we wrote ourselves, that marks underscore-prefixed members as
+ * protected/private (the Vaadin naming convention), since the inherited Vaadin code
+ * carries no privacy metadata. Consumers such as the Storybook helpers rely on the
+ * privacy field to skip internals.
+ */
+const VaadinPrivacyPlugin = {
+ name: 'vaadin-privacy',
+ packageLinkPhase({customElementsManifest}) {
+ for (const module of customElementsManifest.modules ?? []) {
+ for (const declaration of module.declarations ?? []) {
+ for (const member of declaration.members ?? []) {
+ if (!member.privacy && member.name.startsWith('_')) {
+ member.privacy = member.name.startsWith('__') ? 'private' : 'protected';
+ }
+ }
+ }
+ }
+ }
+}
+
/* -------------------------------- */
// Retrieve path to the Vaadin NPM package
@@ -111,6 +132,7 @@ export default {
...baseConfig.plugins,
VaadinSuperclassParserPlugin, // Resolve conflict in package names
cemInheritancePlugin(), // Inject the analysis of the inherited Vaadin code
- VaadinJSDocParserPlugin // Inject JSDoc of the inherited Vaadin code
+ VaadinJSDocParserPlugin, // Inject JSDoc of the inherited Vaadin code
+ VaadinPrivacyPlugin // Mark inherited underscore members as non-public
]
}
diff --git a/ui/component/or-vaadin-components/src/or-vaadin-text-area.ts b/ui/component/or-vaadin-components/src/or-vaadin-text-area.ts
index ef387d9c3..2c424bd76 100644
--- a/ui/component/or-vaadin-components/src/or-vaadin-text-area.ts
+++ b/ui/component/or-vaadin-components/src/or-vaadin-text-area.ts
@@ -17,16 +17,65 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-import {customElement} from "lit/decorators.js";
+import {customElement, property} from "lit/decorators.js";
import {TextArea} from "@vaadin/text-area";
import {OrVaadinComponent} from "./util";
-import {type LitElement} from "lit";
+import {type LitElement, type PropertyValues} from "lit";
+// _updateHeight is defined in Vaadin's TextAreaMixin (not TextArea itself); the cast exposes it.
@customElement("or-vaadin-text-area")
-export class OrVaadinTextArea extends (TextArea as new () => TextArea & LitElement) implements OrVaadinComponent {
+export class OrVaadinTextArea extends (TextArea as new () => TextArea & LitElement & { _updateHeight(): void }) implements OrVaadinComponent {
+
+ // Show a native vertical resize handle and stop automatic resizing: the height starts at
+ // min-rows and stays fixed until the user drags it. Default is Vaadin's autoresize.
+ // Touch devices get no usable native handle; the height then simply stays fixed.
+ @property({type: Boolean})
+ manualresize = false;
override _onEnter(ev: KeyboardEvent) {
- this.dispatchEvent(new CustomEvent("submit", {bubbles: true, composed: true}));
+ // Shift+Enter inserts a newline without submitting the value.
+ if (!ev.shiftKey) {
+ this.dispatchEvent(new CustomEvent("submit", {bubbles: true, composed: true}));
+ }
return super._onEnter(ev);
}
+
+ // Vaadin's default _updateHeight reads scrollHeight on every value change to autoresize.
+ // In manualresize mode, keep the height fixed and offer a native resize handle instead.
+ override _updateHeight(): void {
+ if (!this.inputElement) return;
+ const inputField = this.shadowRoot?.querySelector<HTMLElement>('[part~="input-field"]');
+ if (this.manualresize) {
+ if (inputField) {
+ // The container wraps the textarea (auto height, capped by max-rows) so a
+ // resize drag grows the whole field without a second scrollbar of its own.
+ inputField.style.height = "auto";
+ inputField.style.overflowY = "hidden";
+ }
+ this.inputElement.style.overflowY = "auto";
+ // Fixed height with a native vertical handle. Vaadin's own min-rows sets the
+ // initial height and max-rows caps it, so no row-to-pixel math is reimplemented.
+ // Coarse pointers get no handle (Vaadin's resize: none) as it is unusable on touch.
+ if (window.matchMedia("(pointer: coarse)").matches) {
+ this.inputElement.style.removeProperty("resize");
+ } else {
+ this.inputElement.style.resize = "vertical";
+ }
+ return;
+ }
+ // Autoresize: drop the manual overrides (no-ops when never set) and keep Vaadin's
+ // stock behavior (scrollbar-flicker minimization, scroll-position preservation).
+ this.inputElement.style.removeProperty("resize");
+ this.inputElement.style.removeProperty("overflow-y");
+ if (inputField) inputField.style.removeProperty("overflow-y");
+ super._updateHeight();
+ }
+
+ protected override updated(changedProperties: PropertyValues): void {
+ super.updated(changedProperties);
+ // _updateHeight only runs on value changes; re-apply when the mode toggles.
+ if (changedProperties.has("manualresize")) {
+ this._updateHeight();
+ }
+ }
}
diff --git a/ui/component/or-vaadin-components/src/value-input-provider.ts b/ui/component/or-vaadin-components/src/value-input-provider.ts
index 332d2f306..849034c9e 100644
--- a/ui/component/or-vaadin-components/src/value-input-provider.ts
+++ b/ui/component/or-vaadin-components/src/value-input-provider.ts
@@ -64,6 +64,8 @@ export interface ValueInputProviderOptions {
outlined?: boolean;
comfortable?: boolean;
resizeVertical?: boolean;
+ minRows?: number;
+ manualresize?: boolean;
inputType?: InputType;
}
@@ -347,6 +349,8 @@ export const getValueHolderInputTemplateProvider: ValueInputProviderGenerator =
?autofocus=${focused} ?required=${required} ?readonly=${readonly} ?disabled=${disabled}
.items=${ifDefined(selectOptions)} step=${ifDefined(step)}
helper-text="${ifDefined(helperText)}" ?resizeVertical="${resizeVertical}"
+ min-rows="${ifDefined(inputType === InputType.TEXTAREA ? options.minRows : undefined)}"
+ ?manualresize="${inputType === InputType.TEXTAREA && !!options.manualresize}"
?rounded="${options.rounded}" ?outlined="${options.outlined}"
@change="${onValueChange}"
@submit="${onValueChange}"
diff --git a/ui/component/or-vaadin-components/stories/or-vaadin-text-area.stories.ts b/ui/component/or-vaadin-components/stories/or-vaadin-text-area.stories.ts
new file mode 100644
index 000000000..3a2f366c6
--- /dev/null
+++ b/ui/component/or-vaadin-components/stories/or-vaadin-text-area.stories.ts
@@ -0,0 +1,106 @@
+/*
+ * Copyright 2026, OpenRemote Inc.
+ *
+ * See the CONTRIBUTORS.txt file in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+import {setCustomElementsManifest, type Meta, type StoryObj } from "@storybook/web-components";
+import {getORStorybookHelpers} from "../../storybook-utils";
+import customElements from "../custom-elements.json" with { type: "json" };
+import packageJson from "../package.json" with { type: "json" };
+import "../src/or-vaadin-text-area";
+
+const tagName = "or-vaadin-text-area";
+type Story = StoryObj;
+setCustomElementsManifest(customElements);
+
+const { events, args, argTypes, template } = getORStorybookHelpers(tagName);
+
+const meta: Meta = {
+ title: "Playground/or-vaadin-components/text-area",
+ component: tagName,
+ args: args,
+ argTypes: argTypes,
+ render: storyArgs => template(storyArgs),
+ excludeStories: /^[a-z].*/,
+ parameters: {
+ actions: {
+ handles: events
+ },
+ docs: {
+ subtitle: `<${tagName}>`,
+ description: "Text Area is a multi-line text input. By default it automatically resizes with its content, bounded by `min-rows`/`max-rows`; set `manualresize` for a fixed height (starting at `min-rows`) with a native resize handle."
+ }
+ }
+};
+
+// Default: automatically resizes with the content.
+export const Primary: Story = {
+ args: {
+ label: "Notes",
+ value: "OpenRemote"
+ },
+ parameters: {
+ docs: {
+ story: {
+ height: "120px"
+ }
+ }
+ }
+};
+
+// Fixed height with a native vertical resize handle; overflow scrolls until dragged.
+export const ManualResize: Story = {
+ parameters: {
+ title: "Manual resizing",
+ summary: "With `manualresize` the field starts at `min-rows`, keeps a fixed height, and shows the native resize handle. Overflowing content scrolls until the handle is dragged.",
+ docs: {
+ story: {
+ height: "180px"
+ }
+ }
+ },
+ args: {
+ label: "Notes",
+ minRows: 5,
+ manualresize: true,
+ value: "one\ntwo\nthree\nfour\nfive\nsix\nseven\neight"
+ }
+};
+
+// Automatic resizing constrained to a number of rows.
+export const BoundedAutoresize: Story = {
+ parameters: {
+ title: "Bounded automatic resizing",
+ summary: "`min-rows` and `max-rows` bound the automatic resizing: the field starts at `min-rows` and grows with the content until `max-rows`, after which it scrolls.",
+ docs: {
+ story: {
+ height: "140px"
+ }
+ }
+ },
+ args: {
+ label: "Notes",
+ minRows: 2,
+ maxRows: 6
+ }
+};
+
+export const examples: Story[] = [ManualResize, BoundedAutoresize];
+
+export {customElements, packageJson};
+
+export default meta;
diff --git a/ui/component/or-vaadin-components/test/or-vaadin-text-area.test.ts b/ui/component/or-vaadin-components/test/or-vaadin-text-area.test.ts
new file mode 100644
index 000000000..37b0dde5f
--- /dev/null
+++ b/ui/component/or-vaadin-components/test/or-vaadin-text-area.test.ts
@@ -0,0 +1,170 @@
+/*
+ * Copyright 2026, OpenRemote Inc.
+ *
+ * See the CONTRIBUTORS.txt file in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+import { ct, expect } from "@openremote/test";
+
+import { OrVaadinTextArea } from "@openremote/or-vaadin-components/or-vaadin-text-area";
+
+function lines(count: number): string {
+ return Array.from({ length: count }, (_, i) => `line ${i + 1}`).join("\n");
+}
+
+ct.describe("Submit", () => {
+ // The `submit` CustomEvent carries no detail, so it can only be counted.
+ ct("enter dispatches a submit event", async ({ mount }) => {
+ let submitCount = 0;
+ const component = await mount(OrVaadinTextArea, {
+ props: { label: "Text" },
+ on: {
+ submit: () => {
+ submitCount += 1;
+ },
+ },
+ });
+
+ const input = component.getByRole("textbox", { name: "Text" });
+ await input.fill("first");
+ await input.press("Enter");
+
+ await expect.poll(() => submitCount).toBe(1);
+ // Enter must still insert the newline (default keydown behavior is preserved).
+ await expect(input).toHaveValue("first\n");
+ });
+
+ ct("shift+enter inserts a newline without submitting", async ({ mount }) => {
+ let submitCount = 0;
+ const component = await mount(OrVaadinTextArea, {
+ props: { label: "Text" },
+ on: {
+ submit: () => {
+ submitCount += 1;
+ },
+ },
+ });
+
+ const input = component.getByRole("textbox", { name: "Text" });
+ await input.fill("first");
+ await input.press("Shift+Enter");
+ await input.pressSequentially("second");
+
+ await expect(input).toHaveValue("first\nsecond");
+ expect(submitCount).toBe(0);
+ });
+});
+
+ct.describe("Height", () => {
+ ct("manualresize fixes the input area to the min-rows height and scrolls instead of growing", async ({ mount }) => {
+ const component = await mount(OrVaadinTextArea, { props: { label: "Text", minRows: 3, manualresize: true } });
+
+ const input = component.getByRole("textbox", { name: "Text" });
+ await input.fill(lines(30));
+
+ // The textarea starts at the min-rows height and scrolls the overflowing
+ // content; the container wraps it without a second scrollbar.
+ const inputField = component.locator("[part~='input-field']");
+ await expect(input).toHaveCSS("overflow-y", "auto");
+ await expect(inputField).toHaveCSS("overflow-y", "hidden");
+
+ // The host must not autoresize when more content is added.
+ const before = (await component.boundingBox())!.height;
+ await input.fill(lines(60));
+ const after = (await component.boundingBox())!.height;
+ expect(after).toBe(before);
+
+ // Manual mode enables the native resize handle.
+ await expect(input).toHaveCSS("resize", "vertical");
+
+ // A native resize drag writes an inline height on the textarea;
+ // later value changes must not snap it back to the min-rows height.
+ await input.evaluate((el) => { el.style.height = "208px"; });
+ await input.fill(lines(90));
+ await expect(input).toHaveCSS("height", "208px");
+ });
+
+ ct("the resize handle drags the textarea taller", async ({ mount, page, shared }) => {
+ const component = await mount(OrVaadinTextArea, { props: { label: "Text", minRows: 3, manualresize: true } });
+
+ const input = component.getByRole("textbox", { name: "Text" });
+ // Overflowing content matters: the scrollbar historically competed with the
+ // handle (and on the input container the slotted textarea covered it entirely).
+ await input.fill(lines(30));
+
+ // Drag the native handle (bottom-right corner of the textarea) 100px down.
+ const box = (await input.boundingBox())!;
+ await page.mouse.move(box.x + box.width - 4, box.y + box.height - 4);
+ await shared.drag(box.x + box.width - 4, box.y + box.height + 96);
+ await expect.poll(async () => (await input.boundingBox())!.height).toBeGreaterThan(box.height + 60);
+ });
+
+ ct("manualresize shows no handle on touch devices but stays fixed", async ({ mount }) => {
+ const component = await mount(OrVaadinTextArea, { props: { label: "Text", minRows: 3, manualresize: true } });
+
+ // Stub the coarse-pointer media query; Playwright's hasTouch emulation
+ // does not flip the CSS pointer feature in every browser.
+ await component.evaluate(() => {
+ const original = window.matchMedia.bind(window);
+ window.matchMedia = (query: string) =>
+ query === "(pointer: coarse)" ? ({ matches: true } as MediaQueryList) : original(query);
+ });
+
+ const input = component.getByRole("textbox", { name: "Text" });
+ // The fill triggers the height update, which now takes the coarse-pointer branch.
+ await input.fill(lines(30));
+ await expect(input).toHaveCSS("resize", "none");
+
+ // The height must stay fixed at min-rows rather than autoresize.
+ const before = (await component.boundingBox())!.height;
+ await input.fill(lines(60));
+ expect((await component.boundingBox())!.height).toBe(before);
+ });
+
+ ct("autoresize (the default) has no resize handle and grows with the content", async ({ mount }) => {
+ const component = await mount(OrVaadinTextArea, { props: { label: "Text" } });
+
+ const input = component.getByRole("textbox", { name: "Text" });
+ await input.fill(lines(1));
+ const singleLine = (await component.boundingBox())!.height;
+ await expect(input).toHaveCSS("resize", "none");
+
+ await input.fill(lines(10));
+ await expect.poll(async () => (await component.boundingBox())!.height).toBeGreaterThan(singleLine);
+ });
+
+ ct("min-rows sets the initial visible height", async ({ mount }) => {
+ const component = await mount(OrVaadinTextArea, { props: { label: "Text", minRows: 2 } });
+ const twoRows = (await component.boundingBox())!.height;
+
+ // Compare on the same element: mount() returns a shared #root locator,
+ // so a second mount would measure the same node.
+ await component.evaluate((el: any) => { el.minRows = 8; });
+ await expect.poll(async () => (await component.boundingBox())!.height).toBeGreaterThan(twoRows);
+ });
+
+ ct("max-rows caps the autoresize and scrolls the overflow", async ({ mount }) => {
+ const component = await mount(OrVaadinTextArea, { props: { label: "Text", minRows: 2, maxRows: 4 } });
+
+ const input = component.getByRole("textbox", { name: "Text" });
+ await input.fill(lines(6));
+ const capped = (await component.boundingBox())!.height;
+
+ // Past max-rows the field must stop growing and scroll instead.
+ await input.fill(lines(40));
+ expect(Math.abs((await component.boundingBox())!.height - capped)).toBeLessThanOrEqual(2);
+ });
+});