test(webui): migrate UI tests to Preact testing library and fix tasks Fragment render
Use @testing-library/preact rendered under jsdom (registered via test/register.js) so the Post-Preact .jsx components and pages are exercised through the real automatic-runtime render path instead of the legacy el() DOM-helper API the tests were written against. - Add jsdom + @testing-library/preact dev deps and a jsdom globals setup in ui/test/register.js (window/document/navigator/getComputedStyle/...). - Switch the .jsx loader hook to the automatic JSX runtime to match @preact/preset-vite, so source files that shadow h (mapping-editor) and Fragment/children arrays work exactly as in the Vite build. - Migrate captures, config-row, mappings, settings-update-status, task-logs, settings-lifecycle, settings-schema, tasks-actions and the chat-app tests to render the Preact components and query the DOM via testing-library. - Fix a real render bug in tasks.jsx: <h.Fragment> is not rendered by the automatic runtime (rows came out as [object Object]); use the imported <Fragment> instead, matching the other migrated modules.
This commit is contained in:
1 parent
4a329fb43d
commit
5965f3158a
15 files changed
+1984
-202
No files matched your search
@@ -1,4 +1,4 @@
|
||||
import { h } from "preact";
|
||||
import { Fragment } from "preact";
|
||||
import { useState, useEffect, useRef } from "preact/hooks";
|
||||
import "./tasks.css";
|
||||
import { api } from "../base/api.jsx";
|
||||
@@ -398,7 +398,7 @@ function TasksApp({ query }) {
|
||||
const expanded = expandedId === t.id;
|
||||
const timelineID = `task-timeline-${t.id}`;
|
||||
return (
|
||||
<h.Fragment key={t.id}>
|
||||
<Fragment key={t.id}>
|
||||
<tr
|
||||
className="task-row"
|
||||
id={`task-row-${t.id}`}
|
||||
@@ -445,7 +445,7 @@ function TasksApp({ query }) {
|
||||
<td data-label="Actions">{renderTaskActions(t)}</td>
|
||||
</tr>
|
||||
{expanded && renderTimelineRow(t)}
|
||||
</h.Fragment>
|
||||
</Fragment>
|
||||
);
|
||||
});
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user